diff --git a/src/vulkan/vulkan-staging-texture.cpp b/src/vulkan/vulkan-staging-texture.cpp index 57569f7..c49ebde 100644 --- a/src/vulkan/vulkan-staging-texture.cpp +++ b/src/vulkan/vulkan-staging-texture.cpp @@ -176,11 +176,7 @@ namespace nvrhi::vulkan auto resolvedSrcSlice = srcSlice.resolve(src->desc); assert(resolvedDstSlice.depth == 1); - - vk::Extent3D srcMipSize = src->imageInfo.extent; - srcMipSize.width = std::max(srcMipSize.width >> resolvedDstSlice.mipLevel, 1u); - srcMipSize.height = std::max(srcMipSize.height >> resolvedDstSlice.mipLevel, 1u); - + auto dstRegion = dst->getSliceRegion(resolvedDstSlice.mipLevel, resolvedDstSlice.arraySlice, resolvedDstSlice.z); assert((dstRegion.offset & 0x3) == 0); // per Vulkan spec @@ -199,7 +195,7 @@ namespace nvrhi::vulkan .setBaseArrayLayer(resolvedSrcSlice.arraySlice) .setLayerCount(1)) .setImageOffset(vk::Offset3D(resolvedSrcSlice.x, resolvedSrcSlice.y, resolvedSrcSlice.z)) - .setImageExtent(srcMipSize); + .setImageExtent(vk::Extent3D(resolvedSrcSlice.width, resolvedSrcSlice.height, resolvedSrcSlice.depth)); assert(m_CurrentCmdBuf); @@ -225,11 +221,7 @@ namespace nvrhi::vulkan auto resolvedDstSlice = dstSlice.resolve(dst->desc); auto resolvedSrcSlice = srcSlice.resolve(src->desc); - - vk::Extent3D dstMipSize = dst->imageInfo.extent; - dstMipSize.width = std::max(dstMipSize.width >> resolvedDstSlice.mipLevel, 1u); - dstMipSize.height = std::max(dstMipSize.height >> resolvedDstSlice.mipLevel, 1u); - + auto srcRegion = src->getSliceRegion(resolvedSrcSlice.mipLevel, resolvedSrcSlice.arraySlice, resolvedSrcSlice.z); assert((srcRegion.offset & 0x3) == 0); // per vulkan spec @@ -252,7 +244,7 @@ namespace nvrhi::vulkan .setBaseArrayLayer(resolvedDstSlice.arraySlice) .setLayerCount(1)) .setImageOffset(dstOffset) - .setImageExtent(dstMipSize); + .setImageExtent(vk::Extent3D(resolvedDstSlice.width, resolvedDstSlice.height, resolvedDstSlice.depth)); assert(m_CurrentCmdBuf);