Fix crash with imageless framebuffers

This commit is contained in:
baldurk
2021-01-06 16:58:43 +00:00
parent 6756189324
commit d11c92d440
3 changed files with 10 additions and 6 deletions
+4 -3
View File
@@ -3564,9 +3564,10 @@ FramebufferInfo::~FramebufferInfo()
delete[] imageAttachments;
}
bool FramebufferInfo::AttachmentFullyReferenced(size_t attachmentIndex, const RenderPassInfo *rpi)
bool FramebufferInfo::AttachmentFullyReferenced(size_t attachmentIndex, VkResourceRecord *att,
VkImageSubresourceRange viewRange,
const RenderPassInfo *rpi)
{
VkResourceRecord *att = imageAttachments[attachmentIndex].record;
// if framebuffer doesn't reference the entire image
if(att->resInfo->imageInfo.extent.width != width || att->resInfo->imageInfo.extent.height != height)
{
@@ -3586,7 +3587,7 @@ bool FramebufferInfo::AttachmentFullyReferenced(size_t attachmentIndex, const Re
uint32_t renderpass_viewmask = rpi->multiviewViewMaskTable[attachmentIndex];
return (int)Bits::CountOnes(renderpass_viewmask) == att->resInfo->imageInfo.layerCount;
}
return imageAttachments[attachmentIndex].barrier.subresourceRange.layerCount == layers;
return viewRange.layerCount == layers;
}
int ImgRefs::GetAspectCount() const
+2 -1
View File
@@ -1161,7 +1161,8 @@ struct FramebufferInfo
FramebufferInfo(const VkFramebufferCreateInfo &ci);
~FramebufferInfo();
bool AttachmentFullyReferenced(size_t attachmentIndex, const RenderPassInfo *rpi);
bool AttachmentFullyReferenced(size_t attachmentIndex, VkResourceRecord *attachment,
VkImageSubresourceRange viewRange, const RenderPassInfo *rpi);
AttachmentInfo *imageAttachments;
@@ -1624,7 +1624,8 @@ void WrappedVulkan::vkCmdBeginRenderPass(VkCommandBuffer commandBuffer,
if(att == NULL)
break;
bool framebuffer_reference_entire_attachment = fbInfo->AttachmentFullyReferenced(i, rpInfo);
bool framebuffer_reference_entire_attachment =
fbInfo->AttachmentFullyReferenced(i, att, att->viewRange, rpInfo);
FrameRefType refType = eFrameRef_ReadBeforeWrite;
@@ -2232,7 +2233,8 @@ void WrappedVulkan::vkCmdBeginRenderPass2(VkCommandBuffer commandBuffer,
if(att == NULL)
break;
bool framebuffer_reference_entire_attachment = fbInfo->AttachmentFullyReferenced(i, rpInfo);
bool framebuffer_reference_entire_attachment =
fbInfo->AttachmentFullyReferenced(i, att, att->viewRange, rpInfo);
FrameRefType refType = eFrameRef_ReadBeforeWrite;