gxquickly / angleproject

Automatically exported from code.google.com/p/angleproject
Other
0 stars 0 forks source link

Add support for ESSL3 invariant declarations #987

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Try to compile the following shader:
#version 300 es

invariant out float a;

void main() {
    a = 0.0;
    gl_Position = vec4(0.0);
};

What is the expected output? What do you see instead?
Expected: Compilation succeeds
Actual: Compilation fails

The parser needs support for additional syntax under type_qualifier, and the 
AST needs to store types that have both out and invariant qualifiers.

Original issue reported on code.google.com by oetu...@nvidia.com on 28 Apr 2015 at 8:19

GoogleCodeExporter commented 9 years ago
There's one tricky GLSL backend specific issue here when shaders are linked:
-ESSL3.00 doesn't allow shader inputs to be declared as invariant.
-GLSL4.20 and earlier versions require shader inputs to be declared as 
invariant to be successfully linked against invariant outputs.

This means that the GLSL fragment shader source needs to be generated at link 
time to take into account whether the vertex shader outputs linked against it 
are declared as invariant.

Original comment by oetu...@nvidia.com on 28 Apr 2015 at 12:01

GoogleCodeExporter commented 9 years ago
It seems like ESSL3 also contradicts itself on this issue:

-Section 4.6.1 (that the previous comment was based on) says that "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."

-Section 4.3.9 says that "The type and presence of the interpolation qualifiers 
and storage qualifiers and invariant qualifiers of variables with the same name 
declared in all linked shaders must match, otherwise the link command will 
fail."

Section 4.6.1 was most recently changed in version 3.00.3 of the spec with 
discussion on the Khronos bug tracker, so it's probably safe to assume that it 
is correct and section 4.3.9 is wrong, being a remnant of an earlier version of 
the spec. The Khronos bug has been reopened to get this eventually cleaned up 
for good.

Original comment by oetu...@nvidia.com on 28 Apr 2015 at 2:03

GoogleCodeExporter commented 9 years ago
Added Ken to this issue - as it may require adding the ability to query the 
shader version from the translator, and adding a new API for linking shaders 
and generating extra code (and knowing when we translate a shader if we need 
the extra step).

Original comment by jmad...@chromium.org on 28 Apr 2015 at 6:59

GoogleCodeExporter commented 9 years ago
Project: angle/angle
Branch : master
Author : Olli Etuaho <oetuaho@nvidia.com>
Commit : 214c2d8e4dd65662e1f6c5821065716e13e82cd6

Code-Review  0 : Jamie Madill, Zhenyao Mo
Code-Review  +2: Olli Etuaho
Verified     0 : Jamie Madill, Zhenyao Mo
Verified     +1: Olli Etuaho
Commit Queue   : Chumped
Change-Id      : I0c6629e5ca2ded06db9ac9e5bab2fb6480299a5a
Reviewed-at    : https://chromium-review.googlesource.com/267662

Separate invariance from qualifiers

ESSL3 makes it possible to combine invariant with several more different
qualifiers. To avoid combinatorial explosion of the qualifier enum, track
invariance with a separate boolean.

TEST=WebGL conformance tests, angle_unittests
BUG=angleproject:987

src/compiler/translator/BaseTypes.h
src/compiler/translator/IntermNode.h
src/compiler/translator/OutputGLSLBase.cpp
src/compiler/translator/ParseContext.cpp
src/compiler/translator/ParseContext.h
src/compiler/translator/Types.cpp
src/compiler/translator/Types.h
src/compiler/translator/UtilsHLSL.cpp
src/compiler/translator/VersionGLSL.cpp
src/compiler/translator/glslang.y
src/compiler/translator/glslang_tab.cpp
src/compiler/translator/intermOut.cpp
src/compiler/translator/util.cpp

Original comment by bugdroid1@chromium.org on 5 May 2015 at 11:06

GoogleCodeExporter commented 9 years ago
Project: angle/angle
Branch : master
Author : Olli Etuaho <oetuaho@nvidia.com>
Commit : 4008879357159c7850cf105f2ae842bc68dd3c18

Code-Review  0 : Geoff Lang, Jamie Madill, Zhenyao Mo
Code-Review  +2: Olli Etuaho
Verified     0 : Geoff Lang, Jamie Madill, Zhenyao Mo
Verified     +1: Olli Etuaho
Commit Queue   : Chumped
Change-Id      : I3982feff7380c4dfc647940ee03a020692dd0c59
Reviewed-at    : https://chromium-review.googlesource.com/267663

Add support for parsing ESSL3 invariant qualifiers

The parser recognizes ESSL3 invariant variable declaration syntax and
marks the variables as invariant.

In ESSL3, invariant out variables can be linked to non-invariant
in variables, so linking checks should now be different depending on
shading language version. The varying matching check in the translator
API is changed to be shading language version dependent to facilitate
this.

Tested by deqp/data/gles3/shaders/qualification_order.html after patching
Chrome to use the new linking check API.

TEST=WebGL 2 conformance tests, angle_unittests
BUG=angleproject:987

include/GLSLANG/ShaderLang.h
include/GLSLANG/ShaderVars.h
src/compiler/translator/ParseContext.cpp
src/compiler/translator/ParseContext.h
src/compiler/translator/ShaderVars.cpp
src/compiler/translator/glslang.y
src/compiler/translator/glslang_tab.cpp
src/compiler/translator/util.cpp
src/tests/compiler_tests/ShaderVariable_test.cpp

Original comment by bugdroid1@chromium.org on 7 May 2015 at 1:38

GoogleCodeExporter commented 9 years ago
Project: angle/angle
Branch : master
Author : Jamie Madill <jmadill@chromium.org>
Commit : 9e64edce11b7648aeb3d240d2f7fd13fc803121e

Code-Review  0 : Olli Etuaho, Zhenyao Mo
Code-Review  +2: Jamie Madill
Verified     0 : Olli Etuaho, Zhenyao Mo
Verified     +1: Jamie Madill
Commit Queue   : Chumped
Change-Id      : Ia88ad302c403c65516c050eb7741316b5097bcfb
Reviewed-at    : https://chromium-review.googlesource.com/269847

Revert "Add support for parsing ESSL3 invariant qualifiers"

Build breaks in GPU FYI bots.

BUG=angleproject:987

This reverts commit 4008879357159c7850cf105f2ae842bc68dd3c18.

include/GLSLANG/ShaderLang.h
include/GLSLANG/ShaderVars.h
src/compiler/translator/ParseContext.cpp
src/compiler/translator/ParseContext.h
src/compiler/translator/ShaderVars.cpp
src/compiler/translator/glslang.y
src/compiler/translator/glslang_tab.cpp
src/compiler/translator/util.cpp
src/tests/compiler_tests/ShaderVariable_test.cpp

Original comment by bugdroid1@chromium.org on 7 May 2015 at 2:09

GoogleCodeExporter commented 9 years ago
Project: angle/angle
Branch : master
Author : Olli Etuaho <oetuaho@nvidia.com>
Commit : 37ad4744bbe70ab3956552447e658346e85be26e

Code-Review  0 : Geoff Lang, Olli Etuaho, Zhenyao Mo
Code-Review  +2: Jamie Madill
Verified     0 : Geoff Lang, Jamie Madill, Zhenyao Mo
Verified     +1: Olli Etuaho
Commit Queue   : Chumped
Change-Id      : Iecb64e3afd23e267ba999bc17f44390affcdfc13
Reviewed-at    : https://chromium-review.googlesource.com/269940

Add support for parsing ESSL3 invariant qualifiers

The parser recognizes ESSL3 invariant variable declaration syntax and
marks the variables as invariant.

In ESSL3, invariant out variables can be linked to non-invariant
in variables, so linking checks should now be different depending on
shading language version. A shading language version dependent varying
matching check is added to the translator API to facilitate this.

Tested by deqp/data/gles3/shaders/qualification_order.html after patching
Chrome to use the new linking check API.

A previous revision of this change that broke API compatibility was
reverted since it broke Chromium FYI bots. This revision keeps deprecated
API functionality around for now so that changes can be rolled
step-by-step to Chromium without breakage.

TEST=WebGL 2 conformance tests, angle_unittests
BUG=angleproject:987

include/GLSLANG/ShaderLang.h
include/GLSLANG/ShaderVars.h
src/compiler/translator/ParseContext.cpp
src/compiler/translator/ParseContext.h
src/compiler/translator/ShaderVars.cpp
src/compiler/translator/glslang.y
src/compiler/translator/glslang_tab.cpp
src/compiler/translator/util.cpp
src/tests/compiler_tests/ShaderVariable_test.cpp

Original comment by bugdroid1@chromium.org on 7 May 2015 at 2:35