From ae4a5232aa198a2bae884453a8fe53a6bd9fd15b Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 19 Sep 2019 18:22:04 +0200 Subject: [PATCH] [d3d11] Use VK_IMAGE_LAYOUT_PREINITIALIZED for mapped images This way we can directly write image data directly to the image without having to do it on the GPU. --- src/d3d11/d3d11_texture.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/d3d11/d3d11_texture.cpp b/src/d3d11/d3d11_texture.cpp index 45839c6c..1cddcc7d 100644 --- a/src/d3d11/d3d11_texture.cpp +++ b/src/d3d11/d3d11_texture.cpp @@ -29,6 +29,7 @@ namespace dxvk { | VK_ACCESS_TRANSFER_WRITE_BIT; imageInfo.tiling = VK_IMAGE_TILING_OPTIMAL; imageInfo.layout = VK_IMAGE_LAYOUT_GENERAL; + imageInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; DecodeSampleCount(m_desc.SampleDesc.Count, &imageInfo.sampleCount); @@ -126,8 +127,9 @@ namespace dxvk { // to enable linear tiling, and DXVK needs to be aware that // the image can be accessed by the host. if (m_mapMode == D3D11_COMMON_TEXTURE_MAP_MODE_DIRECT) { - imageInfo.stages |= VK_PIPELINE_STAGE_HOST_BIT; - imageInfo.tiling = VK_IMAGE_TILING_LINEAR; + imageInfo.stages |= VK_PIPELINE_STAGE_HOST_BIT; + imageInfo.tiling = VK_IMAGE_TILING_LINEAR; + imageInfo.initialLayout = VK_IMAGE_LAYOUT_PREINITIALIZED; if (m_desc.CPUAccessFlags & D3D11_CPU_ACCESS_WRITE) imageInfo.access |= VK_ACCESS_HOST_WRITE_BIT;