=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: vkd3d: Use VK_SHARING_MODE_CONCURRENT only when queue family count > 1.

Alexandre Julliard julliard at winehq.org
Mon May 6 15:33:45 CDT 2019


Module: vkd3d
Branch: master
Commit: 5259a89138b2b5053c5f215585842791ffc4af88
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=5259a89138b2b5053c5f215585842791ffc4af88

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Mon May  6 14:47:37 2019 +0200

vkd3d: Use VK_SHARING_MODE_CONCURRENT only when queue family count > 1.

The Vulkan spec states:

  If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount
  must be greater than 1.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/vkd3d/resource.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c
index 5bb76bf..36e470b 100644
--- a/libs/vkd3d/resource.c
+++ b/libs/vkd3d/resource.c
@@ -536,9 +536,18 @@ HRESULT vkd3d_create_buffer(struct d3d12_device *device,
         return E_INVALIDARG;
     }
 
-    buffer_info.sharingMode = VK_SHARING_MODE_CONCURRENT;
-    buffer_info.queueFamilyIndexCount = device->queue_family_count;
-    buffer_info.pQueueFamilyIndices = device->queue_family_indices;
+    if (device->queue_family_count > 1)
+    {
+        buffer_info.sharingMode = VK_SHARING_MODE_CONCURRENT;
+        buffer_info.queueFamilyIndexCount = device->queue_family_count;
+        buffer_info.pQueueFamilyIndices = device->queue_family_indices;
+    }
+    else
+    {
+        buffer_info.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
+        buffer_info.queueFamilyIndexCount = 0;
+        buffer_info.pQueueFamilyIndices = NULL;
+    }
 
     if ((vr = VK_CALL(vkCreateBuffer(device->vk_device, &buffer_info, NULL, vk_buffer))) < 0)
     {
@@ -626,7 +635,7 @@ static HRESULT vkd3d_create_image(struct d3d12_device *device,
     if (!(desc->Flags & D3D12_RESOURCE_FLAG_DENY_SHADER_RESOURCE))
         image_info.usage |= VK_IMAGE_USAGE_SAMPLED_BIT;
 
-    if (desc->Flags & D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS)
+    if ((desc->Flags & D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS) && device->queue_family_count > 1)
     {
         TRACE("Creating image with VK_SHARING_MODE_CONCURRENT.\n");
         image_info.sharingMode = VK_SHARING_MODE_CONCURRENT;




More information about the wine-cvs mailing list