vkd3d: Implement GetResourceAllocationInfo1().

This commit is contained in:
Conor McCarthy 2024-01-31 11:38:26 +10:00 committed by Alexandre Julliard
parent 67b4ae658a
commit eae4b7b4a2
Notes: Alexandre Julliard 2024-02-01 23:07:43 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Alexandre Julliard (@julliard)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/617
2 changed files with 25 additions and 6 deletions

View File

@ -3566,8 +3566,16 @@ static void STDMETHODCALLTYPE d3d12_device_CopyDescriptorsSimple(ID3D12Device7 *
1, &src_descriptor_range_offset, &descriptor_count, descriptor_heap_type);
}
static void d3d12_resource_allocation_info1_from_vkd3d(D3D12_RESOURCE_ALLOCATION_INFO1 *result,
const struct vkd3d_resource_allocation_info *info)
{
result->Offset = info->offset;
result->Alignment = info->alignment;
result->SizeInBytes = info->size_in_bytes;
}
static void d3d12_device_get_resource_allocation_info(struct d3d12_device *device,
unsigned int count, const D3D12_RESOURCE_DESC *resource_descs,
D3D12_RESOURCE_ALLOCATION_INFO1 *infos1, unsigned int count, const D3D12_RESOURCE_DESC *resource_descs,
D3D12_RESOURCE_ALLOCATION_INFO *result)
{
struct vkd3d_resource_allocation_info info;
@ -3621,6 +3629,9 @@ static void d3d12_device_get_resource_allocation_info(struct d3d12_device *devic
info.offset = align(info.offset, info.alignment);
}
if (infos1)
d3d12_resource_allocation_info1_from_vkd3d(&infos1[i], &info);
info.offset += info.size_in_bytes;
result->Alignment = max(result->Alignment, info.alignment);
@ -3652,7 +3663,7 @@ static D3D12_RESOURCE_ALLOCATION_INFO * STDMETHODCALLTYPE d3d12_device_GetResour
debug_ignored_node_mask(visible_mask);
d3d12_device_get_resource_allocation_info(device, count, resource_descs, info);
d3d12_device_get_resource_allocation_info(device, NULL, count, resource_descs, info);
return info;
}
@ -4175,9 +4186,15 @@ static D3D12_RESOURCE_ALLOCATION_INFO * STDMETHODCALLTYPE d3d12_device_GetResour
UINT count, const D3D12_RESOURCE_DESC *resource_descs,
D3D12_RESOURCE_ALLOCATION_INFO1 *info1)
{
FIXME("iface %p, info %p, visible_mask 0x%08x, count %u, resource_descs %p, info1 %p stub!\n",
struct d3d12_device *device = impl_from_ID3D12Device7(iface);
TRACE("iface %p, info %p, visible_mask 0x%08x, count %u, resource_descs %p, info1 %p.\n",
iface, info, visible_mask, count, resource_descs, info1);
debug_ignored_node_mask(visible_mask);
d3d12_device_get_resource_allocation_info(device, info1, count, resource_descs, info);
return info;
}

View File

@ -32298,19 +32298,21 @@ static void test_resource_allocation_info(void)
if (SUCCEEDED(ID3D12Device_QueryInterface(device, &IID_ID3D12Device4, (void **)&device4)))
{
ID3D12Device4_GetResourceAllocationInfo1(device4, 0, ARRAY_SIZE(desc_array), desc_array, infos1);
info = ID3D12Device4_GetResourceAllocationInfo1(device4, 0, ARRAY_SIZE(desc_array), desc_array, infos1);
ok(info.Alignment >= D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT,
"Got unexpected alignment %"PRIu64".\n", info.Alignment);
check_alignment(info.SizeInBytes, info.Alignment);
ok(info.SizeInBytes >= total, "Got unexpected size %"PRIu64".\n", info.SizeInBytes);
ok(!infos1[0].Offset, "Got unexpected offset %"PRIu64".\n", infos1[0].Offset);
for (i = 0; i < ARRAY_SIZE(infos1); ++i)
{
vkd3d_test_push_context("Test %u", i);
todo
ok(infos1[i].Alignment >= desc_array[i].Alignment,
"Got unexpected alignment %"PRIu64".\n", infos1[i].Alignment);
check_alignment(infos1[i].Offset, infos1[i].Alignment);
check_alignment(infos1[i].SizeInBytes, infos1[i].Alignment);
todo
ok(infos1[i].SizeInBytes == sizes[i], "Got unexpected size %"PRIu64".\n", infos1[i].SizeInBytes);
if (!i)