New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 622247 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 625363
Owner:
Closed: Jul 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug



Sign in to add a comment

webgl1.0.4 deqp/data/gles2/shaders/preprocessor.html failed

Project Member Reported by xinghua....@intel.com, Jun 22 2016

Issue description


OS: Ubuntu
What steps will reproduce the problem?
(1) Run this html on Intel driver(mesa+i965)

What is the expected output?
All cases will pass

What do you see instead?
failed: preprocessor.pragmas.pragma_fragment: expected shaders to compile and link properly, but failed to compile.
Notes: This case passed on nvidia driver.

Please use labels and text to provide additional information.
Intel driver will report a error
0:2(1): error: pragma `invariant(all)' cannot be used in a fragment shader.

I had checked the OpenGL and OpenGL ES shadering language specs, OpenGL ES shading language version 3.00(P59) and OpenGL shading language version 4.50(P95) all point that
#pragma STDGL invariant(all)
It is a compile-time error to use this pragma in a fragment shader.

But OpenGL ES shading language version 1.00(P44) does not point that it cannot use this pragma in fragment shader.

According to shader language, it is correct for Intel driver report this error. I think there are other two issues in angle and nvidia driver.
1. In angle, because the later OpenGL shadering language cannot use this pragma, when shading language is 100 es, it cannot directly translate this pragma to late OpenGL shadering language. Below is the translation based on Intel driver.
--original-shader--
#pragma
#pragma STDGL invariant(all)
#pragma debug(off)
#pragma optimize(off)

precision mediump float;
bool isOk (float a, float b, float eps) { return (abs(a-b) <= (eps*abs(b) + eps)); }
uniform float ref_out0;
float out0;

varying float v_val;
void main()
{
	out0 = v_val;
	bool RES = isOk(out0, ref_out0, 0.05);
gl_FragColor = vec4(RES, RES, RES, 1.0);

}

--translated-shader--
#version 120
#pragma STDGL invariant(all)
bool webgl_26daf0ef1d00ab6d(in float webgl_2420662cd003acfa, in float webgl_44a9acbe7629930d, in float webgl_1a7af25567fa6d17){
return (abs((webgl_2420662cd003acfa - webgl_44a9acbe7629930d)) <= ((webgl_1a7af25567fa6d17 * abs(webgl_44a9acbe7629930d)) + webgl_1a7af25567fa6d17));
}
uniform float webgl_20b06c95b742317e;
float webgl_50c85a6bbb49f119;
varying float webgl_42b49cfa53f780ca;
void main(){
(webgl_50c85a6bbb49f119 = webgl_42b49cfa53f780ca);
bool webgl_64928d1969e45ae2 = webgl_26daf0ef1d00ab6d(webgl_50c85a6bbb49f119, webgl_20b06c95b742317e, 0.050000001);
(gl_FragColor = vec4(webgl_64928d1969e45ae2, webgl_64928d1969e45ae2, webgl_64928d1969e45ae2, 1.0));
}

2. In nvidia driver
It should report this error when use this pragma. I had printed the translated shader as below:
--original-shader--
#pragma
#pragma STDGL invariant(all)
#pragma debug(off)
#pragma optimize(off)

precision mediump float;
bool isOk (float a, float b, float eps) { return (abs(a-b) <= (eps*abs(b) + eps)); }
uniform float ref_out0;
float out0;

varying float v_val;
void main()
{
	out0 = v_val;
	bool RES = isOk(out0, ref_out0, 0.05);
gl_FragColor = vec4(RES, RES, RES, 1.0);

}

--translated-shader--
#version 450
#pragma STDGL invariant(all)
out vec4 webgl_FragColor;
bool webgl_26daf0ef1d00ab6d(in float webgl_2420662cd003acfa, in float webgl_44a9acbe7629930d, in float webgl_1a7af25567fa6d17){
return (abs((webgl_2420662cd003acfa - webgl_44a9acbe7629930d)) <= ((webgl_1a7af25567fa6d17 * abs(webgl_44a9acbe7629930d)) + webgl_1a7af25567fa6d17));
}
uniform float webgl_20b06c95b742317e;
float webgl_50c85a6bbb49f119;
in float webgl_42b49cfa53f780ca;
void main(){
(webgl_50c85a6bbb49f119 = webgl_42b49cfa53f780ca);
bool webgl_64928d1969e45ae2 = webgl_26daf0ef1d00ab6d(webgl_50c85a6bbb49f119, webgl_20b06c95b742317e, 0.050000001);
(webgl_FragColor = vec4(webgl_64928d1969e45ae2, webgl_64928d1969e45ae2, webgl_64928d1969e45ae2, 1.0));

 

Comment 1 by kbr@chromium.org, Jun 23 2016

Components: Internals>GPU>ANGLE Blink>WebGL
Status: Assigned (was: Untriaged)
We've run into this problem before, I'm pretty sure. There are contradictions between the ESSL and GLSL specifications, and I'm not sure what the best solution is. It would be great, and much appreciated, if you would give this problem thought and see if there is a workable solution in the shader translator.

The test has been removed, see https://bugs.chromium.org/p/chromium/issues/detail?id=625363

Comment 4 by kbr@chromium.org, Jul 7 2016

Mergedinto: 625363
Status: Duplicate (was: Assigned)
Yes. After more investigation it was discovered the test is illegal. Duplicating.

Sign in to add a comment