Skip to content

Commit 846757c

Browse files
authored
Make the prepass shader compile when lightmaps are present. (#13402)
Commit 3f5a090 added a reference to `STANDARD_MATERIAL_FLAGS_BASE_COLOR_UV_BIT`, a nonexistent identifier, in the alpha discard portion of the prepass shader. Moreover, the logic didn't make sense to me. I think the code was trying to choose between the two UV sets depending on which is present, so I made it do that. I noticed this when trying Bistro with #13277. I'm not sure why this issue didn't manifest itself before, but it's clearly a bug, so here's a fix. We should probably merge this before 0.14.
1 parent a55e0e3 commit 846757c

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

crates/bevy_pbr/src/render/pbr_prepass_functions.wgsl

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,12 @@ fn prepass_alpha_discard(in: VertexOutput) {
1818
var output_color: vec4<f32> = pbr_bindings::material.base_color;
1919

2020
#ifdef VERTEX_UVS
21-
#ifdef VERTEX_UVS_A
22-
var uv = in.uv;
23-
#else
21+
#ifdef STANDARD_MATERIAL_BASE_COLOR_UV_B
2422
var uv = in.uv_b;
25-
#endif
26-
#ifdef VERTEX_UVS_B
27-
if ((pbr_bindings::material.flags & pbr_types::STANDARD_MATERIAL_FLAGS_BASE_COLOR_UV_BIT) != 0u) {
28-
uv = in.uv_b;
29-
}
30-
#endif
23+
#else // STANDARD_MATERIAL_BASE_COLOR_UV_B
24+
var uv = in.uv;
25+
#endif // STANDARD_MATERIAL_BASE_COLOR_UV_B
26+
3127
let uv_transform = pbr_bindings::material.uv_transform;
3228
uv = (uv_transform * vec3(uv, 1.0)).xy;
3329
if (pbr_bindings::material.flags & pbr_types::STANDARD_MATERIAL_FLAGS_BASE_COLOR_TEXTURE_BIT) != 0u {

0 commit comments

Comments
 (0)