From 4f184b3424aec25842ef77c7ff97ce5db830f5fc Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sun, 14 Feb 2021 03:42:40 +0100 Subject: [PATCH] [d3d9] Mark images as shared if necessary --- src/d3d9/d3d9_common_texture.cpp | 1 + src/d3d9/d3d9_common_texture.h | 1 + src/d3d9/d3d9_device.cpp | 7 +++++++ src/d3d9/d3d9_swapchain.cpp | 2 ++ 4 files changed, 11 insertions(+) diff --git a/src/d3d9/d3d9_common_texture.cpp b/src/d3d9/d3d9_common_texture.cpp index 14862fdc..b0ee9013 100644 --- a/src/d3d9/d3d9_common_texture.cpp +++ b/src/d3d9/d3d9_common_texture.cpp @@ -220,6 +220,7 @@ namespace dxvk { | VK_ACCESS_SHADER_READ_BIT; imageInfo.tiling = VK_IMAGE_TILING_OPTIMAL; imageInfo.layout = VK_IMAGE_LAYOUT_GENERAL; + imageInfo.shared = m_desc.IsBackBuffer; if (m_mapping.ConversionFormatInfo.FormatType != D3D9ConversionFormat_None) { imageInfo.usage |= VK_IMAGE_USAGE_STORAGE_BIT; diff --git a/src/d3d9/d3d9_common_texture.h b/src/d3d9/d3d9_common_texture.h index ea60b113..9ec487dc 100644 --- a/src/d3d9/d3d9_common_texture.h +++ b/src/d3d9/d3d9_common_texture.h @@ -42,6 +42,7 @@ namespace dxvk { BOOL Discard; D3DMULTISAMPLE_TYPE MultiSample; DWORD MultisampleQuality; + BOOL IsBackBuffer; }; struct D3D9ColorView { diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index 16874d4a..c344672d 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -393,6 +393,7 @@ namespace dxvk { desc.Discard = FALSE; desc.MultiSample = D3DMULTISAMPLE_NONE; desc.MultisampleQuality = 0; + desc.IsBackBuffer = FALSE; if (FAILED(D3D9CommonTexture::NormalizeTextureProperties(this, &desc))) return D3DERR_INVALIDCALL; @@ -447,6 +448,7 @@ namespace dxvk { desc.Discard = FALSE; desc.MultiSample = D3DMULTISAMPLE_NONE; desc.MultisampleQuality = 0; + desc.IsBackBuffer = FALSE; if (FAILED(D3D9CommonTexture::NormalizeTextureProperties(this, &desc))) return D3DERR_INVALIDCALL; @@ -491,6 +493,7 @@ namespace dxvk { desc.Discard = FALSE; desc.MultiSample = D3DMULTISAMPLE_NONE; desc.MultisampleQuality = 0; + desc.IsBackBuffer = FALSE; if (FAILED(D3D9CommonTexture::NormalizeTextureProperties(this, &desc))) return D3DERR_INVALIDCALL; @@ -3334,6 +3337,7 @@ namespace dxvk { desc.Discard = FALSE; desc.MultiSample = MultiSample; desc.MultisampleQuality = MultisampleQuality; + desc.IsBackBuffer = FALSE; if (FAILED(D3D9CommonTexture::NormalizeTextureProperties(this, &desc))) return D3DERR_INVALIDCALL; @@ -3377,6 +3381,7 @@ namespace dxvk { desc.Discard = FALSE; desc.MultiSample = D3DMULTISAMPLE_NONE; desc.MultisampleQuality = 0; + desc.IsBackBuffer = FALSE; if (FAILED(D3D9CommonTexture::NormalizeTextureProperties(this, &desc))) return D3DERR_INVALIDCALL; @@ -3422,6 +3427,7 @@ namespace dxvk { desc.Discard = Discard; desc.MultiSample = MultiSample; desc.MultisampleQuality = MultisampleQuality; + desc.IsBackBuffer = FALSE; if (FAILED(D3D9CommonTexture::NormalizeTextureProperties(this, &desc))) return D3DERR_INVALIDCALL; @@ -6898,6 +6904,7 @@ namespace dxvk { desc.Discard = FALSE; desc.MultiSample = pPresentationParameters->MultiSampleType; desc.MultisampleQuality = pPresentationParameters->MultiSampleQuality; + desc.IsBackBuffer = FALSE; if (FAILED(D3D9CommonTexture::NormalizeTextureProperties(this, &desc))) return D3DERR_NOTAVAILABLE; diff --git a/src/d3d9/d3d9_swapchain.cpp b/src/d3d9/d3d9_swapchain.cpp index 00051c23..c0ea5298 100644 --- a/src/d3d9/d3d9_swapchain.cpp +++ b/src/d3d9/d3d9_swapchain.cpp @@ -1012,6 +1012,7 @@ namespace dxvk { imageInfo.access = 0; imageInfo.tiling = VK_IMAGE_TILING_OPTIMAL; imageInfo.layout = VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + imageInfo.shared = VK_TRUE; DxvkImageViewCreateInfo viewInfo; viewInfo.type = VK_IMAGE_VIEW_TYPE_2D; @@ -1067,6 +1068,7 @@ namespace dxvk { desc.Pool = D3DPOOL_DEFAULT; desc.Usage = D3DUSAGE_RENDERTARGET; desc.Discard = FALSE; + desc.IsBackBuffer = TRUE; for (uint32_t i = 0; i < m_backBuffers.size(); i++) m_backBuffers[i] = new D3D9Surface(m_parent, &desc, this);