Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (767)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (854)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  GL_MAX_UNIFORM_BLOCK_SIZE meaning?  (Read 2616 times)
0 Members and 1 Guest are viewing this topic.
Offline theagentd
« Posted 2015-12-21 04:44:38 »

Hey. I'm finally thinking of making the move to uniform buffers, but I'm a bit confused by the spec, specifically the limitations imposed by GL_MAX_UNIFORM_BLOCK_SIZE.

According to the wiki this limitation applies to the uniform buffer size.
Quote
There is also a limitation on the available storage per uniform buffer. This is queried through GL_MAX_UNIFORM_BLOCK_SIZE. This is in basic machine units (ie: bytes).
That means that the biggest uniform buffer I can ever create is 16kbs, which would severely limit my ability to pack the uniforms for a large number of draw calls in the same buffer. Having model+view+projection matrices alone limits me to 85 draw calls without any other uniforms limits me to 85 draw calls per buffer. This is really annoying.

The spec however says this about GL_MAX_UNIFORM_BLOCK_SIZE:
Quote
Max size in basic machine units of a uniform block
That would mean that I could create a uniform buffer as big as I want as long as no uniform block is bigger than 16kbs, which I won't ever get close to. And indeed, the Nvidia driver throws no error when I create an almost 2GB big uniform buffer, just kindly informing me that it was placed in video memory.

The wiki must be wrong here, right? I just want to rule out that this is an Nvidia quirk.

Myomyomyo.
Offline Catharsis

JGO Ninja


Medals: 75
Projects: 1
Exp: 21 years


TyphonRT rocks!


« Reply #1 - Posted 2015-12-21 07:15:06 »

While I chilled out on working w/ modern GL while waiting for Vulkan to drop I don't have firsthand experience, but dug up these links / info.

It seems GL_MAX_UNIFORM_BLOCK_SIZE is the limit of what can be bound and is addressable and you can have a much larger buffer allocated; see 'TheChubu' comment here:
http://www.gamedev.net/topic/673534-instancing-and-the-various-ways-to-supply-per-instance-data/

Also good discussion between vendors here:
http://www.yosoygames.com.ar/wp/2015/01/uniform-buffers-vs-texture-buffers-the-2015-edition/

Are you getting 16 kB for GL_MAX_UNIFORM_BLOCK_SIZE w/ NVidia card?  Seems like the common NVidia value is 64kB.

Good luck!

Check out the TyphonRT Video Suite:
http://www.typhonvideo.com/

Founder & Principal Architect; TyphonRT, Inc.
http://www.typhonrt.org/
http://www.egrsoftware.com/
https://plus.google.com/u/0/+MichaelLeahy/
Offline princec

« JGO Spiffy Duke »


Medals: 1053
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #2 - Posted 2015-12-21 09:27:23 »

I dunno why you're persevering with trying to extract all the clever from the later versions of OpenGL when the prevailing wind tells me that we'll all desert it for Vulkan long before even GL4.0+ becomes a viable target for the mass market...

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline theagentd
« Reply #3 - Posted 2015-12-21 13:55:04 »

While I chilled out on working w/ modern GL while waiting for Vulkan to drop I don't have firsthand experience, but dug up these links / info.

It seems GL_MAX_UNIFORM_BLOCK_SIZE is the limit of what can be bound and is addressable and you can have a much larger buffer allocated; see 'TheChubu' comment here:
http://www.gamedev.net/topic/673534-instancing-and-the-various-ways-to-supply-per-instance-data/

Also good discussion between vendors here:
http://www.yosoygames.com.ar/wp/2015/01/uniform-buffers-vs-texture-buffers-the-2015-edition/

Are you getting 16 kB for GL_MAX_UNIFORM_BLOCK_SIZE w/ NVidia card?  Seems like the common NVidia value is 64kB.

Good luck!

Thanks, that's what I thought. I am getting 64kB on my Nvidia card, but some Intel cards only support 16kB or 32kB, and the spec only mandates 16kB, so that's what I'll have to roll with.

I dunno why you're persevering with trying to extract all the clever from the later versions of OpenGL when the prevailing wind tells me that we'll all desert it for Vulkan long before even GL4.0+ becomes a viable target for the mass market...

Cas Smiley
Vulkan won't be supported by OpenGL 3 cards, so a fallback to catch the 15+% of people that only have a DX10 GPU is a good idea. Part of the goal with my code is to abstract away the graphics API used. Since everything will be handled with buffers in Vulkan, my abstractions will hopefully work pretty well for implementing a Vulkan back-end for our entire game. With automatic GLSL to SPIR-V conversion and an abstract Graphics class I should be able to switch between the two APIs without a single change noticeable for the user of my code.

Myomyomyo.
Pages: [1]
  ignore  |  Print  
 
 

 
EgonOlsen (1327 views)
2018-06-10 19:43:48

EgonOlsen (1203 views)
2018-06-10 19:43:44

EgonOlsen (928 views)
2018-06-10 19:43:20

DesertCoockie (1329 views)
2018-05-13 18:23:11

nelsongames (1109 views)
2018-04-24 18:15:36

nelsongames (1358 views)
2018-04-24 18:14:32

ivj94 (2092 views)
2018-03-24 14:47:39

ivj94 (1250 views)
2018-03-24 14:46:31

ivj94 (2249 views)
2018-03-24 14:43:53

Solater (802 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!