[Mesa-dev] [PATCH] glsl: fix explicit location validation for doubles

Anuj Phogat anuj.phogat at gmail.com
Mon May 23 21:58:48 UTC 2016


On Sun, May 22, 2016 at 8:11 PM, Timothy Arceri
<timothy.arceri at collabora.com> wrote:
> Previously we would fail to find a match for the second half of a
> dvec4 as 'i' would get incremented to 1 before we added the var to
> the array at component 0.
> ---
>  src/compiler/glsl/link_varyings.cpp | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
> index c442485..70b8d41 100644
> --- a/src/compiler/glsl/link_varyings.cpp
> +++ b/src/compiler/glsl/link_varyings.cpp
> @@ -392,7 +392,8 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
>           }
>
>           while (idx < slot_limit) {
> -            for (unsigned i = var->data.location_frac; i < last_comp; i++) {
> +            unsigned i = var->data.location_frac;
> +            while (i < last_comp) {
>                 if (explicit_locations[idx][i] != NULL) {
>                    linker_error(prog,
>                                 "%s shader has multiple outputs explicitly "
> @@ -418,6 +419,7 @@ cross_validate_outputs_to_inputs(struct gl_shader_program *prog,
>                 }
>
>                 explicit_locations[idx][i] = var;
> +               i++;
>
>                 /* We need to do some special handling for doubles as dvec3 and
>                  * dvec4 consume two consecutive locations. We don't need to
> --
> 2.5.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
nice catch.
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the mesa-dev mailing list