Skip to content

Commit

Permalink
Fix Dx12 naga codegen workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
nicopap committed Sep 27, 2023
1 parent 56e802f commit 6eb014a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions crates/bevy_pbr/src/prepass/prepass.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// Most of these attributes are not used in the default prepass fragment shader, but they are still needed so we can
// pass them to custom prepass shaders like pbr_prepass.wgsl.
struct Vertex {
@builtin(instance_index) instance_index: u32,
@location(0) position: vec3<f32>,

#ifdef VERTEX_UVS
Expand Down Expand Up @@ -93,13 +92,14 @@ fn morph_previous_position(vertex: Vertex) -> vec3<f32> {
#endif

@vertex
fn vertex(vertex_no_morph: Vertex) -> VertexOutput {
fn vertex(
vertex_no_morph: Vertex,
// Separate the instance_index from the `Vertex` struct to avoid
// hitting https://github.com/gfx-rs/naga/issues/2416
@builtin(instance_index) vertex_instance: u32,
) -> VertexOutput {
var out: VertexOutput;

// Use vertex_no_morph.instance_index instead of vertex.instance_index to work around a wgpu dx12 bug.
// See https://github.com/gfx-rs/naga/issues/2416
let vertex_instance = vertex_no_morph.instance_index;

#ifdef MORPH_TARGETS
var vertex = morph_vertex(vertex_no_morph);
#else
Expand Down

0 comments on commit 6eb014a

Please sign in to comment.