mc-imperial / shader-compiler-bugs

A collection of shader compiler bugs.
MIT License
49 stars 9 forks source link

ANGLE gives hard-to-understand error about an invalid subscript #65

Open afd opened 7 years ago

afd commented 7 years ago

When applied to this shader:

https://github.com/mc-imperial/shader-compiler-bugs/blob/master/angle/front-end/invalid-subscript/shader.frag

ANGLE in Google Chrome Version 57.0.2987.110 (64-bit) gives an error saying that there is an invalid subscript:

" Failed to link shader program. C:\fakepath(26,1-72): warning X3206: 'clamp': implicit truncation of vector type

C:\fakepath(26,1-74): error X3018: invalid subscript 'z'

Warning: D3D shader compilation failed with default flags. (ps_5_0) Retrying with skip validation C:\fakepath(26,1-72): warning X3206: 'clamp': implicit truncation of vector type

C:\fakepath(26,1-74): error X3018: invalid subscript 'z'

Warning: D3D shader compilation failed with skip validation flags. (ps_5_0) Retrying with skip optimization C:\fakepath(26,1-72): warning X3206: 'clamp': implicit truncation of vector type

C:\fakepath(26,1-74): error X3018: invalid subscript 'z'

Warning: D3D shader compilation failed with skip optimization flags. (ps_5_0) Failed to create D3D shaders. "

The shader is accepted by the Khronos glslangValidator tool, and by Intel's OpenGL drivers.

It might be that an invocation of "clamp" with arguments of types vec3, float and float should actually be rejected. But if that's the case then it would be better for this to happen at the GLSL level, rather than via an error at the Direct3D level (e.g., it is confusing that the subscript referred to is 'z', when in the original shader 'p' is used).

afd commented 7 years ago

Reported to ANGLE: https://bugs.chromium.org/p/angleproject/issues/detail?id=1947