From 92f262b4e764c564eb4583eba44d070d8f38c55d Mon Sep 17 00:00:00 2001 From: Qining Lu Date: Thu, 13 Dec 2018 15:23:13 -0500 Subject: [PATCH] Vulkan: Fix wrong aspect flag used in image primer buffer copy job When accessing depth or stencil aspects on images with format that has both depth and stencil bits, the aspect flag must specifies both bits. --- gapis/api/vulkan/image_primer.go | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/gapis/api/vulkan/image_primer.go b/gapis/api/vulkan/image_primer.go index 3003233050..631ac11a18 100644 --- a/gapis/api/vulkan/image_primer.go +++ b/gapis/api/vulkan/image_primer.go @@ -1541,20 +1541,22 @@ func (h *ipRenderHandler) render(job *ipRenderJob, tsk *scratchTask) error { default: return log.Errf(h.sb.ctx, nil, "invalid aspect: %v to render", job.renderTarget.aspect) } - tsk.recordCmdBufCommand(func(commandBuffer VkCommandBuffer) { - h.sb.write(h.sb.cb.VkCmdPipelineBarrier( - commandBuffer, - VkPipelineStageFlags(VkPipelineStageFlagBits_VK_PIPELINE_STAGE_ALL_COMMANDS_BIT), - VkPipelineStageFlags(VkPipelineStageFlagBits_VK_PIPELINE_STAGE_ALL_COMMANDS_BIT), - VkDependencyFlags(0), - 0, - memory.Nullptr, - 0, - memory.Nullptr, - uint32(len(dstBarriers)), - h.sb.MustAllocReadData(dstBarriers).Ptr(), - )) - }) + if len(dstBarriers) > 0 { + tsk.recordCmdBufCommand(func(commandBuffer VkCommandBuffer) { + h.sb.write(h.sb.cb.VkCmdPipelineBarrier( + commandBuffer, + VkPipelineStageFlags(VkPipelineStageFlagBits_VK_PIPELINE_STAGE_ALL_COMMANDS_BIT), + VkPipelineStageFlags(VkPipelineStageFlagBits_VK_PIPELINE_STAGE_ALL_COMMANDS_BIT), + VkDependencyFlags(0), + 0, + memory.Nullptr, + 0, + memory.Nullptr, + uint32(len(dstBarriers)), + h.sb.MustAllocReadData(dstBarriers).Ptr(), + )) + }) + } return nil } @@ -2351,7 +2353,7 @@ func (h *ipBufferCopySession) rolloutBufCopies(queue VkQueue) error { queueFamilyIgnore, // dstQueueFamilyIndex dstImg.VulkanHandle(), // image NewVkImageSubresourceRange(h.sb.ta, // subresourceRange - VkImageAspectFlags(aspect), // aspectMask + ipImageBarrierAspectFlags(aspect, dstImg.Info().Fmt()), // aspectMask level, // baseMipLevel 1, // levelCount layer, // baseArrayLayer