Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StandardMaterial doesn't work in webgl2 on Windows with DX12 #10048

Closed
DGriffin91 opened this issue Oct 8, 2023 · 4 comments · Fixed by #10053
Closed

StandardMaterial doesn't work in webgl2 on Windows with DX12 #10048

DGriffin91 opened this issue Oct 8, 2023 · 4 comments · Fixed by #10053
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior O-WebGL2 Specific to the WebGL2 render API P-Regression Functionality that used to work but no longer does. Add a test for this!
Milestone

Comments

@DGriffin91
Copy link
Contributor

DGriffin91 commented Oct 8, 2023

Bevy version e67d63a

The release number or commit hash of the version you're using.

The issue was introduced at 1f95a48 with #8006.

Relevant system information

  • Windows 10, Nvidia RTX 3060

What you did

Try to run the 3d_scene example in webgl2.

What went wrong

Update: I get this error with any scene that uses the StandardMaterial, not just ones with shadows

Chrome:

Caused by:
    In Device::create_render_pipeline
      note: label = `pbr_opaque_mesh_pipeline`
    Internal error in ShaderStages(VERTEX | FRAGMENT) shader: C:\fakepath(5735,12-121): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
C:\fakepath(6517,3-15): error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (65 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(5735,12-121): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
C:\fakepath(6517,3-15): error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (65 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(5735,12-121): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
C:\fakepath(6517,3-15): error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (65 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 optimization flags. (ps_5_0)

Failed to create D3D Shaders

Firefox:

WebGL warning: linkProgram: Failed to link, leaving the following log:
C:\fakepath(5743,12-121): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
C:\fakepath(6525,3-15): error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (55 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(5743,12-121): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
C:\fakepath(6525,3-15): error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (55 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(5743,12-121): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
C:\fakepath(6525,3-15): error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (55 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 optimization flags. (ps_5_0)

Failed to create D3D Shaders
@DGriffin91 DGriffin91 added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Oct 8, 2023
@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen P-Regression Functionality that used to work but no longer does. Add a test for this! O-WebGL2 Specific to the WebGL2 render API and removed S-Needs-Triage This issue needs to be labelled labels Oct 8, 2023
@mockersf mockersf added this to the 0.12 milestone Oct 8, 2023
@alice-i-cecile
Copy link
Member

FYI @JMS55.

@superdump
Copy link
Contributor

Hmm, I don't understand yet. All PCF paths lead to sample_shadow_map_hardware() and that uses textureSampleCompareLevel() in all cases, including WebGL2. textureSampleCompareLevel() does not use gradients, because it always samples mip level 0.

@superdump superdump changed the title 3d_scene example doesn't work in webgl2 StandardMaterial doesn't work in webgl2 on Windows with DX12 Oct 8, 2023
@superdump
Copy link
Contributor

Affecting all scenes that use StandardMaterial, even if they don't have shadows, seems very strange to be related to the PCF PR. Are you certain of that?

@JMS55
Copy link
Contributor

JMS55 commented Oct 8, 2023

I imagine the shadow code gets included in the shader anyways.

github-merge-queue bot pushed a commit that referenced this issue Oct 8, 2023
# Objective

Webgl2 broke when pcf was merged.

Fixes #10048

## Solution

Change the `textureSampleCompareLevel` in shadow_sampling.wgsl to
`textureSampleCompare` to make it work again.
regnarock pushed a commit to regnarock/bevy that referenced this issue Oct 13, 2023
# Objective

Webgl2 broke when pcf was merged.

Fixes bevyengine#10048

## Solution

Change the `textureSampleCompareLevel` in shadow_sampling.wgsl to
`textureSampleCompare` to make it work again.
ameknite pushed a commit to ameknite/bevy that referenced this issue Nov 6, 2023
# Objective

Webgl2 broke when pcf was merged.

Fixes bevyengine#10048

## Solution

Change the `textureSampleCompareLevel` in shadow_sampling.wgsl to
`textureSampleCompare` to make it work again.
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this issue Jan 9, 2024
# Objective

Webgl2 broke when pcf was merged.

Fixes bevyengine#10048

## Solution

Change the `textureSampleCompareLevel` in shadow_sampling.wgsl to
`textureSampleCompare` to make it work again.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior O-WebGL2 Specific to the WebGL2 render API P-Regression Functionality that used to work but no longer does. Add a test for this!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants