Fix #122551: Metal displays black screen on ATI/Intel GPUs

When using Metal backend on ATI/Intel GPUs the stencil buffer doesn't
contain the correct information, skipping diffuse and glossy PBR components.

Failing behavior was introduced by e97e06ea2c
This PR works around this by reverting the code when using ATI/Intel GPUs.
The root cause is somewhere the combination of stencil export support, clear
operations and subpass.

**TODO**

- [ ] Validate that this fixes the ATI issue as well

Pull Request: https://projects.blender.org/blender/blender/pulls/122993
This commit is contained in:
Jeroen Bakker
2024-06-11 07:58:03 +02:00
parent 38df2148f5
commit 7a8e04fcb1

View File

@@ -161,6 +161,15 @@ struct GBuffer {
header_tx.clear(uint4(0));
}
/* Workaround a Metal bug that is only showing up on ATI/Intel GPUs. */
if (GPU_type_matches(
GPU_DEVICE_ATI | GPU_DEVICE_INTEL | GPU_DEVICE_INTEL_UHD, GPU_OS_MAC, GPU_DRIVER_ANY))
{
header_tx.clear(uint4(0));
GPU_framebuffer_bind(gbuffer_fb);
return;
}
if (!GPU_stencil_export_support()) {
/* Clearing custom load-store frame-buffers is invalid,
* clear the stencil as a regular frame-buffer first. */