Skip to content

Commit

Permalink
Vulkan: Fix wrong aspect flag used in image primer buffer copy job
Browse files Browse the repository at this point in the history
When accessing depth or stencil aspects on images with format that has
both depth and stencil bits, the aspect flag must specifies both bits.
  • Loading branch information
Qining committed Dec 13, 2018
1 parent a0d8f31 commit 92f262b
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions gapis/api/vulkan/image_primer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 92f262b

Please sign in to comment.