Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorMichael Jones <michael_p_jones@apple.com>2022-02-10 13:57:28 +0300
committerMichael Jones <michael_p_jones@apple.com>2022-02-10 20:05:13 +0300
commit3d12dd59ce1714e4e3e34d8d8f73de218050b2fb (patch)
tree0578452052696227c99152577006c7017c0c8c11 /intern
parent410e4e7ce1823aa15d51ee231eedc63cdf72c8e3 (diff)
Cycles: Workaround for failing "bake" unit tests in Metal
Allocate "RenderBuffers" with MTLResourceStorageModeShared. Reviewed By: brecht Differential Revision: https://developer.blender.org/D14073
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/device/metal/device_impl.mm10
1 files changed, 8 insertions, 2 deletions
diff --git a/intern/cycles/device/metal/device_impl.mm b/intern/cycles/device/metal/device_impl.mm
index 17acb2c94e4..564c3c98759 100644
--- a/intern/cycles/device/metal/device_impl.mm
+++ b/intern/cycles/device/metal/device_impl.mm
@@ -455,8 +455,14 @@ MetalDevice::MetalMem *MetalDevice::generic_alloc(device_memory &mem)
mem.device_pointer = 0;
id<MTLBuffer> metal_buffer = nil;
+ MTLResourceOptions options = default_storage_mode;
+
+ /* Workaround for "bake" unit tests which fail if RenderBuffers is allocated with MTLResourceStorageModeShared. */
+ if (strstr(mem.name, "RenderBuffers")) {
+ options = MTLResourceStorageModeManaged;
+ }
+
if (size > 0) {
- MTLResourceOptions options = default_storage_mode;
if (mem.type == MEM_DEVICE_ONLY) {
options = MTLResourceStorageModePrivate;
}
@@ -490,7 +496,7 @@ MetalDevice::MetalMem *MetalDevice::generic_alloc(device_memory &mem)
mmem->mtlBuffer = metal_buffer;
mmem->offset = 0;
mmem->size = size;
- if (mem.type != MEM_DEVICE_ONLY) {
+ if (options != MTLResourceStorageModePrivate) {
mmem->hostPtr = [metal_buffer contents];
}
else {