[Mesa-dev] [PATCH 06/10] glsl: invariant qualifier is not valid for shader inputs in GLSL ES 3.00

Ian Romanick idr at freedesktop.org
Tue Dec 2 12:56:03 PST 2014


On 12/02/2014 12:54 PM, Ian Romanick wrote:
> On 12/01/2014 05:04 AM, Eduardo Lima Mitev wrote:
>> From: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
>>
>> GLSL ES 3.00 spec, chapter 4.6.1 "The Invariant Qualifier",
>>
>>     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.
>>
>> This patch fixes the following dEQP tests:
>>
>> dEQP-GLES3.functional.shaders.qualification_order.variables.valid.invariant_interp_storage_precision
>> dEQP-GLES3.functional.shaders.qualification_order.variables.valid.invariant_interp_storage
>> dEQP-GLES3.functional.shaders.qualification_order.variables.valid.invariant_storage_precision
>> dEQP-GLES3.functional.shaders.qualification_order.variables.valid.invariant_storage
>> dEQP-GLES3.functional.shaders.qualification_order.variables.invalid.invariant_interp_storage_precision_invariant_input
>> dEQP-GLES3.functional.shaders.qualification_order.variables.invalid.invariant_interp_storage_invariant_input
>> dEQP-GLES3.functional.shaders.qualification_order.variables.invalid.invariant_storage_precision_invariant_input
>> dEQP-GLES3.functional.shaders.qualification_order.variables.invalid.invariant_storage_invariant_input
>>
>> No piglit regressions observed.
>>
>> Signed-off-by: Samuel Iglesias Gonsalvez <siglesias at igalia.com>
>> ---
>>  src/glsl/glsl_parser.yy    | 2 ++
>>  src/glsl/link_varyings.cpp | 2 +-
>>  2 files changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
>> index 6160e26..55b3a7d 100644
>> --- a/src/glsl/glsl_parser.yy
>> +++ b/src/glsl/glsl_parser.yy
>> @@ -1591,6 +1591,8 @@ type_qualifier:
>>  
>>        $$ = $2;
>>        $$.flags.q.invariant = 1;
>> +      if (state->es_shader && state->language_version >= 300 && $$.flags.q.in)
>> +         _mesa_glsl_error(&@1, state, "invariant qualifiers cannot be used with shader inputs");
> 
> Since we already reject the invariant keyword for GLSL ES 1.00, I think
> you can drop the '&& state->language_version >= 300' part.

Ignore this part.  invariant is a keyword in GLSL ES 1.00.

> I would also
> add the spec quotation from the commit message here.
> 
> With those changes, this patch is
> 
> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
> 
>>     }
>>     | interpolation_qualifier type_qualifier
>>     {
>> diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
>> index 1866ab2..1fe198a 100644
>> --- a/src/glsl/link_varyings.cpp
>> +++ b/src/glsl/link_varyings.cpp
>> @@ -116,7 +116,7 @@ cross_validate_types_and_qualifiers(struct gl_shader_program *prog,
>>        return;
>>     }
>>  
>> -   if (input->data.invariant != output->data.invariant) {
>> +   if (!prog->IsES && input->data.invariant != output->data.invariant) {
>>        linker_error(prog,
>>                     "%s shader output `%s' %s invariant qualifier, "
>>                     "but %s shader input %s invariant qualifier\n",
>>
> 



More information about the mesa-dev mailing list