KroMignon / angleproject

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

Comparing and assigning structures containing arrays or samplers is accepted by the compiler #954

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Compile the following shader:
precision mediump float;
struct s { float a[3]; };
void main() {
   s a;
   s b;
   bool c = (a == b);
   gl_FragColor = vec4(c ? 1.0 : 0.0);
}

What is the expected output? What do you see instead?
Expected: Behavior of the shader is undefined in ESSL 1.00, so it would be good 
to fail compilation or at least issue a warning.
Actual: Compiler produces a shader with undefined behavior.

ESSL 1.00 section 5.7. This restriction is lifted in ESSL 3.00.

Original issue reported on code.google.com by oetu...@nvidia.com on 20 Mar 2015 at 12:41

GoogleCodeExporter commented 9 years ago
Thanks for reporting this Olli. Also cc'ing Ken. We should verify this and 
possibly resolve it as an error in the WebGL spec - all implementations should 
be able to detect this and undefined behaviour is something we'd like to purge 
from WebGL.

Original comment by jmad...@chromium.org on 20 Mar 2015 at 5:35

GoogleCodeExporter commented 9 years ago
After studying the ESSL 1.00 spec more carefully, I don't think that any spec 
clarification is needed - sections 5.8, 5.9 and 4.1.7 have some additional 
coverage for this, making it clear that this should be disallowed. There's a 
pull request for WebGL tests at: https://github.com/KhronosGroup/WebGL/pull/910

Original comment by oetu...@nvidia.com on 23 Mar 2015 at 12:41

GoogleCodeExporter commented 9 years ago
This problem also exists for structs containing samplers, using this same issue 
for that.

Original comment by oetu...@nvidia.com on 23 Mar 2015 at 12:45

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

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

Disallow operations on structures containing arrays in ESSL1

Comparing structures that contain arrays to each other and assigning
structures that contain arrays is "not defined" in ESSL 1.00 (section
5.7). Sections 5.8 and 5.9 further suggest that these operations are not
allowed. Additionally some platform drivers on Linux seem to reject
shaders produced by ANGLE which compare structures containing arrays.
This might require changing the output GLSL version for ESSL 3.00.

BUG=angleproject:954
TEST=angle_unittests

src/compiler/translator/ParseContext.cpp
src/tests/compiler_tests/MalformedShader_test.cpp

Original comment by bugdro...@chromium.org on 23 Mar 2015 at 1:50

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

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

Support equality between structs containing arrays in HLSL output

This requires sorting all equality functions together so that struct
equality functions can have dependencies on array equality functions, but
support for array equality functions that have dependencies on struct
equality functions is also maintained.

There's no automated test coverage for this specifically. The change was
tested by manually inspecting shader output and ensuring that there were
no test regressions in tests listed below.

TEST=dEQP-GLES3.functional.shaders.*
BUG=angleproject:954

src/compiler/translator/OutputHLSL.cpp
src/compiler/translator/OutputHLSL.h

Original comment by bugdro...@chromium.org on 25 Mar 2015 at 4:10