vkd3d: Implement d3d12_device_GetResourceAllocationInfo() for buffers.

In Direct3D12, D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT is always used
for buffers. We could try to use a lower alignment when supported by
the Vulkan implementation, but there is no way to get buffer memory
requirements without creating a buffer in Vulkan.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2018-09-25 14:13:00 +02:00 committed by Alexandre Julliard
parent e93fed2c93
commit 99e239ad50
1 changed files with 33 additions and 6 deletions

View File

@ -2022,16 +2022,43 @@ static void STDMETHODCALLTYPE d3d12_device_CopyDescriptorsSimple(ID3D12Device *i
}
static D3D12_RESOURCE_ALLOCATION_INFO * STDMETHODCALLTYPE d3d12_device_GetResourceAllocationInfo(
ID3D12Device *iface, D3D12_RESOURCE_ALLOCATION_INFO *allocation_info, UINT visible_mask,
UINT resource_desc_count, const D3D12_RESOURCE_DESC *resource_descs)
ID3D12Device *iface, D3D12_RESOURCE_ALLOCATION_INFO *info, UINT visible_mask,
UINT count, const D3D12_RESOURCE_DESC *resource_descs)
{
FIXME("iface %p, allocation_info %p, visible_mask 0x%08x, resource_desc_count %u, "
"resource_descs %p stub!\n",
iface, allocation_info, visible_mask, resource_desc_count, resource_descs);
const D3D12_RESOURCE_DESC *desc;
TRACE("iface %p, info %p, visible_mask 0x%08x, count %u, resource_descs %p.\n",
iface, info, visible_mask, count, resource_descs);
debug_ignored_node_mask(visible_mask);
return allocation_info;
info->SizeInBytes = 0;
info->Alignment = 0;
if (count != 1)
{
FIXME("Multiple resource descriptions not supported.\n");
return info;
}
desc = &resource_descs[0];
if (desc->Dimension == D3D12_RESOURCE_DIMENSION_BUFFER)
{
info->SizeInBytes = align(desc->Width, D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT);
info->Alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
}
else
{
FIXME("Unhandled dimension %#x.\n", desc->Dimension);
}
if (FAILED(d3d12_resource_validate_desc(desc)))
{
WARN("Invalid resource desc.\n");
info->SizeInBytes = ~(UINT64)0;
}
return info;
}
static D3D12_HEAP_PROPERTIES * STDMETHODCALLTYPE d3d12_device_GetCustomHeapProperties(ID3D12Device *iface,