[Mesa-dev] [PATCH 07/10] glsl: don't allow invariant qualifiers for interface blocks in GLSL ES

Ian Romanick idr at freedesktop.org
Tue Dec 2 12:57:24 PST 2014


On 12/01/2014 05:04 AM, Eduardo Lima Mitev wrote:
> From: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
> 
> From GLSL ES 3.0, chapter 4.3.7 "Interface Blocks", page 38:
> 
> "GLSL ES 3.0 does not support interface blocks for shader inputs or outputs."
> 
> and from GLSL ES 3.0, chapter 4.6.1 "The invariant qualifier", page 52.
> 
> "Only variables output from a shader can be candidates for invariance. This
> includes user-defined output variables and the built-in output variables. As
> only outputs can be declared as invariant, an invariant output from one shader
> stage will still match an input of a subsequent stage without the input being
> declared as invariant."
> 
> From GLSL ES 1.0, chapter 4.6.1 "The invariant qualifier", page 37.
> 
> "Only the following variables may be declared as invariant:
> * Built-in special variables output from the vertex shader
> * Varying variables output from the vertex shader
> * Built-in special variables input to the fragment shader
> * Varying variables input to the fragment shader
> * Built-in special variables output from the fragment shader."
> 
> This patch fixes the following dEQP tests:
> 
> dEQP-GLES3.functional.shaders.declarations.invalid_declarations.invariant_uniform_block_2_vertex
> dEQP-GLES3.functional.shaders.declarations.invalid_declarations.invariant_uniform_block_2_fragment

I'm pretty sure you can't have an invariant uniform block in desktop
OpenGL either.  Should this change also apply universally to desktop OpenGL?

> No piglit regressions.
> 
> Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
> ---
>  src/glsl/glsl_parser.yy | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
> index 55b3a7d..489d3af 100644
> --- a/src/glsl/glsl_parser.yy
> +++ b/src/glsl/glsl_parser.yy
> @@ -2519,6 +2519,31 @@ basic_interface_block:
>                               "interface block member does not match "
>                               "the interface block");
>           }
> +         /* From GLSL ES 3.0, chapter 4.3.7 "Interface Blocks", page 38:
> +          *
> +          * "GLSL ES 3.0 does not support interface blocks for shader inputs or
> +          * outputs."
> +          *
> +          * And from GLSL ES 3.0, chapter 4.6.1 "The invariant qualifier", page 52.
> +          *
> +          * "Only variables output from a shader can be candidates for
> +          * invariance. This includes user-defined output variables and the
> +          * built-in output variables. As only outputs can be declared as
> +          * invariant, an invariant output from one shader stage will
> +          * still match an input of a subsequent stage without the input being
> +          * declared as invariant."
> +          *
> +          * From GLSL ES 1.0, chapter 4.6.1 "The invariant qualifier", page 37.
> +          *
> +          * "Only the following variables may be declared as invariant:
> +          *  * Built-in special variables output from the vertex shader
> +          *  * Varying variables output from the vertex shader
> +          *  * Built-in special variables input to the fragment shader
> +          *  * Varying variables input to the fragment shader
> +          *  * Built-in special variables output from the fragment shader."
> +          */
> +         if (state->es_shader && qualifier.flags.q.invariant)
> +            _mesa_glsl_error(&@1, state, "invariant qualifiers cannot be used with interface blocks in GLSL ES");
>        }
>  
>        $$ = block;
> 



More information about the mesa-dev mailing list