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

Atmosphere example panics when backend is DX12 instead of Vulkan #17632

Open
GitGhillie opened this issue Feb 1, 2025 · 1 comment
Open

Atmosphere example panics when backend is DX12 instead of Vulkan #17632

GitGhillie opened this issue Feb 1, 2025 · 1 comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior C-Machine-Specific This bug is isolated to specific hardware or driver configurations O-DX12 Specific to the DX12 render API S-Needs-Investigation This issue requires detective work to figure out what's going wrong

Comments

@GitGhillie
Copy link
Contributor

Bevy version

Bevy main

Relevant system information

cargo 1.83.0

2025-02-01T13:36:42.272310Z  INFO bevy_diagnostic::system_information_diagnostics_plugin::internal: SystemInfo { os: "Windows 10 Home", kernel: "19045", cpu: "AMD Ryzen 7 7800X3D 8-Core Processor", core_count: "8", memory: "63.1 GiB" }
2025-02-01T13:36:42.417152Z  INFO bevy_render::renderer: AdapterInfo { name: "AMD Radeon RX 7900 XT", vendor: 4098, device: 29772, device_type: DiscreteGpu, driver: "32.0.12033.1030", driver_info: "", backend: Dx12 }

What you did

cargo run --example atmosphere with WGPU_BACKEND set to dx12.

What went wrong

Immediate panic with 2025-02-01T13:36:43.594474Z ERROR wgpu_hal::dx12::device: Naga generated shader for "main" at Fragment:
Then a dump of the atmosphere shader code.
Then this:

2025-02-01T13:36:43.620196Z ERROR wgpu_core::device::global: Device::create_render_pipeline error: Internal error in ShaderStages(FRAGMENT) shader: FXC D3DCompile error (Unspecified error (0x80004005)): C:\Rust\bevy\Shader@0x00000212E3942750(343,32-43): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
C:\Rust\bevy\Shader@0x00000212E3942750(326,5-15): error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (561 iterations) or unrolled loop is too large, use the [unroll(n)] attribute to force an exact higher number

2025-02-01T13:36:43.620287Z ERROR wgpu::backend::wgpu_core: Shader translation error for stage ShaderStages(FRAGMENT): FXC D3DCompile error (Unspecified error (0x80004005)): C:\Rust\bevy\Shader@0x00000212E3942750(343,32-43): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
C:\Rust\bevy\Shader@0x00000212E3942750(326,5-15): error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (561 iterations) or unrolled loop is too large, use the [unroll(n)] attribute to force an exact higher number

2025-02-01T13:36:43.621873Z ERROR wgpu::backend::wgpu_core: Please report it to https://github.com/gfx-rs/wgpu
2025-02-01T13:36:43.621948Z ERROR wgpu::backend::wgpu_core: Handling wgpu errors as fatal by default
thread 'Async Compute Task Pool (3)' panicked at C:\Users\jojo_\.cargo\registry\src\index.crates.io-6f17d22bba15001f\wgpu-23.0.1\src\backend\wgpu_core.rs:1102:18:
wgpu error: Validation Error

Caused by:
  In Device::create_render_pipeline, label = 'render_sky_pipeline_4'
    Internal error in ShaderStages(FRAGMENT) shader: FXC D3DCompile error (Unspecified error (0x80004005)): C:\Rust\bevy\Shader@0x00000212E3942750(343,32-43): warning X3570: gradient instruction used in a loop with varying iteration, attempting to unroll the loop
C:\Rust\bevy\Shader@0x00000212E3942750(326,5-15): error X3511: unable to unroll loop, loop does not appear to terminate in a timely manner (561 iterations) or unrolled loop is too large, use the [unroll(n)] attribute to force an exact higher number

Additional information

  • Using Vulkan as backend it works perfectly.
  • Atmospheric_fog example runs without issues using dx12.
@GitGhillie GitGhillie added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Feb 1, 2025
@Elabajaba
Copy link
Contributor

Elabajaba commented Feb 2, 2025

The fix is to use DXC instead of FXC, because FXC is known to be broken, hasn't been developed for a very long time, and barely even supports DX12. Download from the releases here https://github.com/microsoft/DirectXShaderCompiler and put dxil.dll and dxcompiler.dll next to your exe (or in the root of your project works for when you're launching it with cargo for development). edit: The next wgpu upgrade will let you have statically compiled in DXC, which will simplify this further.

The example is still broken with DXC though, but at least it actually runs.

DX12
Image

Vulkan
Image

@alice-i-cecile alice-i-cecile added A-Rendering Drawing game state to the screen O-DX12 Specific to the DX12 render API C-Machine-Specific This bug is isolated to specific hardware or driver configurations S-Needs-Investigation This issue requires detective work to figure out what's going wrong and removed S-Needs-Triage This issue needs to be labelled labels Feb 2, 2025
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 C-Machine-Specific This bug is isolated to specific hardware or driver configurations O-DX12 Specific to the DX12 render API S-Needs-Investigation This issue requires detective work to figure out what's going wrong
Projects
None yet
Development

No branches or pull requests

3 participants