vkd3d: Implement ID3D12Device4::CreateCommandList1.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
This commit is contained in:
Philip Rebohle 2020-04-14 13:42:43 +02:00 committed by Hans-Kristian Arntzen
parent 23e2b62950
commit 0c03bbe9b5
3 changed files with 37 additions and 26 deletions

View File

@ -2013,7 +2013,7 @@ static const struct ID3D12CommandAllocatorVtbl d3d12_command_allocator_vtbl =
d3d12_command_allocator_Reset,
};
static struct d3d12_command_allocator *unsafe_impl_from_ID3D12CommandAllocator(ID3D12CommandAllocator *iface)
struct d3d12_command_allocator *unsafe_impl_from_ID3D12CommandAllocator(ID3D12CommandAllocator *iface)
{
if (!iface)
return NULL;
@ -6288,16 +6288,17 @@ static HRESULT d3d12_command_list_init(struct d3d12_command_list *list, struct d
d3d12_device_add_ref(list->device = device);
list->allocator = allocator;
if (SUCCEEDED(hr = d3d12_command_allocator_allocate_command_buffer(allocator, list)))
if ((list->allocator = allocator))
{
d3d12_command_list_reset_state(list, initial_pipeline_state);
}
else
{
vkd3d_private_store_destroy(&list->private_store);
d3d12_device_release(device);
if (SUCCEEDED(hr = d3d12_command_allocator_allocate_command_buffer(allocator, list)))
{
d3d12_command_list_reset_state(list, initial_pipeline_state);
}
else
{
vkd3d_private_store_destroy(&list->private_store);
d3d12_device_release(device);
}
}
return hr;
@ -6307,23 +6308,10 @@ HRESULT d3d12_command_list_create(struct d3d12_device *device,
UINT node_mask, D3D12_COMMAND_LIST_TYPE type, ID3D12CommandAllocator *allocator_iface,
ID3D12PipelineState *initial_pipeline_state, struct d3d12_command_list **list)
{
struct d3d12_command_allocator *allocator;
struct d3d12_command_allocator *allocator = unsafe_impl_from_ID3D12CommandAllocator(allocator_iface);
struct d3d12_command_list *object;
HRESULT hr;
if (!(allocator = unsafe_impl_from_ID3D12CommandAllocator(allocator_iface)))
{
WARN("Command allocator is NULL.\n");
return E_INVALIDARG;
}
if (allocator->type != type)
{
WARN("Command list types do not match (allocator %#x, list %#x).\n",
allocator->type, type);
return E_INVALIDARG;
}
debug_ignored_node_mask(node_mask);
if (!(object = vkd3d_malloc(sizeof(*object))))

View File

@ -2377,6 +2377,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandList(d3d12_device_ifa
ID3D12PipelineState *initial_pipeline_state, REFIID riid, void **command_list)
{
struct d3d12_device *device = impl_from_ID3D12Device(iface);
struct d3d12_command_allocator *allocator;
struct d3d12_command_list *object;
HRESULT hr;
@ -2385,6 +2386,19 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandList(d3d12_device_ifa
iface, node_mask, type, command_allocator,
initial_pipeline_state, debugstr_guid(riid), command_list);
if (!(allocator = unsafe_impl_from_ID3D12CommandAllocator(command_allocator)))
{
WARN("Command allocator is NULL.\n");
return E_INVALIDARG;
}
if (allocator->type != type)
{
WARN("Command list types do not match (allocator %#x, list %#x).\n",
allocator->type, type);
return E_INVALIDARG;
}
if (FAILED(hr = d3d12_command_list_create(device, node_mask, type, command_allocator,
initial_pipeline_state, &object)))
return hr;
@ -3769,10 +3783,18 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CreateCommandList1(d3d12_device_if
UINT node_mask, D3D12_COMMAND_LIST_TYPE type, D3D12_COMMAND_LIST_FLAGS flags,
REFIID riid, void **command_list)
{
FIXME("iface %p, node_mask 0x%08x, type %#x, flags %#x, riid %s, command_list %p stub!\n",
struct d3d12_device *device = impl_from_ID3D12Device(iface);
struct d3d12_command_list *object;
HRESULT hr;
TRACE("iface %p, node_mask 0x%08x, type %#x, flags %#x, riid %s, command_list %p.\n",
iface, node_mask, type, flags, debugstr_guid(riid), command_list);
return E_NOTIMPL;
if (FAILED(hr = d3d12_command_list_create(device, node_mask, type, NULL, NULL, &object)))
return hr;
return return_interface(&object->ID3D12GraphicsCommandList_iface,
&IID_ID3D12GraphicsCommandList, riid, command_list);
}
static HRESULT STDMETHODCALLTYPE d3d12_device_CreateProtectedResourceSession(d3d12_device_iface *iface,

View File

@ -1049,6 +1049,7 @@ struct d3d12_command_allocator
HRESULT d3d12_command_allocator_create(struct d3d12_device *device,
D3D12_COMMAND_LIST_TYPE type, struct d3d12_command_allocator **allocator) DECLSPEC_HIDDEN;
struct d3d12_command_allocator *unsafe_impl_from_ID3D12CommandAllocator(ID3D12CommandAllocator *iface) DECLSPEC_HIDDEN;
enum vkd3d_pipeline_dirty_flag
{