Bug 89330

Summary: piglit glsl-1.50 invariant-qualifier-in-out-block-01 regression
Product: Mesa Reporter: Vinson Lee <vlee>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium CC: huax.lu, idr, mattst88, siglesias
Version: 10.6Keywords: bisected, regression
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Vinson Lee 2015-02-26 02:35:39 UTC
mesa: 1a93e7690dc90211164082d6a2d26d93da8127ef (master 10.6.0-devel)

$ ./bin/glslparsertest tests/spec/glsl-1.50/compiler/invariant-qualifier-in-out-block-01.vert pass 1.50
Failed to compile vertex shader tests/spec/glsl-1.50/compiler/invariant-qualifier-in-out-block-01.vert: 0:10(1): error: invariant qualifiers cannot be used with interface blocks members

Shader source:
// [config]
// expect_result: pass
// glsl_version: 1.50
// [end config]
//
// Tests that the invariant qualifier can be applied to a member of an out block.

#version 150

out block {
    invariant vec4 x;
};

void main()
{
}

PIGLIT: {"result": "fail" }



fe1e89a026fb85cc7dffbd3f967687186796631e is the first bad commit
commit fe1e89a026fb85cc7dffbd3f967687186796631e
Author: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Date:   Tue Nov 25 14:03:05 2014 +0100

    glsl: don't allow invariant qualifiers for interface blocks
    
    GLSL 1.50 and GLSL 4.40 specs, they both say the same in
    "Interface Blocks" section:
    
    "If optional qualifiers are used, they can include interpolation qualifiers,
    auxiliary storage qualifiers, and storage qualifiers and they must declare
    an input, output, or uniform member consistent with the interface qualifier
    of the 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 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
    
    No piglit regressions.
    
    Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
    
    v2:
    
    - Enable this check for GLSL.
    
    Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
    Reviewed-by: Matt Turner <mattst88@gmail.com>
    Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>

:040000 040000 0cee593d241827bd1c6d887230a9c0a80469d1d4 60a36c9d9729caa6272b959d003de9124e1509e3 M	src
bisect run success
Comment 1 Samuel Iglesias Gonsálvez 2015-02-26 07:04:28 UTC
We submitted a spec bug because it's not completely clear whether or not invariant should be allowed in an 'in' or 'out' block in GLSL or  OES_shader_io_blocks extension specs. Once we have the answer, we will reply to this bug report.

Thanks!
Comment 2 lu hua 2015-03-02 06:13:40 UTC
I also see this fail.
Comment 3 Ian Romanick 2016-02-10 22:33:19 UTC
Feedback from Khronos is that invariant should be allowed on block members.  In this case "global scope" meant "not in a function and not in a structure."  Future spec versions will clarify the use of "global scope" here and elsewhere.
Comment 4 Samuel Iglesias Gonsálvez 2016-02-11 07:33:07 UTC
(In reply to Ian Romanick from comment #3)
> Feedback from Khronos is that invariant should be allowed on block members. 
> In this case "global scope" meant "not in a function and not in a
> structure."  Future spec versions will clarify the use of "global scope"
> here and elsewhere.

Thanks for the feedback.

I sent a patch to the mailing list:

https://lists.freedesktop.org/archives/mesa-dev/2016-February/107263.html
Comment 5 Timothy Arceri 2016-02-12 08:51:38 UTC
Should be fixed by:

commit	61ceb36ead2e88cce4b4bac63793e94d343a3cc4

glsl: Allow invariant qualifer in block members in desktop OpenGL.
Feedback from Khronos is that 'invariant' should be allowed on block
members for desktop OpenGL. Fix piglit regression added by fe1e89a0:
invariant-qualifier-in-out-block-01.vert

v2:
- Allow it for in/out blocks in OpenGL ES too, so when OES_shader_io_blocks
is supported we don't need to do any change (Timothy)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89330
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.