From 6eb014a3a8562c33fbae7acaa22583bd31ae48a9 Mon Sep 17 00:00:00 2001 From: Nicola Papale Date: Sat, 23 Sep 2023 11:58:18 +0200 Subject: [PATCH] Fix Dx12 naga codegen workaround --- crates/bevy_pbr/src/prepass/prepass.wgsl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/bevy_pbr/src/prepass/prepass.wgsl b/crates/bevy_pbr/src/prepass/prepass.wgsl index 8b4161d0d218ef..82e557343bd07f 100644 --- a/crates/bevy_pbr/src/prepass/prepass.wgsl +++ b/crates/bevy_pbr/src/prepass/prepass.wgsl @@ -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, #ifdef VERTEX_UVS @@ -93,13 +92,14 @@ fn morph_previous_position(vertex: Vertex) -> vec3 { #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