From 2aa7c6b753aa184575da3ca1a0fab009b90d7021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Fri, 25 Jan 2019 14:52:52 +0100 Subject: [PATCH] vkd3d: Avoid passing 0 miplevels to Vulkan. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- libs/vkd3d/resource.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index 75a5201b..6eba4504 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -623,12 +623,20 @@ HRESULT vkd3d_get_image_allocation_info(struct d3d12_device *device, { static const D3D12_HEAP_PROPERTIES heap_properties = {D3D12_HEAP_TYPE_DEFAULT}; const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; + D3D12_RESOURCE_DESC validated_desc; VkMemoryRequirements requirements; VkImage vk_image; HRESULT hr; assert(desc->Dimension != D3D12_RESOURCE_DIMENSION_BUFFER); + if (!desc->MipLevels) + { + validated_desc = *desc; + validated_desc.MipLevels = max_miplevel_count(desc); + desc = &validated_desc; + } + /* XXX: We have to create an image to get its memory requirements. */ if (SUCCEEDED(hr = vkd3d_create_image(device, &heap_properties, 0, desc, &vk_image))) {