Metal: Add support to force workarounds.

Recently it came to out attention that macOs13 doesn't always work due
to texture atomics not supported by that version of the OS.

Development happens most of the time on newer versions of the OS without
ability to check if it still works on the older versions.

This PR enables to disable some Metal capabilities to better check how
Blender works on those OS's. The capabilities that will be disabled
are texture gathering and texture atomics. It doesn't disable the
capabilities that are required to start Blender, which are still
part of the `MTLCapabilities` struct.

This allows us to reproduce issues like #129571

Pull Request: https://projects.blender.org/blender/blender/pulls/133636
This commit is contained in:
Jeroen Bakker
2025-01-27 11:07:20 +01:00
parent 94b916a3ba
commit efff379ea5

View File

@@ -527,6 +527,17 @@ void MTLBackend::capabilities_init(MTLContext *ctx)
/* Minimum per-vertex stride is 4 bytes in Metal.
* A bound vertex buffer must contribute at least 4 bytes per vertex. */
GCaps.minimum_per_vertex_stride = 4;
/* Force workarounds when starting blender with `--debug-gpu-force-workarounds`.
*
* Not all workarounds are listed here as some capabilities are currently assumed to be present
* on all devices. */
if (G.debug & G_DEBUG_GPU_FORCE_WORKAROUNDS) {
/* Texture gather is supported on AMD, but results are non consistent with Apple Silicon GPUs
* and can be disabled. */
MTLBackend::capabilities.supports_texture_gather = false;
MTLBackend::capabilities.supports_texture_atomics = false;
}
}
/** \} */