diff --git a/crates/bevy_pbr/src/prepass/prepass.wgsl b/crates/bevy_pbr/src/prepass/prepass.wgsl index f9b22fa15c9ee..48e607aa450ec 100644 --- a/crates/bevy_pbr/src/prepass/prepass.wgsl +++ b/crates/bevy_pbr/src/prepass/prepass.wgsl @@ -107,6 +107,12 @@ fn vertex(vertex_no_morph: Vertex) -> VertexOutput { // See https://github.com/gfx-rs/naga/issues/2416 out.instance_index = get_instance_index(vertex_no_morph.instance_index); #endif +#ifdef BASE_INSTANCE_WORKAROUND + // Hack: this ensures the push constant is always used, which works around this issue: + // https://github.com/bevyengine/bevy/issues/10509 + // This can be removed when wgpu 0.19 is released + out.position.x += min(f32(get_instance_index(0u)), 0.0); +#endif return out; } diff --git a/crates/bevy_pbr/src/render/mesh.wgsl b/crates/bevy_pbr/src/render/mesh.wgsl index 029c05a6ed5f2..e2a8041433c34 100644 --- a/crates/bevy_pbr/src/render/mesh.wgsl +++ b/crates/bevy_pbr/src/render/mesh.wgsl @@ -88,6 +88,13 @@ fn vertex(vertex_no_morph: Vertex) -> VertexOutput { out.instance_index = get_instance_index(vertex_no_morph.instance_index); #endif +#ifdef BASE_INSTANCE_WORKAROUND + // Hack: this ensures the push constant is always used, which works around this issue: + // https://github.com/bevyengine/bevy/issues/10509 + // This can be removed when wgpu 0.19 is released + out.position.x += min(f32(get_instance_index(0u)), 0.0); +#endif + return out; }