vkd3d: Implement private data for pipeline states.

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 2019-01-04 14:34:14 +01:00 committed by Alexandre Julliard
parent 751d79a68f
commit b8fce1ac36
3 changed files with 30 additions and 6 deletions

View File

@ -1136,6 +1136,8 @@ static ULONG STDMETHODCALLTYPE d3d12_pipeline_state_Release(ID3D12PipelineState
struct d3d12_device *device = state->device;
const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs;
vkd3d_private_store_destroy(&state->private_store);
if (d3d12_pipeline_state_is_graphics(state))
d3d12_pipeline_state_destroy_graphics(state, device);
else if (d3d12_pipeline_state_is_compute(state))
@ -1159,25 +1161,31 @@ static ULONG STDMETHODCALLTYPE d3d12_pipeline_state_Release(ID3D12PipelineState
static HRESULT STDMETHODCALLTYPE d3d12_pipeline_state_GetPrivateData(ID3D12PipelineState *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_pipeline_state *state = impl_from_ID3D12PipelineState(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(&state->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE d3d12_pipeline_state_SetPrivateData(ID3D12PipelineState *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_pipeline_state *state = impl_from_ID3D12PipelineState(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(&state->private_store, guid, data_size, data);
}
static HRESULT STDMETHODCALLTYPE d3d12_pipeline_state_SetPrivateDataInterface(ID3D12PipelineState *iface,
REFGUID guid, const IUnknown *data)
{
FIXME("iface %p, guid %s, data %p stub!\n", iface, debugstr_guid(guid), data);
struct d3d12_pipeline_state *state = impl_from_ID3D12PipelineState(iface);
return E_NOTIMPL;
TRACE("iface %p, guid %s, data %p.\n", iface, debugstr_guid(guid), data);
return vkd3d_set_private_data_interface(&state->private_store, guid, data);
}
static HRESULT STDMETHODCALLTYPE d3d12_pipeline_state_SetName(ID3D12PipelineState *iface, const WCHAR *name)
@ -1508,6 +1516,8 @@ static HRESULT d3d12_pipeline_state_init_compute(struct d3d12_pipeline_state *st
return hresult_from_vk_result(vr);
}
vkd3d_private_store_init(&state->private_store);
state->vk_bind_point = VK_PIPELINE_BIND_POINT_COMPUTE;
state->device = device;
ID3D12Device_AddRef(&device->ID3D12Device_iface);
@ -2349,6 +2359,8 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s
list_init(&graphics->compiled_pipelines);
vkd3d_private_store_init(&state->private_store);
state->vk_bind_point = VK_PIPELINE_BIND_POINT_GRAPHICS;
state->device = device;
ID3D12Device_AddRef(&device->ID3D12Device_iface);

View File

@ -620,6 +620,8 @@ struct d3d12_pipeline_state
uint8_t uav_counter_mask;
struct d3d12_device *device;
struct vkd3d_private_store private_store;
};
static inline bool d3d12_pipeline_state_is_compute(const struct d3d12_pipeline_state *state)

View File

@ -2562,6 +2562,7 @@ 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;
ID3D12RootSignature *root_signature;
ULONG refcount, expected_refcount;
ID3D12CommandAllocator *allocator;
IUnknown *test_object;
@ -2586,6 +2587,7 @@ static void test_private_data(void)
&IID_ID3D12CommandSignature,
&IID_ID3D12Device,
&IID_ID3D12Fence,
&IID_ID3D12PipelineState,
&IID_ID3D12RootSignature,
};
@ -2650,6 +2652,14 @@ static void test_private_data(void)
&IID_IUnknown, (void **)&unknown);
ok(hr == S_OK, "Failed to create fence, hr %#x.\n", hr);
}
else if (IsEqualGUID(tests[i], &IID_ID3D12PipelineState))
{
vkd3d_test_set_context("pipeline state");
root_signature = create_empty_root_signature(device, 0);
unknown = (IUnknown *)create_pipeline_state(device,
root_signature, DXGI_FORMAT_R8G8B8A8_UNORM, NULL, NULL, NULL);
ID3D12RootSignature_Release(root_signature);
}
else if (IsEqualGUID(tests[i], &IID_ID3D12RootSignature))
{
vkd3d_test_set_context("root signature");