[Mesa-dev] [PATCH] compiler: Check if check_explicit_uniform_locations has failed.

Eduardo Lima Mitev elima at igalia.com
Fri Mar 18 16:06:26 UTC 2016


On 03/18/2016 04:41 PM, Plamena Manolova wrote:
> We should check whether check_explicit_uniform_locations has
> failed before we pass the number of explicit uniform locations
> to link_assign_uniform_locations.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94549#c3
> ---
>   src/compiler/glsl/linker.cpp | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
> index 76b700d..a2091f4 100644
> --- a/src/compiler/glsl/linker.cpp
> +++ b/src/compiler/glsl/linker.cpp
> @@ -4324,6 +4324,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
>         goto done;
>
>      unsigned first, last, prev;
> +   int result;
>
>      first = MESA_SHADER_STAGES;
>      last = 0;
> @@ -4337,7 +4338,11 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
>         last = i;
>      }
>
> -   num_explicit_uniform_locs = check_explicit_uniform_locations(ctx, prog);
> +   result = check_explicit_uniform_locations(ctx, prog);
> +

Some nitpicks:

I would remove the space between assigning result, and the 'if' below.

> +   if (result > 0)
> +       num_explicit_uniform_locs = result;
> +
>      link_assign_subroutine_types(prog);
>
>      if (!prog->LinkStatus)
>

What about renaming 'result' to something like 'tmp_num_locs' or 
'local_num_locs'. Naming it 'result' is a bit deceiving, since it is not 
a result but rather an intermediate value.

thanks!

Reviewed-by: Eduardo Lima Mitev <elima at igalia.com>



More information about the mesa-dev mailing list