Login  Register

Re: Uniform Buffers mapping and size

Posted by jmaasing on Jun 14, 2013; 5:12am
URL: https://forum.jogamp.org/Uniform-Buffers-mapping-and-size-tp4029403p4029414.html

Sven Gothel wrote
it seems that the ideal way would be to have all alignments
and offset being fetched from the GPU and used to configure the generated struct's
offset/alignment table ?

Just a little brainstorming .. haven't read this in detail yet.
But probably better than forcing the GPU to adapt to the CPU's
alignment/offset .. if that is even possible.

~Sven
As far as I can tell that's what std140 layout sort of does. It mandates to the GPU how to layout the alignments and offsets so you can know before hand. But then again, querying should be a one time operation as long as the struct doesn't change - I hope at least.
Either way should be possibly if you like @zzuegg generate the shader code based on reflection.  I can see how this would be a really good utility to have, I hope @zzuegg will share the findings :-)