Skip to content

Commit

Permalink
Make VERTEX_COLORS usable in prepass shader, if available (#10341)
Browse files Browse the repository at this point in the history
# 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
  • Loading branch information
ChristopherBiscardi authored Nov 3, 2023
1 parent 09c2090 commit 74b5073
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/bevy_pbr/src/prepass/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 74b5073

Please sign in to comment.