diff options
author | Stuart Carnie <stuart.carnie@gmail.com> | 2024-09-11 06:08:42 +1000 |
---|---|---|
committer | Stuart Carnie <stuart.carnie@gmail.com> | 2024-09-11 06:08:42 +1000 |
commit | 34190fc3609c073a81d069b67109232d8fbdf1b0 (patch) | |
tree | 5fd2852ce8d283bc31bcdef1b183f8eea6c6f43d | |
parent | 97ef3c837263099faf02d8ebafd6c77c94d2aaba (diff) | |
download | redot-engine-34190fc3609c073a81d069b67109232d8fbdf1b0.tar.gz |
Metal: fix out of bounds crash when using debug draw modes
-rw-r--r-- | drivers/metal/metal_objects.mm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/metal/metal_objects.mm b/drivers/metal/metal_objects.mm index abdcccf00c..d3c3d2b232 100644 --- a/drivers/metal/metal_objects.mm +++ b/drivers/metal/metal_objects.mm @@ -560,10 +560,10 @@ void MDCommandBuffer::_render_clear_render_area() { } } uint32_t ds_index = subpass.depth_stencil_reference.attachment; - MDAttachment const &attachment = pass.attachments[ds_index]; - bool shouldClearDepth = (ds_index != RDD::AttachmentReference::UNUSED && attachment.shouldClear(subpass, false)); - bool shouldClearStencil = (ds_index != RDD::AttachmentReference::UNUSED && attachment.shouldClear(subpass, true)); + bool shouldClearDepth = (ds_index != RDD::AttachmentReference::UNUSED && pass.attachments[ds_index].shouldClear(subpass, false)); + bool shouldClearStencil = (ds_index != RDD::AttachmentReference::UNUSED && pass.attachments[ds_index].shouldClear(subpass, true)); if (shouldClearDepth || shouldClearStencil) { + MDAttachment const &attachment = pass.attachments[ds_index]; BitField<RDD::TextureAspectBits> bits; if (shouldClearDepth && attachment.type & MDAttachmentType::Depth) { bits.set_flag(RDD::TEXTURE_ASPECT_DEPTH_BIT); |