Make the prepass shader compile when lightmaps are present. (#13402)

Commit 3f5a090b1b 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.
This commit is contained in:
Patrick Walton 2024-05-18 15:28:31 -07:00 committed by GitHub
parent a55e0e31e8
commit 846757cb38
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -18,16 +18,12 @@ fn prepass_alpha_discard(in: VertexOutput) {
var output_color: vec4<f32> = pbr_bindings::material.base_color;
#ifdef VERTEX_UVS
#ifdef VERTEX_UVS_A
var uv = in.uv;
#else
#ifdef STANDARD_MATERIAL_BASE_COLOR_UV_B
var uv = in.uv_b;
#endif
#ifdef VERTEX_UVS_B
if ((pbr_bindings::material.flags & pbr_types::STANDARD_MATERIAL_FLAGS_BASE_COLOR_UV_BIT) != 0u) {
uv = in.uv_b;
}
#endif
#else // STANDARD_MATERIAL_BASE_COLOR_UV_B
var uv = in.uv;
#endif // STANDARD_MATERIAL_BASE_COLOR_UV_B
let uv_transform = pbr_bindings::material.uv_transform;
uv = (uv_transform * vec3(uv, 1.0)).xy;
if (pbr_bindings::material.flags & pbr_types::STANDARD_MATERIAL_FLAGS_BASE_COLOR_TEXTURE_BIT) != 0u {