From 2db12cc0494f35df6fc5ea398f81ea2719a71465 Mon Sep 17 00:00:00 2001 From: Jason Fielder Date: Thu, 14 Dec 2023 08:09:03 +0100 Subject: [PATCH] Fix #116121: Resolve framebuffer resize issue in Metal Changing size of framebuffer attachments would throw an assertion as framebuffer size was not correctly reset to zero. Zero allows any size to override the current if there are no set attachments. Authored by Apple: Michael Parkin-White Pull Request: https://projects.blender.org/blender/blender/pulls/116162 --- source/blender/gpu/metal/mtl_framebuffer.mm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/blender/gpu/metal/mtl_framebuffer.mm b/source/blender/gpu/metal/mtl_framebuffer.mm index 011cce56c0a..8eb55792f59 100644 --- a/source/blender/gpu/metal/mtl_framebuffer.mm +++ b/source/blender/gpu/metal/mtl_framebuffer.mm @@ -1242,9 +1242,8 @@ void MTLFrameBuffer::ensure_render_target_size() if (colour_attachment_count_ == 0 && !this->has_depth_attachment() && !this->has_stencil_attachment()) { - /* Reset default size for empty framebuffer. */ - this->default_size_set(width_, height_); + this->default_size_set(0, 0); } } @@ -1786,7 +1785,7 @@ MTLRenderPassDescriptor *MTLFrameBuffer::bake_render_pass_descriptor(bool load_c } /* Attachmentless render support. */ - int total_num_attachments = colour_attachments + (mtl_depth_attachment_.used ? 1 : 0) + + int total_num_attachments = colour_attachment_count_ + (mtl_depth_attachment_.used ? 1 : 0) + (mtl_stencil_attachment_.used ? 1 : 0); if (total_num_attachments == 0) { BLI_assert(width_ > 0 && height_ > 0);