Open
Bug 1237676
Opened 9 years ago
Updated 2 years ago
WebGL2 GLSL ES 3.00 textureLod() instructions are misinterpreted to depend on implicit partial derivatives
Categories
(Core :: Graphics: CanvasWebGL, defect, P3)
Tracking
()
NEW
Tracking | Status | |
---|---|---|
firefox46 | --- | affected |
People
(Reporter: jujjyl, Unassigned)
References
Details
(Whiteboard: [gfx-noted])
Attachments
(2 files)
See the attached page. The shaders should compile and link correctly, but they fail with the linker error:
Error: WebGL: linkProgram: Failed to link, leaving the following log:
C:\fakepath(80,12-48): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
C:\fakepath(139,3-122): error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (252 iterations) or unrolled loop is too large, use the [unroll(n)] attribute to force an exact higher number
Warning: D3D shader compilation failed with default flags. (ps_5_0)
Retrying with skip validation
C:\fakepath(80,12-48): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
C:\fakepath(139,3-122): error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (252 iterations) or unrolled loop is too large, use the [unroll(n)] attribute to force an exact higher number
Warning: D3D shader compilation failed with skip validation flags. (ps_5_0)
Retrying with skip optimization
C:\fakepath(80,12-48): warning X3570: gradient instruct
The fragment shader in question has the following features:
- it uses a non-compile-time terminating for loop, i.e. dynamic control flow
- it uses textureLod() instructions inside the for loop. This instruction is specced to sample with partial derivatives explicitly set to zero, so it does not depend on gradients.
However, linking the program incorrectly fails saying that instructions depending on gradients would have been used, pointing at textureLod().
Peculiarly, attempting to further minimize the fragment shader test case by removing more instructions, the issue disappears. I.e. even removing the declaration of an unused variable inside the body of the for loop "uint p1 ;" makes the problem go away, so I was not able to make the test case any smaller. Presumably unrolling the loop gets confused somehow when the variables are present.
Comment 1•9 years ago
|
||
This sounds like an ANGLE bug. Do you mind filing it upstream and linking to it from here?
Comment 2•9 years ago
|
||
I've investigated this a bit more. You can reproduce the problem by compiling the attached out.pixel with fxc -T ps_5_0 out.pixel.
The shader is using SampleCmp which does not take a a LOD and thus explains why it's complaining. It's not obvious to me how to implement what this shader is doing in D3D11.
Updated•9 years ago
|
Whiteboard: [gfx-noted]
Comment 3•8 years ago
|
||
(In reply to Jeff Muizelaar [:jrmuizel] from comment #2)
> The shader is using SampleCmp which does not take a a LOD and thus explains
> why it's complaining. It's not obvious to me how to implement what this
> shader is doing in D3D11.
It's not going to cover the general case, but for LOD=0 they should be using SampleCmpLevelZero (https://msdn.microsoft.com/en-us/library/windows/desktop/bb509697(v=vs.85).aspx)
Comment 4•8 years ago
|
||
Filed an issue to angle: https://bugs.chromium.org/p/angleproject/issues/detail?id=1676
Updated•8 years ago
|
Priority: -- → P3
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•