From c0a01ca6ad48b22cc73ccb72b0757d06b6a74b43 Mon Sep 17 00:00:00 2001 From: Inho Lee Date: Mon, 10 Mar 2025 13:03:23 +0100 Subject: [PATCH] rhi: vulkan: Support to read depth textures When reading back textures, VkImageAspect is just used as VK_IMAGE_ASPECT_COLOR_BIT and it doesn't work for depth/stencil formats. Change-Id: Ib356a0821f9de8e27eb2b9333714fe75971744a2 Reviewed-by: Laszlo Agocs --- src/gui/rhi/qrhivulkan.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index f94f27a79e1..c0ade70bf7a 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -4369,7 +4369,7 @@ void QRhiVulkan::enqueueResourceUpdates(QVkCommandBuffer *cbD, QRhiResourceUpdat // Copy from the (optimal and not host visible) image into the buffer. VkBufferImageCopy copyDesc = {}; copyDesc.bufferOffset = 0; - copyDesc.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + copyDesc.imageSubresource.aspectMask = aspectMaskForTextureFormat(readback.format); copyDesc.imageSubresource.mipLevel = uint32_t(u.rb.level()); copyDesc.imageSubresource.baseArrayLayer = is3D ? 0 : uint32_t(u.rb.layer()); copyDesc.imageSubresource.layerCount = 1;