[Mesa-dev] [PATCH 01/17] mesa: consolidate definitions of max texture image units

Brian Paul brianp at vmware.com
Thu May 2 07:24:45 PDT 2013


On 05/01/2013 09:42 PM, Marek Olšák wrote:
> Shaders are unified on most hardware (= same limits in all stages).
> No idea what the assertion was good for.
> ---
>   src/mesa/main/config.h                 |    6 ++----
>   src/mesa/main/context.c                |    6 ++----
>   src/mesa/state_tracker/st_extensions.c |    2 +-
>   3 files changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
> index 33b5ab0..76863bf 100644
> --- a/src/mesa/main/config.h
> +++ b/src/mesa/main/config.h
> @@ -219,9 +219,8 @@
>   /** For GL_ARB_vertex_shader */
>   /*@{*/
>   #define MAX_VERTEX_GENERIC_ATTRIBS 16
> -#define MAX_VERTEX_TEXTURE_IMAGE_UNITS MAX_TEXTURE_IMAGE_UNITS
> -#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_VERTEX_TEXTURE_IMAGE_UNITS + \
> -					  MAX_TEXTURE_IMAGE_UNITS)
> +/* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */
> +#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_TEXTURE_IMAGE_UNITS * 6)
>   /*@}*/
>
>
> @@ -246,7 +245,6 @@
>
>   /** For GL_ARB_geometry_shader4 */
>   /*@{*/
> -#define MAX_GEOMETRY_TEXTURE_IMAGE_UNITS             8
>   #define MAX_GEOMETRY_VARYING_COMPONENTS              32
>   #define MAX_VERTEX_VARYING_COMPONENTS                32
>   #define MAX_GEOMETRY_UNIFORM_COMPONENTS              512
> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> index 2c05f6d..2cc8f36 100644
> --- a/src/mesa/main/context.c
> +++ b/src/mesa/main/context.c
> @@ -601,10 +601,10 @@ _mesa_init_constants(struct gl_context *ctx)
>      ctx->Const.MaxColorAttachments = MAX_COLOR_ATTACHMENTS;
>      ctx->Const.MaxRenderbufferSize = MAX_RENDERBUFFER_SIZE;
>
> -   ctx->Const.MaxVertexTextureImageUnits = MAX_VERTEX_TEXTURE_IMAGE_UNITS;
> +   ctx->Const.MaxVertexTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
>      ctx->Const.MaxCombinedTextureImageUnits = MAX_COMBINED_TEXTURE_IMAGE_UNITS;
>      ctx->Const.MaxVarying = 16; /* old limit not to break tnl and swrast */
> -   ctx->Const.MaxGeometryTextureImageUnits = MAX_GEOMETRY_TEXTURE_IMAGE_UNITS;
> +   ctx->Const.MaxGeometryTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
>      ctx->Const.MaxVertexVaryingComponents = MAX_VERTEX_VARYING_COMPONENTS;
>      ctx->Const.MaxGeometryVaryingComponents = MAX_GEOMETRY_VARYING_COMPONENTS;
>      ctx->Const.MaxGeometryOutputVertices = MAX_GEOMETRY_OUTPUT_VERTICES;
> @@ -676,8 +676,6 @@ check_context_limits(struct gl_context *ctx)
>      assert(VARYING_SLOT_MAX<=
>   	  (8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead)));
>
> -   assert(MAX_COMBINED_TEXTURE_IMAGE_UNITS<= 8 * sizeof(GLbitfield));
> -
>      /* shader-related checks */
>      assert(ctx->Const.FragmentProgram.MaxLocalParams<= MAX_PROGRAM_LOCAL_PARAMS);
>      assert(ctx->Const.VertexProgram.MaxLocalParams<= MAX_PROGRAM_LOCAL_PARAMS);
> diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
> index 662645b..a72728c 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -98,7 +98,7 @@ void st_init_limits(struct st_context *st)
>      c->MaxVertexTextureImageUnits
>         = _min(screen->get_shader_param(screen, PIPE_SHADER_VERTEX,
>                                         PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS),
> -             MAX_VERTEX_TEXTURE_IMAGE_UNITS);
> +             MAX_TEXTURE_IMAGE_UNITS);
>
>      c->MaxCombinedTextureImageUnits
>         = _min(screen->get_param(screen, PIPE_CAP_MAX_COMBINED_SAMPLERS),

Nice improvements!

For the series: Reviewed-by: Brian Paul <brianp at vmware.com>



More information about the mesa-dev mailing list