From: Iago Toral Quiroga Date: Wed, 30 Sep 2015 08:24:11 +0000 (+0200) Subject: i965: Assert on the number of combined UBO and SSBO binding table entries X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=102f6c446b6585b00e1c1cd3c838f7b0899e49a9;p=mesa.git i965: Assert on the number of combined UBO and SSBO binding table entries 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 --- diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 8efecf98218..546f8fc35fe 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -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 diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp index a16e5958776..7bc080b082e 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.cpp +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp @@ -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 {