[Mesa-dev] [PATCH 1/5] mesa: add new enum MAX_UNIFORM_LOCATIONS

Ian Romanick idr at freedesktop.org
Wed Jun 4 18:13:55 PDT 2014


On 05/26/2014 01:32 AM, Tapani Pälli wrote:
> 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 <tapani.palli at intel.com>
> ---
>  src/mesa/main/context.c              | 3 +++
>  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, 11 insertions(+)
> 
> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> index 8eb426d..458cbc4 100644
> --- a/src/mesa/main/context.c
> +++ b/src/mesa/main/context.c
> @@ -610,6 +610,9 @@ _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 * 4 * MAX_UNIFORMS;

Change one of the 4s to MESA_SHADER_STAGES and

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

> +
>     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 80a5839..f0e9b7b 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 d40fa07..9ac372e 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 9ca76bc..85fa785 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -3319,6 +3319,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 d16eb36..5291a38 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" },
> 



More information about the mesa-dev mailing list