Fix: EEVEE-Next: Lights do not render with Metal

Related to #116128. This is just a workaround and
not a full fix. There seem to be something bad in
the backend.
This commit is contained in:
Clément Foucault
2023-12-20 14:29:39 +13:00
parent efbee2d606
commit ad6e68d12f

View File

@@ -574,7 +574,17 @@ void DeferredLayer::end_sync()
inst_.sampling.bind_resources(sub);
inst_.hiz_buffer.bind_resources(sub);
sub.state_stencil(0xFFu, 1u << i, 0xFFu);
sub.draw_procedural(GPU_PRIM_TRIS, 1, 3);
if (GPU_backend_get_type() == GPU_BACKEND_METAL) {
/* WORKAROUND: On Apple silicon the stencil test is broken. Only issue one expensive
* lighting evaluation. */
if (i == 2) {
sub.state_set(DRW_STATE_WRITE_STENCIL | DRW_STATE_DEPTH_GREATER);
sub.draw_procedural(GPU_PRIM_TRIS, 1, 3);
}
}
else {
sub.draw_procedural(GPU_PRIM_TRIS, 1, 3);
}
}
}
}