[Vulkan] Set proper aspect mask in depth uploads

This commit is contained in:
DrChat 2018-02-28 21:01:12 -06:00
parent 63a489d4c6
commit b2f1bf914a
1 changed files with 6 additions and 0 deletions

View File

@ -1272,6 +1272,12 @@ bool TextureCache::UploadTexture(VkCommandBuffer command_buffer,
// Now move the converted texture into the destination.
copy_region.bufferOffset = alloc->offset;
copy_region.imageOffset = {0, 0, 0};
if (dest->format == VK_FORMAT_D16_UNORM_S8_UINT ||
dest->format == VK_FORMAT_D24_UNORM_S8_UINT ||
dest->format == VK_FORMAT_D32_SFLOAT_S8_UINT) {
// Do just a depth upload (for now).
copy_region.imageSubresource.aspectMask = VK_IMAGE_ASPECT_DEPTH_BIT;
}
vkCmdCopyBufferToImage(command_buffer, staging_buffer_.gpu_buffer(),
dest->image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1,
&copy_region);