From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- libs/vkd3d/command.c | 22 ++++++++++++++++------ libs/vkd3d/vkd3d_private.h | 2 ++ tests/d3d12.c | 15 +++++++++++++++ 3 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c index 8708aaf98285..4bf11d4b9997 100644 --- a/libs/vkd3d/command.c +++ b/libs/vkd3d/command.c @@ -4811,6 +4811,8 @@ static ULONG STDMETHODCALLTYPE d3d12_command_signature_Release(ID3D12CommandSign { struct d3d12_device *device = signature->device;
+ vkd3d_private_store_destroy(&signature->private_store); + vkd3d_free((void *)signature->desc.pArgumentDescs); vkd3d_free(signature);
@@ -4823,25 +4825,31 @@ static ULONG STDMETHODCALLTYPE d3d12_command_signature_Release(ID3D12CommandSign static HRESULT STDMETHODCALLTYPE d3d12_command_signature_GetPrivateData(ID3D12CommandSignature *iface, REFGUID guid, UINT *data_size, void *data) { - FIXME("iface %p, guid %s, data_size %p, data %p stub!", iface, debugstr_guid(guid), data_size, data); + struct d3d12_command_signature *signature = impl_from_ID3D12CommandSignature(iface);
- return E_NOTIMPL; + TRACE("iface %p, guid %s, data_size %p, data %p.\n", iface, debugstr_guid(guid), data_size, data); + + return vkd3d_get_private_data(&signature->private_store, guid, data_size, data); }
static HRESULT STDMETHODCALLTYPE d3d12_command_signature_SetPrivateData(ID3D12CommandSignature *iface, REFGUID guid, UINT data_size, const void *data) { - FIXME("iface %p, guid %s, data_size %u, data %p stub!\n", iface, debugstr_guid(guid), data_size, data); + struct d3d12_command_signature *signature = impl_from_ID3D12CommandSignature(iface);
- return E_NOTIMPL; + TRACE("iface %p, guid %s, data_size %u, data %p.\n", iface, debugstr_guid(guid), data_size, data); + + return vkd3d_set_private_data(&signature->private_store, guid, data_size, data); }
static HRESULT STDMETHODCALLTYPE d3d12_command_signature_SetPrivateDataInterface(ID3D12CommandSignature *iface, REFGUID guid, const IUnknown *data) { - FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data); + struct d3d12_command_signature *signature = impl_from_ID3D12CommandSignature(iface);
- return E_NOTIMPL; + TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data); + + return vkd3d_set_private_data_interface(&signature->private_store, guid, data); }
static HRESULT STDMETHODCALLTYPE d3d12_command_signature_SetName(ID3D12CommandSignature *iface, const WCHAR *name) @@ -4926,6 +4934,8 @@ HRESULT d3d12_command_signature_create(struct d3d12_device *device, const D3D12_ memcpy((void *)object->desc.pArgumentDescs, desc->pArgumentDescs, desc->NumArgumentDescs * sizeof(*desc->pArgumentDescs));
+ vkd3d_private_store_init(&object->private_store); + object->device = device; ID3D12Device_AddRef(&device->ID3D12Device_iface);
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 4e2650804bfa..eef7d904f686 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -815,6 +815,8 @@ struct d3d12_command_signature D3D12_COMMAND_SIGNATURE_DESC desc;
struct d3d12_device *device; + + struct vkd3d_private_store private_store; };
HRESULT d3d12_command_signature_create(struct d3d12_device *device, const D3D12_COMMAND_SIGNATURE_DESC *desc, diff --git a/tests/d3d12.c b/tests/d3d12.c index 534fd93c01b5..9e381cb4810d 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -2559,6 +2559,8 @@ static void test_create_fence(void)
static void test_private_data(void) { + D3D12_COMMAND_SIGNATURE_DESC command_signature_desc; + D3D12_INDIRECT_ARGUMENT_DESC argument_desc; D3D12_COMMAND_QUEUE_DESC queue_desc; ULONG refcount, expected_refcount; ID3D12CommandAllocator *allocator; @@ -2581,6 +2583,7 @@ static void test_private_data(void) &IID_ID3D12CommandAllocator, &IID_ID3D12CommandList, &IID_ID3D12CommandQueue, + &IID_ID3D12CommandSignature, &IID_ID3D12Device, &IID_ID3D12Fence, }; @@ -2622,6 +2625,18 @@ static void test_private_data(void) &IID_IUnknown, (void **)&unknown); ok(hr == S_OK, "Failed to create command queue, hr %#x.\n", hr); } + else if (IsEqualGUID(tests[i], &IID_ID3D12CommandSignature)) + { + vkd3d_test_set_context("command signature"); + argument_desc.Type = D3D12_INDIRECT_ARGUMENT_TYPE_DRAW; + command_signature_desc.ByteStride = sizeof(D3D12_DRAW_ARGUMENTS); + command_signature_desc.NumArgumentDescs = 1; + command_signature_desc.pArgumentDescs = &argument_desc; + command_signature_desc.NodeMask = 0; + hr = ID3D12Device_CreateCommandSignature(device, &command_signature_desc, + NULL, &IID_ID3D12CommandSignature, (void **)&unknown); + ok(hr == S_OK, "Failed to create command signature, hr %#x.\n", hr); + } else if (IsEqualGUID(tests[i], &IID_ID3D12Device)) { vkd3d_test_set_context("device");