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

Unsupported GL_EXT_texture_shadow_lod causes panic in PBR pipeline #14045

Open
ByteNybbler opened this issue Jun 27, 2024 · 4 comments
Open

Unsupported GL_EXT_texture_shadow_lod causes panic in PBR pipeline #14045

ByteNybbler opened this issue Jun 27, 2024 · 4 comments
Labels
A-glTF Related to the glTF 3D scene/model format A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior O-OpenGL Specific to the OpenGL render API P-Crash A sudden unexpected crash

Comments

@ByteNybbler
Copy link

ByteNybbler commented Jun 27, 2024

Bevy version

So far this panic has been reproduced on the following versions of Bevy:

  • v0.13.2
  • v0.14.0-rc.3

Relevant system information

  • SystemInfo { os: "Windows 10 Home", kernel: "19045", cpu: "Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz", core_count: "4", memory: "15.9 GiB" }
  • AdapterInfo { name: "Intel(R) HD Graphics 4600", vendor: 32902, device: 0, device_type: IntegratedGpu, driver: "OpenGL", driver_info: "4.3.0 - Build 20.19.15.4531", backend: Gl }
  • cargo 1.79.0 (ffa9cf99a 2024-06-03)

What you did

WGPU_BACKEND=gl cargo run --example pbr

I've also noticed this same error on the 3d_shapes and load_gltf examples. Maybe any PBR scene will cause this issue?

What went wrong

Bevy does not seem to gracefully handle GL_EXT_texture_shadow_lod not being supported by the render device, and this causes shader compilation failures. This essentially makes many 3D Bevy games unplayable on older graphics hardware when using OpenGL.

2024-06-27T04:56:36.395669Z ERROR log: GLES: [ShaderCompiler/Error] ID 0 : SHADER_ID_COMPILE error has been generated. GLSL compile failed for shader 21, "": ERROR: 0:4: '#extension' :  'GL_EXT_texture_shadow_lod' is not supported
ERROR: 0:585: 'textureLod' : no matching overloaded function found (using implicit conversion)
ERROR: 0:660: 'textureLod' : no matching overloaded function found (using implicit conversion)


2024-06-27T04:56:36.395730Z ERROR log:  Shader compilation failed: ERROR: 0:4: '#extension' :  'GL_EXT_texture_shadow_lod' is not supported
ERROR: 0:585: 'textureLod' : no matching overloaded function found (using implicit conversion)
ERROR: 0:660: 'textureLod' : no matching overloaded function found (using implicit conversion)


2024-06-27T04:56:36.396042Z ERROR log: Device::create_render_pipeline error: Internal error in ShaderStages(FRAGMENT) shader: ERROR: 0:4: '#extension' :  'GL_EXT_texture_shadow_lod' is not supported
ERROR: 0:585: 'textureLod' : no matching overloaded function found (using implicit conversion)
ERROR: 0:660: 'textureLod' : no matching overloaded function found (using implicit conversion)


2024-06-27T04:56:36.396070Z ERROR log: Shader translation error for stage ShaderStages(FRAGMENT): ERROR: 0:4: '#extension' :  'GL_EXT_texture_shadow_lod' is not supported
ERROR: 0:585: 'textureLod' : no matching overloaded function found (using implicit conversion)
ERROR: 0:660: 'textureLod' : no matching overloaded function found (using implicit conversion)


2024-06-27T04:56:36.396082Z ERROR log: Please report it to https://github.com/gfx-rs/wgpu
2024-06-27T04:56:36.396123Z ERROR log: Handling wgpu errors as fatal by default 
thread 'Async Compute Task Pool (1)' panicked at C:\Users\bytenybbler\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-0.20.1\src\backend\wgpu_core.rs:2996:5:
wgpu error: Validation Error

Caused by:
    In Device::create_render_pipeline
      note: label = `pbr_opaque_mesh_pipeline`
    Internal error in ShaderStages(FRAGMENT) shader: ERROR: 0:4: '#extension' :  'GL_EXT_texture_shadow_lod' is not supported
ERROR: 0:585: 'textureLod' : no matching overloaded function found (using implicit conversion)
ERROR: 0:660: 'textureLod' : no matching overloaded function found (using implicit conversion)

Additional information

wgpu devs say that it is downstream's responsibility to handle missing GL_EXT_texture_shadow_lod gracefully, perhaps by using a downlevel flag: gfx-rs/wgpu#5344 (comment)

gfx-rs/wgpu#5171 introduced a new dependency on the GL_EXT_texture_shadow_lod feature, but upon testing older Bevy versions, it appears to be unrelated to this issue.

Maybe it's possible that this issue could be fixed by #12849?

I found this bug while I was trying to test #8789.

@ByteNybbler ByteNybbler added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jun 27, 2024
@janhohenheim janhohenheim added A-Rendering Drawing game state to the screen P-Crash A sudden unexpected crash C-Regression Functionality that used to work but no longer does. Add a test for this! O-OpenGL Specific to the OpenGL render API and removed S-Needs-Triage This issue needs to be labelled labels Jun 28, 2024
@janhohenheim
Copy link
Member

janhohenheim commented Jun 28, 2024

Am I understanding it correctly that this did not happen in 0.13 and is due to the wgpu update?
Update: yes, gfx-rs/wgpu#5171 is part of WGPU 0.20.0 which is first used by Bevy 0.14.
As such, this is a regression: some older hardware can no longer run Bevy stuff.

Open question: is this important? How many machines are affected? I'd like to test this, but I don't know how to force WGPU to use my integrated GPU (other than physically removing my actual GPU of course).

Running the pbr example on OpenGL on my dedicated GPU at least renders fine but spams the following hundreds of times:
image

I don't think this is related to this issue in particular, but worth noting.

@janhohenheim janhohenheim added this to the 0.14 milestone Jun 28, 2024
@JMS55
Copy link
Contributor

JMS55 commented Jun 28, 2024

Set the WGPU_ADAPTER_NAME environment variable to force a specific GPU: https://github.com/gfx-rs/wgpu?tab=readme-ov-file#environment-variables

@ByteNybbler
Copy link
Author

ByteNybbler commented Jun 28, 2024

Am I understanding it correctly that this did not happen in 0.13 and is due to the wgpu update? Update: yes, gfx-rs/wgpu#5171 is part of WGPU 0.20.0 which is first used by Bevy 0.14. As such, this is a regression: some older hardware can no longer run Bevy stuff.

I switched to v0.13.2 and tried WGPU_BACKEND=gl cargo run --example pbr and I still got the same 'GL_EXT_texture_shadow_lod' is not supported errors as above. This seems to prove that gfx-rs/wgpu#5171 is not the cause of this error, and therefore this doesn't seem to be a regression (as far as I can tell, anyway).

Open question: is this important? How many machines are affected?

I think my integrated GPU is around a decade old now. However, it can run almost every game I come across without issue. In order for Bevy to be truly competitive as a game engine, I would argue that it's important to try to maximize hardware compatibility (within reason, of course).

Running the pbr example on OpenGL on my dedicated GPU at least renders fine but spams the following hundreds of times:

That looks like #13115 which is probably only tangentially related to this issue.

@janhohenheim janhohenheim removed the C-Regression Functionality that used to work but no longer does. Add a test for this! label Jun 28, 2024
@janhohenheim
Copy link
Member

janhohenheim commented Jun 28, 2024

@ByteNybbler thanks for the info! Removing the milestone then.

@janhohenheim janhohenheim removed this from the 0.14 milestone Jun 28, 2024
@alice-i-cecile alice-i-cecile added the A-glTF Related to the glTF 3D scene/model format label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-glTF Related to the glTF 3D scene/model format A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior O-OpenGL Specific to the OpenGL render API P-Crash A sudden unexpected crash
Projects
None yet
Development

No branches or pull requests

4 participants