From 0914561f8504211ccd2f24c1fa6f7cb80c19ed22 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 26 Feb 2024 18:19:36 +0100 Subject: [PATCH] vkd3d: Store a D3D12_RESOURCE_DESC structure in struct vkd3d_image_resource_create_info. Like we did before commit 6d4782ed7f7e06cff31313c3170ea5e6bc281254. That commit somehow managed to change the "desc" field from D3D12_RESOURCE_DESC to D3D12_RESOURCE_DESC1, but that breaks the ABI. --- include/vkd3d.h | 2 +- libs/vkd3d/device.c | 8 -------- libs/vkd3d/resource.c | 4 ++-- libs/vkd3d/vkd3d_private.h | 8 ++++++++ 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/vkd3d.h b/include/vkd3d.h index 79c04230..a3bb8e0d 100644 --- a/include/vkd3d.h +++ b/include/vkd3d.h @@ -182,7 +182,7 @@ struct vkd3d_image_resource_create_info const void *next; VkImage vk_image; - D3D12_RESOURCE_DESC1 desc; + D3D12_RESOURCE_DESC desc; unsigned int flags; D3D12_RESOURCE_STATES present_state; }; diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 0f45b68f..17c7ccb3 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -3733,14 +3733,6 @@ static void STDMETHODCALLTYPE d3d12_device_CopyDescriptorsSimple(ID3D12Device7 * 1, &src_descriptor_range_offset, &descriptor_count, descriptor_heap_type); } -static void d3d12_resource_desc1_from_desc(D3D12_RESOURCE_DESC1 *desc1, const D3D12_RESOURCE_DESC *desc) -{ - memcpy(desc1, desc, sizeof(*desc)); - desc1->SamplerFeedbackMipRegion.Width = 0; - desc1->SamplerFeedbackMipRegion.Height = 0; - desc1->SamplerFeedbackMipRegion.Depth = 0; -} - static void d3d12_resource_allocation_info1_from_vkd3d(D3D12_RESOURCE_ALLOCATION_INFO1 *result, const struct vkd3d_resource_allocation_info *info) { diff --git a/libs/vkd3d/resource.c b/libs/vkd3d/resource.c index fc05fce1..89764d09 100644 --- a/libs/vkd3d/resource.c +++ b/libs/vkd3d/resource.c @@ -2277,8 +2277,8 @@ HRESULT vkd3d_create_image_resource(ID3D12Device *device, object->ID3D12Resource2_iface.lpVtbl = &d3d12_resource_vtbl; object->refcount = 1; object->internal_refcount = 1; - object->desc = create_info->desc; - object->format = vkd3d_format_from_d3d12_resource_desc(d3d12_device, &create_info->desc, 0); + d3d12_resource_desc1_from_desc(&object->desc, &create_info->desc); + object->format = vkd3d_format_from_d3d12_resource_desc(d3d12_device, &object->desc, 0); object->u.vk_image = create_info->vk_image; object->flags = VKD3D_RESOURCE_EXTERNAL; object->flags |= create_info->flags & VKD3D_RESOURCE_PUBLIC_FLAGS; diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 6101c3fe..20317ace 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -769,6 +769,14 @@ HRESULT d3d12_reserved_resource_create(struct d3d12_device *device, const D3D12_CLEAR_VALUE *optimized_clear_value, struct d3d12_resource **resource); struct d3d12_resource *unsafe_impl_from_ID3D12Resource(ID3D12Resource *iface); +static inline void d3d12_resource_desc1_from_desc(D3D12_RESOURCE_DESC1 *desc1, const D3D12_RESOURCE_DESC *desc) +{ + memcpy(desc1, desc, sizeof(*desc)); + desc1->SamplerFeedbackMipRegion.Width = 0; + desc1->SamplerFeedbackMipRegion.Height = 0; + desc1->SamplerFeedbackMipRegion.Depth = 0; +} + HRESULT vkd3d_allocate_buffer_memory(struct d3d12_device *device, VkBuffer vk_buffer, const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags, VkDeviceMemory *vk_memory, uint32_t *vk_memory_type, VkDeviceSize *vk_memory_size);