From bfe42ddd99e8702e2daf14238966069fd25b6d0e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tapani=20P=C3=A4lli?= Date: Mon, 5 May 2014 07:55:34 +0300 Subject: [PATCH] mesa: add new enum MAX_UNIFORM_LOCATIONS MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Patch adds new implementation dependent value required by the GL_ARB_explicit_uniform_location extension. Default value for user assignable locations is calculated as sum of MaxUniformComponents for each stage. v2: fix descriptor in get_hash_params.py (Petri) v3: simpler formula for calculating initial value (Ian) Signed-off-by: Tapani Pälli Reviewed-by: Ian Romanick --- src/mesa/main/context.c | 4 ++++ src/mesa/main/get.c | 1 + src/mesa/main/get_hash_params.py | 1 + src/mesa/main/mtypes.h | 5 +++++ src/mesa/main/tests/enum_strings.cpp | 1 + 5 files changed, 12 insertions(+) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 8eb426d..f350788 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -610,6 +610,10 @@ _mesa_init_constants(struct gl_context *ctx) ctx->Const.MaxUniformBlockSize = 16384; ctx->Const.UniformBufferOffsetAlignment = 1; + /* GL_ARB_explicit_uniform_location, GL_MAX_UNIFORM_LOCATIONS */ + ctx->Const.MaxUserAssignableUniformLocations = + 4 * MESA_SHADER_STAGES * MAX_UNIFORMS; + for (i = 0; i < MESA_SHADER_STAGES; i++) init_program_limits(ctx, i, &ctx->Const.Program[i]); diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 9b56edb..183a13b 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -395,6 +395,7 @@ EXTRA_EXT(ARB_compute_shader); EXTRA_EXT(ARB_gpu_shader5); EXTRA_EXT2(ARB_transform_feedback3, ARB_gpu_shader5); EXTRA_EXT(INTEL_performance_query); +EXTRA_EXT(ARB_explicit_uniform_location); static const int extra_ARB_color_buffer_float_or_glcore[] = { diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index 87d96b2..d45962d 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -480,6 +480,7 @@ descriptor=[ [ "MAX_LIST_NESTING", "CONST(MAX_LIST_NESTING), NO_EXTRA" ], [ "MAX_NAME_STACK_DEPTH", "CONST(MAX_NAME_STACK_DEPTH), NO_EXTRA" ], [ "MAX_PIXEL_MAP_TABLE", "CONST(MAX_PIXEL_MAP_TABLE), NO_EXTRA" ], + [ "MAX_UNIFORM_LOCATIONS", "CONTEXT_INT(Const.MaxUserAssignableUniformLocations), extra_ARB_explicit_uniform_location" ], [ "NAME_STACK_DEPTH", "CONTEXT_INT(Select.NameStackDepth), NO_EXTRA" ], [ "PACK_LSB_FIRST", "CONTEXT_BOOL(Pack.LsbFirst), NO_EXTRA" ], [ "PACK_SWAP_BYTES", "CONTEXT_BOOL(Pack.SwapBytes), NO_EXTRA" ], diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 6d51f19..8b7ee30 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3323,6 +3323,11 @@ struct gl_constants GLuint UniformBufferOffsetAlignment; /** @} */ + /** + * GL_ARB_explicit_uniform_location + */ + GLuint MaxUserAssignableUniformLocations; + /** GL_ARB_geometry_shader4 */ GLuint MaxGeometryOutputVertices; GLuint MaxGeometryTotalOutputComponents; diff --git a/src/mesa/main/tests/enum_strings.cpp b/src/mesa/main/tests/enum_strings.cpp index 66ff4ec..2913668 100644 --- a/src/mesa/main/tests/enum_strings.cpp +++ b/src/mesa/main/tests/enum_strings.cpp @@ -787,6 +787,7 @@ const struct enum_info everything[] = { { 0x8256, "GL_RESET_NOTIFICATION_STRATEGY_ARB" }, { 0x8257, "GL_PROGRAM_BINARY_RETRIEVABLE_HINT" }, { 0x8261, "GL_NO_RESET_NOTIFICATION_ARB" }, + { 0x826E, "GL_MAX_UNIFORM_LOCATIONS" }, { 0x82DF, "GL_TEXTURE_IMMUTABLE_LEVELS" }, { 0x8362, "GL_UNSIGNED_BYTE_2_3_3_REV" }, { 0x8363, "GL_UNSIGNED_SHORT_5_6_5" }, -- 2.7.4