yangqiaosheng / angleproject

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

scope for do-while without brackets not working #314

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
See 
https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests/conforma
nce/glsl/misc/shader-with-do-scoping.html failing.

The fragment shader in this test is:

// fragment shader with do scoping should succeed
precision mediump float;
void main() {
  int k = 0;
  do int k = 1; while (k != 0); // ok, do always introduces scope
  gl_FragColor = vec4(float(k));
}

Original issue reported on code.google.com by zmo@chromium.org on 9 Apr 2012 at 8:24

GoogleCodeExporter commented 9 years ago
This is after r1001 rolled into chromium.

Original comment by z...@google.com on 9 Apr 2012 at 8:24

GoogleCodeExporter commented 9 years ago
The fragment shader doesn't reach the ANGLE DLLs, so it must be failing at the 
validator. This is with Canary 20.0.1096.1. It works fine in a stand-alone ES2 
application.

Original comment by nicolas....@gmail.com on 9 Apr 2012 at 11:37

GoogleCodeExporter commented 9 years ago
Did you just have r1001 rolled in, or were you using at least r1016?  

Original comment by dan...@transgaming.com on 11 Apr 2012 at 4:00

GoogleCodeExporter commented 9 years ago
The test is failing in current top of tree Chromium, which is using ANGLE 
revision 1018 per about:gpu.

Original comment by kbr@chromium.org on 11 Apr 2012 at 5:11

GoogleCodeExporter commented 9 years ago
I found the issue. The ESSL translator is turning this:

    do int k; while(...)

into:

    doint k;while(...)

So there should be a newline or space after "do". Should be an easy fix...

Original comment by nicolas....@gmail.com on 13 Apr 2012 at 5:14

GoogleCodeExporter commented 9 years ago
Sorry, it actually does output a newline after "do". I didn't correctly copy 
the output. Anyway, feeding this output from the ESSL translator into the HLSL 
translator didn't cause any errors at all.

So is seems to me that the issue must be in Chrome. When I attach a debugger 
and run the conformance test, there is no call to glShaderSource for the 
fragment shader (only for the vertex shader). There's a call to glCreateShader 
for both though.

Original comment by nicolas....@gmail.com on 13 Apr 2012 at 5:51

GoogleCodeExporter commented 9 years ago
OK, I'll have a look.

Original comment by z...@google.com on 13 Apr 2012 at 5:58

GoogleCodeExporter commented 9 years ago
After further debugging, it is in ValidateLimitations.cpp that while-loop and 
do-while-loop are rejected.  In the GLSL ES spec, Appendix A-4, "Support for 
while and do-while is not mandated".

Therefore, our implementation is correct, and the test was wrong.  I am going 
to fix the test.

Original comment by z...@google.com on 18 Apr 2012 at 5:38

GoogleCodeExporter commented 9 years ago
Ah thanks for tracking that down.  I realize what we did wrong in testing with 
ESSL translator -- we were using the ESSL spec, not WebGL spec option.

Original comment by dan...@transgaming.com on 18 Apr 2012 at 6:12