[Mesa-dev] [PATCH 1/4] i965: Define BRW_MAX_UBO

Iago Toral Quiroga itoral at igalia.com
Wed Sep 30 03:06:39 PDT 2015


Instead of using hard-coded values.
---
 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 4d49929..8fcba69 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 8b790fe..846ece7 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -730,6 +730,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
 
@@ -766,7 +769,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 */       \
-- 
1.9.1



More information about the mesa-dev mailing list