Merge pull request #96822 from stuartcarnie/sgc/metal_out_of_bounds

Metal: Fix out of bounds crash when using debug draw modes
This commit is contained in:
Rémi Verschelde 2024-09-11 12:35:20 +02:00
commit 62717f2953
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -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);