Skip to content
Snippets Groups Projects

Various tests for creating identical objects

Merged Stefan Dösinger requested to merge stefan/vkd3d:tests into master
1 file
+ 72
15
Compare changes
  • Side-by-side
  • Inline
+ 72
15
@@ -2633,15 +2633,19 @@ static void test_create_unordered_access_view(void)
static void test_create_root_signature(void)
{
ID3D12RootSignature *root_signature, *root_signature2;
D3D12_ROOT_SIGNATURE_DESC root_signature_desc;
D3D12_DESCRIPTOR_RANGE descriptor_ranges[2];
D3D12_RESOURCE_BINDING_TIER binding_tier;
D3D12_ROOT_PARAMETER root_parameters[3];
ID3D12RootSignature *root_signature;
ID3D12Device *device, *tmp_device;
unsigned int size;
ULONG refcount;
HRESULT hr;
static const GUID test_guid
= {0xfdb37466, 0x428f, 0x4edf, {0xa3, 0x7f, 0x9b, 0x1d, 0xf4, 0x88, 0xc5, 0xfc}};
if (!(device = create_device()))
{
skip("Failed to create device.\n");
@@ -2653,6 +2657,43 @@ static void test_create_root_signature(void)
* ranges of different types. */
binding_tier = get_resource_binding_tier(device);
/* empty root signature */
root_signature_desc.NumParameters = 0;
root_signature_desc.pParameters = NULL;
root_signature_desc.NumStaticSamplers = 0;
root_signature_desc.pStaticSamplers = NULL;
root_signature_desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_NONE;
hr = create_root_signature(device, &root_signature_desc, &root_signature);
ok(hr == S_OK, "Failed to create root signature, hr %#x.\n", hr);
/* Creating the same root signature twice returns the same interface pointer.
*
* However, the root signature object actually gets destroyed after releasing
* the last reference. Re-creating the same root descriptor later does not
* reliably return the same interface pointer, although it might do so if the
* heap manager reuses the allocation. */
hr = create_root_signature(device, &root_signature_desc, &root_signature2);
ok(hr == S_OK, "Failed to create root signature, hr %#x.\n", hr);
todo ok(root_signature == root_signature2, "Got different root signature pointers.\n");
refcount = ID3D12RootSignature_Release(root_signature2);
todo ok(refcount == 1, "ID3D12RootSignature has %u references left.\n", (unsigned int)refcount);
hr = 0xdeadbeef;
hr = ID3D12RootSignature_SetPrivateData(root_signature, &test_guid, sizeof(hr), &hr);
ok(hr == S_OK, "Failed to set private data, hr %#x.\n", hr);
hr = ID3D12RootSignature_GetPrivateData(root_signature, &test_guid, &size, NULL);
ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
refcount = ID3D12RootSignature_Release(root_signature);
ok(!refcount, "ID3D12RootSignature has %u references left.\n", (unsigned int)refcount);
hr = create_root_signature(device, &root_signature_desc, &root_signature);
ok(hr == S_OK, "Failed to create root signature, hr %#x.\n", hr);
hr = ID3D12RootSignature_GetPrivateData(root_signature, &test_guid, &size, NULL);
ok(hr == DXGI_ERROR_NOT_FOUND, "Got unexpected hr %#x.\n", hr);
refcount = ID3D12RootSignature_Release(root_signature);
ok(!refcount, "ID3D12RootSignature has %u references left.\n", (unsigned int)refcount);
/* descriptor table */
descriptor_ranges[0].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
descriptor_ranges[0].NumDescriptors = 1;
@@ -2685,6 +2726,12 @@ static void test_create_root_signature(void)
check_interface(root_signature, &IID_ID3D12Pageable, false);
check_interface(root_signature, &IID_ID3D12RootSignature, true);
hr = create_root_signature(device, &root_signature_desc, &root_signature2);
ok(hr == S_OK, "Failed to create root signature, hr %#x.\n", hr);
todo ok(root_signature == root_signature2, "Got different root signature pointers.\n");
refcount = ID3D12RootSignature_Release(root_signature2);
todo ok(refcount == 1, "ID3D12RootSignature has %u references left.\n", (unsigned int)refcount);
refcount = ID3D12RootSignature_Release(root_signature);
ok(!refcount, "ID3D12RootSignature has %u references left.\n", (unsigned int)refcount);
@@ -2747,17 +2794,6 @@ static void test_create_root_signature(void)
hr = create_root_signature(device, &root_signature_desc, &root_signature);
ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
/* empty root signature */
root_signature_desc.NumParameters = 0;
root_signature_desc.pParameters = NULL;
root_signature_desc.NumStaticSamplers = 0;
root_signature_desc.pStaticSamplers = NULL;
root_signature_desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_NONE;
hr = create_root_signature(device, &root_signature_desc, &root_signature);
ok(hr == S_OK, "Failed to create root signature, hr %#x.\n", hr);
refcount = ID3D12RootSignature_Release(root_signature);
ok(!refcount, "ID3D12RootSignature has %u references left.\n", (unsigned int)refcount);
/* root constants */
root_parameters[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_32BIT_CONSTANTS;
root_parameters[0].Constants.ShaderRegister = 0;
@@ -2955,9 +2991,9 @@ static void test_root_signature_limits(void)
static void test_create_compute_pipeline_state(void)
{
D3D12_COMPUTE_PIPELINE_STATE_DESC pipeline_state_desc;
ID3D12PipelineState *pipeline_state, *pipeline_state2;
D3D12_ROOT_SIGNATURE_DESC root_signature_desc;
ID3D12RootSignature *root_signature;
ID3D12PipelineState *pipeline_state;
ID3D12Device *device, *tmp_device;
ID3D10Blob *bytecode;
ULONG refcount;
@@ -3000,6 +3036,13 @@ static void test_create_compute_pipeline_state(void)
&IID_ID3D12PipelineState, (void **)&pipeline_state);
ok(hr == S_OK, "Failed to create compute pipeline, hr %#x.\n", hr);
hr = ID3D12Device_CreateComputePipelineState(device, &pipeline_state_desc,
&IID_ID3D12PipelineState, (void **)&pipeline_state2);
ok(hr == S_OK, "Failed to create compute pipeline, hr %#x.\n", hr);
ok(pipeline_state != pipeline_state2, "Got the same pipeline state object.\n");
refcount = ID3D12PipelineState_Release(pipeline_state2);
ok(!refcount, "ID3D12PipelineState has %u references left.\n", (unsigned int)refcount);
refcount = get_refcount(root_signature);
ok(refcount == 1, "Got unexpected refcount %u.\n", (unsigned int)refcount);
@@ -3031,10 +3074,10 @@ static void test_create_compute_pipeline_state(void)
static void test_create_graphics_pipeline_state(void)
{
ID3D12PipelineState *pipeline_state, *pipeline_state2;
D3D12_ROOT_SIGNATURE_DESC root_signature_desc;
D3D12_GRAPHICS_PIPELINE_STATE_DESC pso_desc;
ID3D12RootSignature *root_signature;
ID3D12PipelineState *pipeline_state;
ID3D12Device *device, *tmp_device;
D3D12_BLEND_DESC *blend;
ULONG refcount;
@@ -3069,6 +3112,13 @@ static void test_create_graphics_pipeline_state(void)
&IID_ID3D12PipelineState, (void **)&pipeline_state);
ok(hr == S_OK, "Failed to create pipeline, hr %#x.\n", hr);
hr = ID3D12Device_CreateGraphicsPipelineState(device, &pso_desc,
&IID_ID3D12PipelineState, (void **)&pipeline_state2);
ok(hr == S_OK, "Failed to create pipeline, hr %#x.\n", hr);
ok(pipeline_state != pipeline_state2, "Got the same pipeline state object.\n");
refcount = ID3D12PipelineState_Release(pipeline_state2);
ok(!refcount, "ID3D12PipelineState has %u references left.\n", (unsigned int)refcount);
refcount = get_refcount(root_signature);
ok(refcount == 1, "Got unexpected refcount %u.\n", (unsigned int)refcount);
@@ -3177,9 +3227,9 @@ static void test_create_graphics_pipeline_state(void)
static void test_create_pipeline_state(void)
{
ID3D12PipelineState *pipeline_state, *pipeline_state2;
D3D12_ROOT_SIGNATURE_DESC root_signature_desc;
ID3D12RootSignature *root_signature;
ID3D12PipelineState *pipeline_state;
ID3D12Device2 *device2;
ID3D12Device *device;
unsigned int i;
@@ -3635,6 +3685,13 @@ static void test_create_pipeline_state(void)
if (hr == S_OK)
{
hr = ID3D12Device2_CreatePipelineState(device2, &tests[i].stream_desc, &IID_ID3D12PipelineState,
(void **)&pipeline_state2);
ok(hr == S_OK, "Got unexpected return value %#x.\n", hr);
ok(pipeline_state != pipeline_state2, "Got the same pipeline state object.\n");
refcount = ID3D12PipelineState_Release(pipeline_state2);
ok(!refcount, "ID3D12PipelineState has %u references left.\n", (unsigned int)refcount);
refcount = ID3D12PipelineState_Release(pipeline_state);
ok(!refcount, "ID3D12PipelineState has %u references left.\n", (unsigned int)refcount);
}
Loading