summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-05-23 11:10:15 -0700
committerEric Anholt <[email protected]>2013-06-06 14:37:41 -0700
commit38e77e545d06bf5ac0e185f2a1581a97bafdab56 (patch)
treea907d7de6f8cc8080539f21f90e04464089e5784 /src/mesa/main
parent93c8692ce92d396f0a4db5bc91d8e7322fa7dd50 (diff)
glsl: Fix uniform buffer object counting.
We were counting uniforms located in UBOs against the default uniform block limit, while not doing any counting against the specific combined limit. Note that I couldn't quite find justification for the way I did this, but I think it's the only sensible thing: The spec talks about components, so each "float" in a std140 block would count as 1 component and a "vec4" would count as 4, though they occupy the same amount of space. Since GPU limits on uniform buffer loads are surely going to be about the size of the blocks, I just counted them that way. Fixes link failures in piglit arb_uniform_buffer_object/maxuniformblocksize when ported to geometry shaders on Paul's GS branch, since in that case the max block size is bigger than the default uniform block component limit. Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/mtypes.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index aae2876fb93..92a70f416d3 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2140,13 +2140,21 @@ struct gl_shader
gl_texture_index SamplerTargets[MAX_SAMPLERS];
/**
- * Number of uniform components used by this shader.
+ * Number of default uniform block components used by this shader.
*
* This field is only set post-linking.
*/
unsigned num_uniform_components;
/**
+ * Number of combined uniform components used by this shader.
+ *
+ * This field is only set post-linking. It is the sum of the uniform block
+ * sizes divided by sizeof(float), and num_uniform_compoennts.
+ */
+ unsigned num_combined_uniform_components;
+
+ /**
* This shader's uniform block information.
*
* The offsets of the variables are assigned only for shaders in a program's