Skip to content

Commit

Permalink
Fix non-meshlet shaders for non-bindless mode (bevyengine#16966)
Browse files Browse the repository at this point in the history
# Objective

- Running example `load_gltf` when not using bindless gives this error
```
ERROR bevy_render::render_resource::pipeline_cache: failed to process shader:
error: no definition in scope for identifier: 'slot'
    ┌─ crates/bevy_pbr/src/render/pbr_fragment.wgsl:153:13
    │
153 │             slot,
    │             ^^^^ unknown identifier
    │
    = no definition in scope for identifier: 'slot'
```
- since bevyengine#16825

## Solution

- Set `slot` to the expected value when not mindless
- Also use it for `uv_b`

## Testing

- Run example `load_gltf` on a Mac or in wasm
  • Loading branch information
mockersf authored and ecoskey committed Jan 6, 2025
1 parent 2146b5d commit c60e1d0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/bevy_pbr/src/render/pbr_fragment.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ fn pbr_input_from_standard_material(
let base_color = pbr_bindings::material[slot].base_color;
let deferred_lighting_pass_id = pbr_bindings::material[slot].deferred_lighting_pass_id;
#else // BINDLESS
let slot = mesh[in.instance_index].material_and_lightmap_bind_group_slot & 0xffffu;
let flags = pbr_bindings::material.flags;
let base_color = pbr_bindings::material.base_color;
let deferred_lighting_pass_id = pbr_bindings::material.deferred_lighting_pass_id;
Expand Down Expand Up @@ -171,7 +172,7 @@ fn pbr_input_from_standard_material(
// parallax mapping algorithm easier to understand and reason
// about.
-Vt,
in.instance_index,
slot,
);
#else
uv_b = uv;
Expand Down

0 comments on commit c60e1d0

Please sign in to comment.