Fix: Metal parallel shader compilation does not respect -t option

This command line option to control the number of threads was already taken
into account for OpenGL and Vulkan.
This commit is contained in:
Brecht Van Lommel
2025-05-30 17:31:47 +02:00
parent 045926a305
commit becc2fa9cb

View File

@@ -8,6 +8,8 @@
#include <cstring>
#include "BLI_threads.h"
#include "BKE_global.hh"
#include "gpu_backend.hh"
@@ -523,8 +525,10 @@ void MTLBackend::capabilities_init(MTLContext *ctx)
GCaps.geometry_shader_support = false;
/* Compile shaders on performance cores but leave one free so UI is still responsive */
GCaps.max_parallel_compilations = MTLBackend::capabilities.num_performance_cores - 1;
/* Compile shaders on performance cores but leave one free so UI is still responsive.
* Also respect command line option to reduce number of threads. */
GCaps.max_parallel_compilations = std::min(BLI_system_thread_count(),
MTLBackend::capabilities.num_performance_cores - 1);
/* Maximum buffer bindings: 31. Consider required slot for uniforms/UBOs/Vertex attributes.
* Can use argument buffers if a higher limit is required. */