[Mesa-dev] [PATCH] glsl: fix arrays of anonymous structs matching.

Ilia Mirkin imirkin at alum.mit.edu
Sun May 22 19:38:17 UTC 2016


Won't this try to match

struct { vec4 foo; } bar[6];

with

struct { vec4 foo; } bar[6][6];

Or is that taken care of elsewhere? Also, it might be nice to not do
output->type->without_array() twice.

On Sun, May 22, 2016 at 3:30 PM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> "glsl/linker: attempt to match anonymous structures at link"
> introduced a fix for matching anon structs, however it didn't
> handle arrays of anon structs.
>
> This adds the appropriate without_array() calls, and fixes
> some crashes in the CTS tessellation tests.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/compiler/glsl/link_varyings.cpp | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
> index 708e1d1..82b3a74 100644
> --- a/src/compiler/glsl/link_varyings.cpp
> +++ b/src/compiler/glsl/link_varyings.cpp
> @@ -226,9 +226,9 @@ cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
>         *     fragment language."
>         */
>        if (!output->type->is_array() || !is_gl_identifier(output->name)) {
> -         bool anon_matches = output->type->is_anonymous() &&
> +         bool anon_matches = output->type->without_array()->is_anonymous() &&
>              type_to_match->is_anonymous() &&
> -            type_to_match->record_compare(output->type);
> +            type_to_match->record_compare(output->type->without_array());
>
>           if (!anon_matches) {
>              linker_error(prog,
> --
> 2.5.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list