From: Conor McCarthy <cmccarthy(a)codeweavers.com> Based on code by Jan Sikorski. --- libs/vkd3d/resource.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index ea7b6859c..e8b249bf5 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -776,9 +776,11 @@ static HRESULT vkd3d_create_image(struct d3d12_device *device, const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; const struct vkd3d_format_compatibility_list *compat_list; const bool sparse_resource = !heap_properties; + VkSparseImageFormatProperties properties[2]; VkImageFormatListCreateInfoKHR format_list; const struct vkd3d_format *format; VkImageCreateInfo image_info; + uint32_t count; VkResult vr; if (resource) @@ -914,6 +916,20 @@ static HRESULT vkd3d_create_image(struct d3d12_device *device, if (resource && image_info.tiling == VK_IMAGE_TILING_LINEAR) resource->flags |= VKD3D_RESOURCE_LINEAR_TILING; + if (sparse_resource) + { + count = ARRAY_SIZE(properties); + VK_CALL(vkGetPhysicalDeviceSparseImageFormatProperties(device->vk_physical_device, image_info.format, + image_info.imageType, image_info.samples, image_info.usage, image_info.tiling, &count, properties)); + + if (!count) + { + FIXME("Sparse images are not supported with format %u, type %u, samples %u, usage %#x.\n", + image_info.format, image_info.imageType, image_info.samples, image_info.usage); + return E_INVALIDARG; + } + } + if ((vr = VK_CALL(vkCreateImage(device->vk_device, &image_info, NULL, vk_image))) < 0) WARN("Failed to create Vulkan image, vr %d.\n", vr); -- GitLab https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/221