Hi Juan,

I filed a bug about a test that was regressed by this patch:

https://bugs.freedesktop.org/show_bug.cgi?id=104668

-Mark

"Juan A. Suarez Romero" <[email protected]> writes:

> According with OpenGL GLSL 4.20 spec, section 4.3.9, page 57:
>
>    "It is a link-time error if any particular shader interface
>     contains:
>       - two different blocks, each having no instance name, and each
>         having a member of the same name, or
>       - a variable outside a block, and a block with no instance name,
>         where the variable has the same name as a member in the block."
>
> This means that it is a link error if for example we have a vertex
> shader with the following definition.
>
>   "layout(location=0) uniform Data { float a; float b; };"
>
> and a fragment shader with:
>
>   "uniform float a;"
>
> As in both cases we refer to both uniforms as "a", and thus using
> glGetUniformLocation() wouldn't know which one we mean.
> ---
>  src/compiler/glsl/linker.cpp | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
>
> diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
> index 33fd76deae9..b6de7b54ae3 100644
> --- a/src/compiler/glsl/linker.cpp
> +++ b/src/compiler/glsl/linker.cpp
> @@ -1111,6 +1111,29 @@ cross_validate_globals(struct gl_shader_program *prog,
>              return;
>           }
>  
> +         /* In OpenGL GLSL 4.20 spec, section 4.3.9, page 57:
> +          *
> +          *   "It is a link-time error if any particular shader interface
> +          *    contains:
> +          *
> +          *    - two different blocks, each having no instance name, and each
> +          *      having a member of the same name, or
> +          *
> +          *    - a variable outside a block, and a block with no instance 
> name,
> +          *      where the variable has the same name as a member in the 
> block."
> +          */
> +         if (var->data.mode == existing->data.mode &&
> +             var->get_interface_type() != existing->get_interface_type()) {
> +            linker_error(prog, "declarations for %s `%s` are in "
> +                         "%s and %s\n",
> +                         mode_string(var), var->name,
> +                         existing->get_interface_type() ?
> +                           existing->get_interface_type()->name : "outside a 
> block",
> +                         var->get_interface_type() ?
> +                           var->get_interface_type()->name : "outside a 
> block");
> +
> +            return;
> +         }
>           /* Only in GLSL ES 3.10, the precision qualifier should not match
>            * between block members defined in matched block names within a
>            * shader interface.
> -- 
> 2.15.1
>
> _______________________________________________
> mesa-dev mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to