Skip to content

Commit

Permalink
Merge pull request #16200 from unknownbrackets/vulkan-depth
Browse files Browse the repository at this point in the history
Vulkan: Fix initial depth copy w/o existing depth
  • Loading branch information
hrydgard authored Oct 11, 2022
2 parents 5318452 + 26fd063 commit 8b2e7d6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Common/GPU/Vulkan/VulkanQueueRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1728,6 +1728,10 @@ void VulkanQueueRunner::PerformCopy(const VKRStep &step, VkCommandBuffer cmd) {

// We can't copy only depth or only stencil unfortunately - or can we?.
if (step.copy.aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
_dbg_assert_(src->depth.image != VK_NULL_HANDLE);

dst->EnsureDepthImage(cmd);

if (src->depth.layout != VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL) {
SetupTransitionToTransferSrc(src->depth, VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT, &recordBarrier_);
}
Expand Down Expand Up @@ -1993,6 +1997,7 @@ void VulkanQueueRunner::PerformReadback(const VKRStep &step, VkCommandBuffer cmd
srcImage = &step.readback.src->color;
} else if (step.readback.aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
srcImage = &step.readback.src->depth;
_dbg_assert_(srcImage->image != VK_NULL_HANDLE);
} else {
_dbg_assert_msg_(false, "No image aspect to readback?");
return;
Expand Down

0 comments on commit 8b2e7d6

Please sign in to comment.