From: Józef Kucia jkucia@codeweavers.com
The Vulkan spec states:
If sharingMode is VK_SHARING_MODE_CONCURRENT, queueFamilyIndexCount must be greater than 1.
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- 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 5bb76bf0c3e0..36e470bdd0d5 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;