Deferred rendering fails on WebKit WebGPU due to mixed integer/float color attachments
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
The deferred rendering pipeline creates a render pass with both integer and float color attachment formats:
| Attachment | Format | Type |
|------------|--------|------|
| Normal | `Rgba16Float` | Float |
| Motion vectors | `Rg16Float` | Float |
| Deferred G-buffer | `Rgba32Uint` | Integer |
| Lighting pass ID | `R8Uint` | Integer |
WebKit's WebGPU implementation requires all color attachments in a render pass to share the same type (all-integer or all-float). This causes a pipeline validation error when the deferred prepass attempts to bind these mixed formats together.
This was likely a similar issue to #12259, which was closed as S-Blocked. The issue remains in 0.18.1 — `DEFERRED_PREPASS_FORMAT` is still `Rgba32Uint` and `DEFERRED_LIGHTING_PASS_ID_FORMAT` is still `R8Uint` in `bevy_core_pipeline::deferred`.
The `meshlet` path has the same pattern (`meshlet_mesh_material.wgsl` writes `out.deferred_lighting_pass_id = 1u;`), so any fix would likely cover that codepath as well.
## Steps to Reproduce
1. Enable deferred rendering in a bevy application
2. Run on Safari (18+) or any WebKit-based browser with WebGPU
3. Pipeline creation fails with a validation error on the deferred prepass render pass
Chrome and Firefox do not currently enforce this constraint, so the same application works on those browsers.
## Affected Files
The format constants and their consumers span two crates:
- **`bevy_core_pipeline`**: `src/deferred/mod.rs` (format constants), `src/deferred/copy_lighting_id.rs` (bind group layout, texture sample type)
- **`bevy_pbr`**: `src/deferred/pbr_deferred_functions.wgsl` (G-buffer encode/decode), `src/deferred/deferred_lighting.wgsl` (G-buffer read), `src/prepass/prepass_io.wgsl` (FragmentOutput types), `src/prepass/prepass_bindings.rs` (bind group layout), `src/prepass/prepass.wgsl` (default deferred output), `src/render/mesh_view_bindings.wgsl` (texture declarations)
## Environment
- bevy 0.18.1
- Safari 18+ / WebKit WebGPU
- Affects any WebGPU implementation enforcing the all-integer-or-all-float color attachment constraint
Contributor guide
Assessment
This issue has not been assessed yet.