[Mesa-dev] [Mesa-stable] [PATCH v2] glsl: fix names in lower_constant_arrays_to_uniforms

Ian Romanick idr at freedesktop.org
Mon Mar 23 10:41:34 PDT 2015


On 03/23/2015 12:12 AM, Tapani Pälli wrote:
> Patch changes lowering pass to use unique name for each uniform
> so that arrays from different stages cannot end up having same
> name.
> 
> v2: instead of global counter, use pointer to achieve
>     unique name (Kenneth Graunke)
> 
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89590
> Cc: 10.5 10.4 <mesa-stable at lists.freedesktop.org>

With the configure.ac change removed, this patch is

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

Also, converting the test from the bug to piglit would be good.

> ---
>  configure.ac                                | 2 +-
>  src/glsl/lower_const_arrays_to_uniforms.cpp | 4 +---
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 08378f5..19d4c06 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -68,7 +68,7 @@ AC_SUBST([OSMESA_VERSION])
>  dnl Versions for external dependencies
>  LIBDRM_REQUIRED=2.4.38
>  LIBDRM_RADEON_REQUIRED=2.4.56
> -LIBDRM_INTEL_REQUIRED=2.4.60
> +LIBDRM_INTEL_REQUIRED=2.4.59
>  LIBDRM_NVVIEUX_REQUIRED=2.4.33
>  LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41"
>  LIBDRM_FREEDRENO_REQUIRED=2.4.57
> diff --git a/src/glsl/lower_const_arrays_to_uniforms.cpp b/src/glsl/lower_const_arrays_to_uniforms.cpp
> index 2243f47..44967dc 100644
> --- a/src/glsl/lower_const_arrays_to_uniforms.cpp
> +++ b/src/glsl/lower_const_arrays_to_uniforms.cpp
> @@ -49,7 +49,6 @@ public:
>     {
>        instructions = insts;
>        progress = false;
> -      index = 0;
>     }
>  
>     bool run()
> @@ -63,7 +62,6 @@ public:
>  private:
>     exec_list *instructions;
>     bool progress;
> -   unsigned index;
>  };
>  
>  void
> @@ -82,7 +80,7 @@ lower_const_array_visitor::handle_rvalue(ir_rvalue **rvalue)
>  
>     void *mem_ctx = ralloc_parent(con);
>  
> -   char *uniform_name = ralloc_asprintf(mem_ctx, "constarray__%d", index++);
> +   char *uniform_name = ralloc_asprintf(mem_ctx, "constarray__%p", dra);
>  
>     ir_variable *uni =
>        new(mem_ctx) ir_variable(con->type, uniform_name, ir_var_uniform);
> 



More information about the mesa-dev mailing list