PDA

View Full Version : Uniform blocks and offsets



wizardbox
07-01-2015, 07:58 PM
Question: when querying a uniforms in a block (shared layout), is the offset of each uniform always in the order they are declared in the shader, or is this not guaranteed?
Hope that makes sense. Been learning GL for a while, first time poster.

Alfonse Reinheart
07-02-2015, 05:45 AM
Question: when querying a uniforms in a block (shared layout), is the offset of each uniform always in the order they are declared in the shader, or is this not guaranteed?
Hope that makes sense. Been learning GL for a while, first time poster.

The `shared` layout guarantees nothing about the layout except that, if you define a uniform block with the same members in the same order (including their names), then the two blocks will have identical layouts. If you need a more consistent layout, use `std140`.