From: Conor McCarthy Subject: [PATCH vkd3d 3/5] vkd3d: Add 2D multisampled null resources. Message-Id: <20191210145708.24068-4-cmccarthy@codeweavers.com> Date: Wed, 11 Dec 2019 00:57:06 +1000 In-Reply-To: <20191210145708.24068-1-cmccarthy@codeweavers.com> References: <20191210145708.24068-1-cmccarthy@codeweavers.com> Signed-off-by: Conor McCarthy --- libs/vkd3d/resource.c | 25 +++++++++++++++++++++++++ libs/vkd3d/vkd3d_private.h | 3 +++ 2 files changed, 28 insertions(+) diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index 271b881..3ca29a2 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -2604,6 +2604,15 @@ static void vkd3d_create_null_srv(struct d3d12_desc *descriptor, vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_2D_ARRAY; break; + case D3D12_SRV_DIMENSION_TEXTURE2DMS: + vk_image = null_resources->vk_2dms_image; + vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_2D; + break; + case D3D12_SRV_DIMENSION_TEXTURE2DMSARRAY: + vk_image = null_resources->vk_2dms_image; + vkd3d_desc.view_type = VK_IMAGE_VIEW_TYPE_2D_ARRAY; + break; + default: FIXME("Unhandled view dimension %#x.\n", desc->ViewDimension); return; @@ -3937,6 +3946,10 @@ static HRESULT vkd3d_init_null_resources_data(struct vkd3d_null_resources *null_ vkd3d_transition_null_image(vk_command_buffer, null_resource->vk_2d_image, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, vk_procs); + /* transition 2DMS SRV image */ + vkd3d_transition_null_image(vk_command_buffer, null_resource->vk_2dms_image, + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, vk_procs); + if ((vr = VK_CALL(vkEndCommandBuffer(vk_command_buffer))) < 0) { WARN("Failed to end command buffer, vr %d.\n", vr); @@ -4111,6 +4124,11 @@ HRESULT vkd3d_init_null_resources(struct vkd3d_null_resources *null_resources, &null_resources->vk_2d_image, &null_resources->vk_2d_image_memory))) goto fail; + /* 2DMS SRV */ + if (FAILED(hr = vkd3d_create_null_sr_texture(device, D3D12_RESOURCE_DIMENSION_TEXTURE2D, 1, true, + &null_resources->vk_2dms_image, &null_resources->vk_2dms_image_memory))) + goto fail; + /* 2D UAV */ if (FAILED(hr = vkd3d_create_null_ua_texture(device, D3D12_RESOURCE_DIMENSION_TEXTURE2D, &null_resources->vk_2d_storage_image, &null_resources->vk_2d_storage_image_memory))) @@ -4133,6 +4151,10 @@ HRESULT vkd3d_init_null_resources(struct vkd3d_null_resources *null_resources, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, "NULL 2D SRV image"); vkd3d_set_vk_object_name_utf8(device, (uint64_t)null_resources->vk_2d_image_memory, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, "NULL 2D SRV memory"); + vkd3d_set_vk_object_name_utf8(device, (uint64_t)null_resources->vk_2dms_image, + VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, "NULL 2DMS SRV image"); + vkd3d_set_vk_object_name_utf8(device, (uint64_t)null_resources->vk_2dms_image_memory, + VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT, "NULL 2DMS SRV memory"); vkd3d_set_vk_object_name_utf8(device, (uint64_t)null_resources->vk_2d_storage_image, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, "NULL 2D UAV image"); if (!use_sparse_resources) @@ -4171,6 +4193,9 @@ void vkd3d_destroy_null_resources(struct vkd3d_null_resources *null_resources, VK_CALL(vkDestroyImage(device->vk_device, null_resources->vk_2d_image, NULL)); VK_CALL(vkFreeMemory(device->vk_device, null_resources->vk_2d_image_memory, NULL)); + VK_CALL(vkDestroyImage(device->vk_device, null_resources->vk_2dms_image, NULL)); + VK_CALL(vkFreeMemory(device->vk_device, null_resources->vk_2dms_image_memory, NULL)); + VK_CALL(vkDestroyImage(device->vk_device, null_resources->vk_2d_storage_image, NULL)); VK_CALL(vkFreeMemory(device->vk_device, null_resources->vk_2d_storage_image_memory, NULL)); diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index c23667d..58a9ce0 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -1068,6 +1068,9 @@ struct vkd3d_null_resources VkImage vk_2d_storage_image; VkDeviceMemory vk_2d_storage_image_memory; + + VkImage vk_2dms_image; + VkDeviceMemory vk_2dms_image_memory; }; HRESULT vkd3d_init_null_resources(struct vkd3d_null_resources *null_resources, -- 2.24.0