i965: Assert on the number of combined UBO and SSBO binding table entries
authorIago Toral Quiroga <itoral@igalia.com>
Wed, 30 Sep 2015 08:24:11 +0000 (10:24 +0200)
committerIago Toral Quiroga <itoral@igalia.com>
Mon, 5 Oct 2015 06:19:34 +0000 (08:19 +0200)
In theory we can't break this assertion since the compiler frontend checks
that we don't exceed any of the individual limits, but it does not hurt to
be extra safe.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_shader.cpp

index 8efecf982185a57d7b734b4e3dfd114cd07ed7f2..546f8fc35fe830628bbcf181641b1afe5bc6d811 100644 (file)
@@ -714,6 +714,9 @@ struct brw_vs_prog_data {
 /** Max number of SSBOs in a shader */
 #define BRW_MAX_SSBO 12
 
+/** Max number of combined UBOs and SSBOs in a shader */
+#define BRW_MAX_COMBINED_UBO_SSBO (BRW_MAX_UBO + BRW_MAX_SSBO)
+
 /** Max number of atomic counter buffer objects in a shader */
 #define BRW_MAX_ABO 16
 
index a16e59587768ec0d49ed148e53243b037672c880..7bc080b082e30cfdd6501a023028b3b6df8a1a72 100644 (file)
@@ -1366,6 +1366,7 @@ brw_assign_common_binding_table_offsets(gl_shader_stage stage,
    next_binding_table_offset += num_textures;
 
    if (shader) {
+      assert(shader->NumUniformBlocks <= BRW_MAX_COMBINED_UBO_SSBO);
       stage_prog_data->binding_table.ubo_start = next_binding_table_offset;
       next_binding_table_offset += shader->NumUniformBlocks;
    } else {