vkd3d: Add support for fake placed resources.

Placed resources are not allocated from a given heap yet.

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:12:59 +02:00 committed by Alexandre Julliard
parent 5319cc2420
commit e93fed2c93
3 changed files with 41 additions and 7 deletions

View File

@ -2091,15 +2091,25 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateHeap(ID3D12Device *iface,
static HRESULT STDMETHODCALLTYPE d3d12_device_CreatePlacedResource(ID3D12Device *iface,
ID3D12Heap *heap, UINT64 heap_offset,
const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state,
const D3D12_CLEAR_VALUE *optimized_clear_value,
REFIID riid, void **resource)
const D3D12_CLEAR_VALUE *optimized_clear_value, REFIID iid, void **resource)
{
FIXME("iface %p, heap %p, heap_offset %#"PRIx64", desc %p, initial_state %#x, "
"optimized_clear_value %p, riid %s, resource %p stub!\n",
iface, heap, heap_offset, desc, initial_state,
optimized_clear_value, debugstr_guid(riid), resource);
struct d3d12_device *device = impl_from_ID3D12Device(iface);
struct d3d12_heap *heap_object;
struct d3d12_resource *object;
HRESULT hr;
return E_NOTIMPL;
TRACE("iface %p, heap %p, heap_offset %#"PRIx64", desc %p, initial_state %#x, "
"optimized_clear_value %p, iid %s, resource %p.\n",
iface, heap, heap_offset, desc, initial_state,
optimized_clear_value, debugstr_guid(iid), resource);
heap_object = unsafe_impl_from_ID3D12Heap(heap);
if (FAILED(hr = d3d12_placed_resource_create(device, heap_object, heap_offset,
desc, initial_state, optimized_clear_value, &object)))
return hr;
return return_interface(&object->ID3D12Resource_iface, &IID_ID3D12Resource, iid, resource);
}
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateReservedResource(ID3D12Device *iface,

View File

@ -146,6 +146,14 @@ static const struct ID3D12HeapVtbl d3d12_heap_vtbl =
d3d12_heap_GetDesc,
};
struct d3d12_heap *unsafe_impl_from_ID3D12Heap(ID3D12Heap *iface)
{
if (!iface)
return NULL;
assert(iface->lpVtbl == &d3d12_heap_vtbl);
return impl_from_ID3D12Heap(iface);
}
static HRESULT validate_heap_desc(const D3D12_HEAP_DESC *desc)
{
if (!desc->SizeInBytes)
@ -1049,6 +1057,18 @@ HRESULT d3d12_committed_resource_create(struct d3d12_device *device,
return S_OK;
}
HRESULT d3d12_placed_resource_create(struct d3d12_device *device, struct d3d12_heap *heap, UINT64 heap_offset,
const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state,
const D3D12_CLEAR_VALUE *optimized_clear_value, struct d3d12_resource **resource)
{
const D3D12_HEAP_DESC *heap_desc = &heap->desc;
FIXME("Ignoring heap %p, offset %"PRIu64".\n", heap, heap_offset);
return d3d12_committed_resource_create(device, &heap_desc->Properties, heap_desc->Flags,
desc, initial_state, optimized_clear_value, resource);
}
HRESULT vkd3d_create_image_resource(ID3D12Device *device,
const struct vkd3d_image_resource_create_info *create_info, ID3D12Resource **resource)
{

View File

@ -195,6 +195,7 @@ struct d3d12_heap
HRESULT d3d12_heap_create(struct d3d12_device *device,
const D3D12_HEAP_DESC *desc, struct d3d12_heap **heap) DECLSPEC_HIDDEN;
struct d3d12_heap *unsafe_impl_from_ID3D12Heap(ID3D12Heap *iface) DECLSPEC_HIDDEN;
#define VKD3D_RESOURCE_PUBLIC_FLAGS \
(VKD3D_RESOURCE_INITIAL_STATE_TRANSITION | VKD3D_RESOURCE_PRESENT_STATE_TRANSITION)
@ -245,6 +246,9 @@ HRESULT d3d12_committed_resource_create(struct d3d12_device *device,
const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags,
const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state,
const D3D12_CLEAR_VALUE *optimized_clear_value, struct d3d12_resource **resource) DECLSPEC_HIDDEN;
HRESULT d3d12_placed_resource_create(struct d3d12_device *device, struct d3d12_heap *heap, UINT64 heap_offset,
const D3D12_RESOURCE_DESC *desc, D3D12_RESOURCE_STATES initial_state,
const D3D12_CLEAR_VALUE *optimized_clear_value, struct d3d12_resource **resource) DECLSPEC_HIDDEN;
struct d3d12_resource *unsafe_impl_from_ID3D12Resource(ID3D12Resource *iface) DECLSPEC_HIDDEN;
struct vkd3d_view