Project: chromium Issues People Development process History Sign in
New issue
Advanced search Search tips
Issue 659326 WebglConformance_conformance_glsl_bugs_invariant_does_not_leak_across_shaders fails on Linux ATI/AMD bots
Starred by 1 user Project Member Reported by ynovikov@chromium.org, Oct 25 Back to list
Status: Fixed
Owner:
Closed: Oct 31
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug

Blocking:
issue 639760



Sign in to add a comment
https://build.chromium.org/p/chromium.gpu.fyi/builders/Linux%20Release%20%28ATI%29/builds/49457
https://build.chromium.org/p/chromium.gpu.fyi/builders/Linux%20Release%20%28AMD%20R7%20240%29/builds/616

I suspect https://chromium-review.googlesource.com/#/c/400005/

Log:
WebglConformance_conformance_glsl_bugs_invariant_does_not_leak_across_shaders (gpu_tests.webgl_conformance_integration_test.WebGLConformanceIntegrationTest) ... [23473:23473:1025/134323:INFO:CONSOLE(11)] "[unexpected link status] Shaders using invariant qualifier should compile and link.", source:  (11)
[23473:23473:1025/134323:INFO:CONSOLE(11)] "*** Error linking program '[object WebGLProgram]':Vertex shader(s) failed to link, fragment shader(s) failed to link.
Vertex link error: INVALID_OPERATION.
ERROR: error(#274) webgl_ff41a229111b080c invariant modes do not match between two stages
fragment link error: INVALID_OPERATION.
ERROR: error(#274) webgl_ff41a229111b080c invariant modes do not match between two stages

", source:  (11)
[23473:23473:1025/134323:INFO:CONSOLE(11)] "FAIL [unexpected link status] Shaders using invariant qualifier should compile and link.", source:  (11)
[23473:23473:1025/134323:INFO:CONSOLE(11)] "*** Error linking program '[object WebGLProgram]':Varyings with the same name but different type, or statically used varyings in fragment shader are not declared in vertex shader: v_varying", source:  (11)

Traceback (most recent call last):
  _RunGpuTest at content/test/gpu/gpu_tests/gpu_integration_test.py:78
    self.RunActualGpuTest(url, *args)
  RunActualGpuTest at content/test/gpu/gpu_tests/webgl_conformance_integration_test.py:196
    getattr(self, test_name)(test_path, *args[1:])
  _RunConformanceTest at content/test/gpu/gpu_tests/webgl_conformance_integration_test.py:210
    self._CheckTestCompletion()
  _CheckTestCompletion at content/test/gpu/gpu_tests/webgl_conformance_integration_test.py:206
    self.fail(self._WebGLTestMessages(self.tab))
  fail at /usr/lib/python2.7/unittest/case.py:412
    raise self.failureException(msg)
AssertionError: [unexpected link status] Shaders using invariant qualifier should compile and link.
*** Error linking program '[object WebGLProgram]':Vertex shader(s) failed to link, fragment shader(s) failed to link.
Vertex link error: INVALID_OPERATION.
ERROR: error(#274) webgl_ff41a229111b080c invariant modes do not match between two stages
fragment link error: INVALID_OPERATION.
ERROR: error(#274) webgl_ff41a229111b080c invariant modes do not match between two stages


FAIL [unexpected link status] Shaders using invariant qualifier should compile and link.
*** Error linking program '[object WebGLProgram]':Varyings with the same name but different type, or statically used varyings in fragment shader are not declared in vertex shader: v_varying

Locals:
  msg : u"[unexpected link status] Shaders using invariant qualifier should compile and link.\n*** Error linking program '[object WebGLProgram]':Vertex shader(s) failed to link, fragment shader(s) failed to link.\nVertex link error: INVALID_OPERATION.\nERROR: error(#274) webgl_ff41a229111b080c invariant modes do not match between two stages\nfragment link error: INVALID_OPERATION.\nERROR: error(#274) webgl_ff41a229111b080c invariant modes do not match between two stages\n\n\x00\nFAIL [unexpected link status] Shaders using invariant qualifier should compile and link.\n*** Error linking program '[object WebGLProgram]':Varyings with the same name but different type, or statically used varyings in fragment shader are not declared in vertex shader: v_varying\x00\n"

I believe this fails this test in CommandBuffer's Program::Link
    if (DetectVaryingsMismatch(&conflicting_name)) {
      std::string info_log = "Varyings with the same name but different type, "
                             "or statically used varyings in fragment shader "
                             "are not declared in vertex shader: " +
                             conflicting_name;
      set_log_info(ProcessLogInfo(info_log).c_str());
      return false;
    }

Will revert ANGLE CL until Chrome is fixed.
 
Project Member Comment 1 by bugdroid1@chromium.org, Oct 25
The following revision refers to this bug:
  https://chromium.googlesource.com/angle/angle/+/c5fa0ad5ef85c1b506ec4cba9a726f8e68cb4ae2

commit c5fa0ad5ef85c1b506ec4cba9a726f8e68cb4ae2
Author: Yuly Novikov <ynovikov@chromium.org>
Date: Tue Oct 25 21:36:54 2016

Revert "Remove invariant qualifier for input in fragment shader"

This reverts commit d842a6b2014447db0676c8a3f5a5e9ae4ce67d9a.

Because of WebglConformance_conformance_glsl_bugs_invariant_does_not_leak_across_shaders failure

BUG=chromium:659326

Change-Id: I0602e24f3d34ccf852cda865f673c5c7634f82a6
Reviewed-on: https://chromium-review.googlesource.com/403230
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>

[modify] https://crrev.com/c5fa0ad5ef85c1b506ec4cba9a726f8e68cb4ae2/src/compiler/translator/Compiler.h
[modify] https://crrev.com/c5fa0ad5ef85c1b506ec4cba9a726f8e68cb4ae2/src/compiler/translator/Compiler.cpp
[delete] https://crrev.com/af7f301f6ba9e5f31d1511142a936a9ba84169d0/src/compiler/translator/RemoveInvariantDeclaration.h
[delete] https://crrev.com/af7f301f6ba9e5f31d1511142a936a9ba84169d0/src/compiler/translator/RemoveInvariantDeclaration.cpp
[modify] https://crrev.com/c5fa0ad5ef85c1b506ec4cba9a726f8e68cb4ae2/src/compiler.gypi
[modify] https://crrev.com/c5fa0ad5ef85c1b506ec4cba9a726f8e68cb4ae2/src/compiler/translator/OutputGLSLBase.cpp

Blocking: 639760
To be clear: it looks like this is a bug in the code common between GPUs, and is not an AMD driver bug. It might be happening wherever this workaround is used.

Yeah, probably it surfaced on AMD since they have OpenGL 4.4 / 4.5, I don't recall such a new GL version on other bots.
Cc: kbr@chromium.org yang...@intel.com ynovikov@chromium.org cwallez@chromium.org
After investigation, I think this is a AMD driver bug. I found following gpu info in https://build.chromium.org/p/chromium.gpu.fyi/builders/Linux%20Release%20%28ATI%29/builds/49457/steps/webgl_conformance_tests/logs/stdio:
gl_renderer         : AMD Radeon HD 6450
gl_vendor           : ATI Technologies Inc.
gl_version          : 4.4.13374 Compatibility Profile Context 15.20.1013
pixel_shader_version: 4.40
vertex_shader_version: 4.40

For GLSL 4.40, invariant qualifier doesn't need to match between vertex and fragment shader. But, AMD driver reports error "ERROR: error(#274) webgl_ff41a229111b080c invariant modes do not match between two stages". ELSL 1.00 shaders should be translated to GLSL 4.40 shaders after compilation.

In the WebglConformance_conformance_glsl_bugs_invariant_does_not_leak_across_shaders test, there are two programs. The first program will link successfully, while the second will fail to link (validations in ANGLE such as DetectVaryingsMismatch are done before linking in driver). 

On AMD
(1) the first program fails to link with my patch, because AMD requires invariant match between vertex and fragment shader.
Vertex link error: INVALID_OPERATION.
ERROR: error(#274) webgl_ff41a229111b080c invariant modes do not match between two stages
fragment link error: INVALID_OPERATION.
ERROR: error(#274) webgl_ff41a229111b080c invariant modes do not match between two stages

(2) the second program is expected to fail, the error message is buffered before but is flushed to output because there are failures in the test file.
[23473:23473:1025/134323:INFO:CONSOLE(11)] "FAIL [unexpected link status] Shaders using invariant qualifier should compile and link.", source:  (11)
[23473:23473:1025/134323:INFO:CONSOLE(11)] "*** Error linking program '[object WebGLProgram]':Varyings with the same name but different type, or statically used varyings in fragment shader are not declared in vertex shader: v_varying", source:  (11)

So, different GPU vendors have different implementation on invariant.
AMD requires invariant must match between vertex and fragment shaders.
Intel Mesa forbids invariant in fragment for GLSL >= 4.2.
Nvidia doesn't require invariant must match, nor forbid invariant in fragment.


I can add my CL as a workaround for Intel Mesa. Or add a workaround for AMD GPU to disable my CL. I prefer the second method because AMD gpu has bug for GLSL >= 4.2. What do you think?
If your analysis is correct, then we should probably disable this test on Linux AMD and reland your original ANGLE CL. I'm not that familiar with CommandBuffer, so I'm not sure if it's validating the original shader, or one after ANGLE processing. Ken, what do you think?
Cc: zmo@chromium.org
Qiankun: I agree, disabling your ANGLE workaround only on AMD GPUs sounds like the best option. Could you please handle that? Thanks.

Ah, right, I've mistakenly thought that this was not a workaround, but a correct ESSL 1.0 => GLSL >= 4.2 handling. But, in fact, it is not necessary to omit "invariant" in fragment shaders on GLSL >= 4.2, as it is optional there.
Then, restricting the workaround to Intel makes sense.
Maybe we should add a compile option, like you did in https://chromium-review.googlesource.com/#/c/361792/?
Read the spec again. 
Description in 4.20.6:
"
Only variables output from a shader (including those that are then input to a
subsequent shader) can be candidates for invariance. This includes user-defined output variables and the
built-in output variables. For variables leaving one shader and coming into another shader, the invariant
keyword has to be used in both shaders, or a link error will result.
"

Description in 4.20.11:
"
Only variables output from a shader (including those that are then input to a subsequent shader) can be
candidates for invariance. This includes user-defined output variables and the built-in output variables.
As only outputs need be declared with invariant, an output from one shader stage will still match an input
of a subsequent stage without the input being declared as invariant.
"

It's not very clear invariant is forbidden in fragment shader for GLSL >=4.2. Treat it as optional currently and wait for spec to clarify this in future. So, I will update my CL to use it as a Linux Mesa workaround.
I have a question about the gpu.fyi bots.
The first failure on the AMD gpu.fyi bot is 086bb385cf32d872e93de865ef93086526919e4a (rev#427414}) which is before the ANGLE roll 657fd99aed465ab7f6d7aa62775217cd571f97c7 (rev#427509). The bots failed before my CL rolled in. Why did this happen? The only reason I guess is the bots use ANGLE ToT for testing.
The spec definitely contradicts with itself. I agree with the plan.

Yes, FYI bots run with ToT ANGLE.
Project Member Comment 11 by bugdroid1@chromium.org, Oct 27
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/a16bd358e88a73acb35843f44719783f24087234

commit a16bd358e88a73acb35843f44719783f24087234
Author: geofflang <geofflang@chromium.org>
Date: Thu Oct 27 21:18:24 2016

Roll ANGLE af7f301..1d2c41d

https://chromium.googlesource.com/angle/angle.git/+log/af7f301..1d2c41d

BUG= 658555 ,chromium:659326, 540829 ,655247

TBR=jmadill@chromium.org

TEST=bots

CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.win:win_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2457883002
Cr-Commit-Position: refs/heads/master@{#428138}

[modify] https://crrev.com/a16bd358e88a73acb35843f44719783f24087234/DEPS

Project Member Comment 12 by bugdroid1@chromium.org, Oct 27
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/9bfaa6948251aae2a4f2b8ca178e8c9c3f5e78c3

commit 9bfaa6948251aae2a4f2b8ca178e8c9c3f5e78c3
Author: jam <jam@chromium.org>
Date: Thu Oct 27 21:49:44 2016

Revert of Roll ANGLE af7f301..1d2c41d (patchset #1 id:1 of https://codereview.chromium.org/2457883002/ )

Reason for revert:
breaks build
https://build.chromium.org/p/chromium.chrome/builders/Google%20Chrome%20Win/builds/11909/steps/compile/logs/stdio

Original issue's description:
> Roll ANGLE af7f301..1d2c41d
>
> https://chromium.googlesource.com/angle/angle.git/+log/af7f301..1d2c41d
>
> BUG= 658555 ,chromium:659326, 540829 ,655247
>
> TBR=jmadill@chromium.org
>
> TEST=bots
>
> CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.win:win_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel
>
> Committed: https://crrev.com/a16bd358e88a73acb35843f44719783f24087234
> Cr-Commit-Position: refs/heads/master@{#428138}

TBR=jmadill@chromium.org,geofflang@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG= 658555 ,chromium:659326, 540829 ,655247

Review-Url: https://codereview.chromium.org/2459753002
Cr-Commit-Position: refs/heads/master@{#428148}

[modify] https://crrev.com/9bfaa6948251aae2a4f2b8ca178e8c9c3f5e78c3/DEPS

Project Member Comment 13 by bugdroid1@chromium.org, Oct 29
The following revision refers to this bug:
  https://chromium.googlesource.com/angle/angle/+/705a9194438dd19a2f456235dda5a175cfce94d5

commit 705a9194438dd19a2f456235dda5a175cfce94d5
Author: Qiankun Miao <qiankun.miao@intel.com>
Date: Mon Aug 29 02:05:27 2016

Reland "Remove invariant qualifier for input in fragment shader"

This relands https://chromium-review.googlesource.com/#/c/400005/.

ESSL and GLSL are not consistent on invariant matching in vertex shader
and fragment shader. See the following rules:
ESSL 1.00 - input and output must match
ESSL 3.00 - only output, inputs cannot be declared as invariant.

GLSL 1.10.59 - does not exist
GLSL 1.20.8  - input and output must match
GLSL 1.30.10 - input and output must match
GLSL 1.40.8  - input and output must match
GLSL 1.50.11 - input and output must match
GLSL 3.30.6  - input and output must match
GLSL 4.00.9  - input and output must match
GLSL 4.10.6  - input and output must match
GLSL 4.20.11 - input can omit invariant
GLSL 4.30.8  - input can omit invariant
GLSL 4.40.9  - input can omit invariant
GLSL 4.50.5  - input can omit invariant

Since GLSL 4.20, invariant qualifier description were changed to:
"
Only variables output from a shader (including those that are then input
to a subsequent shader) can be candidates for invariance. This includes
user-defined output variables and the built-in output variables. As only
outputs need be declared with invariant, an output from one shader stage
will still match an input of a subsequent stage without the input being
declared as invariant.
"
It's not very clear if input in fragment can be declared as invariant.
Mesa driver disallows use of input declared as invariant in fragment
shader, while other drivers may allow it. This CL removes invariant
declaration for input in fragment shader except AMD driver in Linux.
AMD's driver obviously contradicts the spec by forcing invariance to
match between vertex and fragment shaders.

BUG=chromium:639760, chromium:659326
TEST=conformance/glsl/misc/shaders-with-invariance.html and
conformance/glsl/bugs/invariant-does-not-leak-across-shaders.html

Change-Id: I0aa9be14f0cee7a11a249c91fba27c570c52ca1b
Reviewed-on: https://chromium-review.googlesource.com/404228
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Yuly Novikov <ynovikov@chromium.org>

[modify] https://crrev.com/705a9194438dd19a2f456235dda5a175cfce94d5/src/compiler/translator/OutputESSL.cpp
[modify] https://crrev.com/705a9194438dd19a2f456235dda5a175cfce94d5/include/GLSLANG/ShaderLang.h
[modify] https://crrev.com/705a9194438dd19a2f456235dda5a175cfce94d5/src/compiler/translator/OutputGLSL.cpp
[modify] https://crrev.com/705a9194438dd19a2f456235dda5a175cfce94d5/src/compiler/translator/Compiler.cpp
[modify] https://crrev.com/705a9194438dd19a2f456235dda5a175cfce94d5/src/compiler/translator/TranslatorESSL.cpp
[modify] https://crrev.com/705a9194438dd19a2f456235dda5a175cfce94d5/src/compiler/translator/OutputGLSLBase.cpp
[modify] https://crrev.com/705a9194438dd19a2f456235dda5a175cfce94d5/src/libANGLE/renderer/gl/ShaderGL.cpp
[modify] https://crrev.com/705a9194438dd19a2f456235dda5a175cfce94d5/src/compiler/translator/OutputGLSL.h
[add] https://crrev.com/705a9194438dd19a2f456235dda5a175cfce94d5/src/compiler/translator/RemoveInvariantDeclaration.h
[add] https://crrev.com/705a9194438dd19a2f456235dda5a175cfce94d5/src/compiler/translator/RemoveInvariantDeclaration.cpp
[modify] https://crrev.com/705a9194438dd19a2f456235dda5a175cfce94d5/src/compiler/translator/OutputESSL.h
[modify] https://crrev.com/705a9194438dd19a2f456235dda5a175cfce94d5/src/compiler/translator/TranslatorGLSL.cpp
[modify] https://crrev.com/705a9194438dd19a2f456235dda5a175cfce94d5/src/compiler.gypi
[modify] https://crrev.com/705a9194438dd19a2f456235dda5a175cfce94d5/src/libANGLE/renderer/gl/renderergl_utils.cpp
[modify] https://crrev.com/705a9194438dd19a2f456235dda5a175cfce94d5/src/compiler/translator/OutputGLSLBase.h
[modify] https://crrev.com/705a9194438dd19a2f456235dda5a175cfce94d5/src/libANGLE/renderer/gl/WorkaroundsGL.h
[modify] https://crrev.com/705a9194438dd19a2f456235dda5a175cfce94d5/src/compiler/translator/Compiler.h

Project Member Comment 14 by bugdroid1@chromium.org, Oct 30
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/988aa562e76cacc7b6b39d9f7b33c25f5b7824f8

commit 988aa562e76cacc7b6b39d9f7b33c25f5b7824f8
Author: qiankun.miao <qiankun.miao@intel.com>
Date: Sun Oct 30 09:14:46 2016

Roll ANGLE af7f301..705a919

https://chromium.googlesource.com/angle/angle.git/+log/af7f301..705a919

BUG=chromium:659892,  540829 , 655247, chromium:639760, chromium:659326, chromium:659326,  658555 

TEST=bots

CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.win:win_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2457243003
Cr-Commit-Position: refs/heads/master@{#428622}

[modify] https://crrev.com/988aa562e76cacc7b6b39d9f7b33c25f5b7824f8/DEPS

Project Member Comment 15 by bugdroid1@chromium.org, Oct 30
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/fdc6ab7c454d400dfc3d68ace3e4bcd192e3e5d5

commit fdc6ab7c454d400dfc3d68ace3e4bcd192e3e5d5
Author: qiankun.miao <qiankun.miao@intel.com>
Date: Sun Oct 30 13:51:07 2016

Remove invariant for input in fragment shader

This CL enables a ANGLE workaround which removes invariant declaration
for GLSL >= 4.20 on all platforms except AMD Linux because AMD's driver
obviously contradicts the spec by forcing invariance to match
between vertex and fragment shaders.

BUG= 639760 ,  659326 
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2456823002
Cr-Commit-Position: refs/heads/master@{#428625}

[modify] https://crrev.com/fdc6ab7c454d400dfc3d68ace3e4bcd192e3e5d5/gpu/command_buffer/service/gles2_cmd_decoder.cc
[modify] https://crrev.com/fdc6ab7c454d400dfc3d68ace3e4bcd192e3e5d5/gpu/config/gpu_driver_bug_list_json.cc
[modify] https://crrev.com/fdc6ab7c454d400dfc3d68ace3e4bcd192e3e5d5/gpu/config/gpu_driver_bug_workaround_type.h

Status: Fixed
Sign in to add a comment