From 2606c0cde149534e338bb5927291e45d101fd9a2 Mon Sep 17 00:00:00 2001 From: Christopher Biscardi Date: Thu, 2 Nov 2023 17:54:13 -0700 Subject: [PATCH] Make VERTEX_COLORS usable in prepass shader, if available (#10341) # Objective I was working with forward rendering prepass fragment shaders and ran into an issue of not being able to access vertex colors in the prepass. I was able to access vertex colors in regular fragment shaders as well as in deferred shaders. ## Solution It seems like this `if` was nested unintentionally as moving it outside of the `deferred` block works. --- ## Changelog Enable vertex colors in forward rendering prepass fragment shaders --- crates/bevy_pbr/src/prepass/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/bevy_pbr/src/prepass/mod.rs b/crates/bevy_pbr/src/prepass/mod.rs index 00e9e4f2f3b399..2235457d5164e8 100644 --- a/crates/bevy_pbr/src/prepass/mod.rs +++ b/crates/bevy_pbr/src/prepass/mod.rs @@ -431,11 +431,11 @@ where if key.mesh_key.contains(MeshPipelineKey::DEFERRED_PREPASS) { shader_defs.push("DEFERRED_PREPASS".into()); + } - if layout.contains(Mesh::ATTRIBUTE_COLOR) { - shader_defs.push("VERTEX_COLORS".into()); - vertex_attributes.push(Mesh::ATTRIBUTE_COLOR.at_shader_location(6)); - } + if layout.contains(Mesh::ATTRIBUTE_COLOR) { + shader_defs.push("VERTEX_COLORS".into()); + vertex_attributes.push(Mesh::ATTRIBUTE_COLOR.at_shader_location(6)); } if key