From 440f9348c1fb877910cebca5413c4300b6738428 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Wed, 30 Sep 2015 09:55:00 +0200 Subject: [PATCH] i965: Define BRW_MAX_UBO Instead of using hard-coded values. Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_context.c | 4 ++-- src/mesa/drivers/dri/i965/brw_context.h | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 4d499295730..8fcba696c8e 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -326,7 +326,7 @@ brw_initialize_context_constants(struct brw_context *brw) ctx->Const.MaxUniformBlockSize = 65536; for (int i = 0; i < MESA_SHADER_STAGES; i++) { struct gl_program_constants *prog = &ctx->Const.Program[i]; - prog->MaxUniformBlocks = 12; + prog->MaxUniformBlocks = BRW_MAX_UBO; prog->MaxCombinedUniformComponents = prog->MaxUniformComponents + ctx->Const.MaxUniformBlockSize / 4 * prog->MaxUniformBlocks; @@ -346,7 +346,7 @@ brw_initialize_context_constants(struct brw_context *brw) ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits = 0; if (_mesa_extension_override_enables.ARB_compute_shader) { ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits = BRW_MAX_TEX_UNIT; - ctx->Const.MaxUniformBufferBindings += 12; + ctx->Const.MaxUniformBufferBindings += BRW_MAX_UBO; } else { ctx->Const.Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits = 0; } diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 19a511710da..8fe88d2c85f 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -708,6 +708,9 @@ struct brw_vs_prog_data { /** Max number of render targets in a shader */ #define BRW_MAX_DRAW_BUFFERS 8 +/** Max number of UBOs in a shader */ +#define BRW_MAX_UBO 12 + /** Max number of atomic counter buffer objects in a shader */ #define BRW_MAX_ABO 16 @@ -744,7 +747,7 @@ struct brw_vs_prog_data { #define BRW_MAX_SURFACES (BRW_MAX_DRAW_BUFFERS + \ BRW_MAX_TEX_UNIT * 2 + /* normal, gather */ \ - 12 + /* ubo */ \ + BRW_MAX_UBO + \ BRW_MAX_ABO + \ BRW_MAX_IMAGES + \ 2 + /* shader time, pull constants */ \ -- 2.30.2