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:54:18 +0300
committerMichael Jones <michael_p_jones@apple.com>2022-02-10 20:06:29 +0300
commit35dedc11d5649352326af3701aef444b39bb6aa3 (patch)
tree4f58473a224c24ca2f0a6c2c930798cf5ba4ee42 /intern
parent3d12dd59ce1714e4e3e34d8d8f73de218050b2fb (diff)
Fix T95477: Report error instead of crashing when Metal texture size limits exceeded.
Reviewed By: brecht Differential Revision: https://developer.blender.org/D14074
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/device/metal/device_impl.mm9
1 files changed, 9 insertions, 0 deletions
diff --git a/intern/cycles/device/metal/device_impl.mm b/intern/cycles/device/metal/device_impl.mm
index 564c3c98759..251ba54e477 100644
--- a/intern/cycles/device/metal/device_impl.mm
+++ b/intern/cycles/device/metal/device_impl.mm
@@ -765,6 +765,15 @@ void MetalDevice::tex_alloc_as_buffer(device_texture &mem)
void MetalDevice::tex_alloc(device_texture &mem)
{
+ /* Check that dimensions fit within maximum allowable size.
+ See https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf
+ */
+ if (mem.data_width > 16384 ||
+ mem.data_height > 16384) {
+ set_error(string_printf("Texture exceeds maximum allowed size of 16384 x 16384 (requested: %zu x %zu)", mem.data_width, mem.data_height));
+ return;
+ }
+
MTLStorageMode storage_mode = MTLStorageModeManaged;
if (@available(macos 10.15, *)) {
if ([mtlDevice hasUnifiedMemory] &&