vkd3d-shader: Forbid mixing samplers with CBVs/SRVs/UAVs in root signatures.

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-06-12 14:08:00 +02:00
committed by Alexandre Julliard
parent 895aaa461b
commit 4a0b62084a
2 changed files with 126 additions and 8 deletions

View File

@@ -2488,7 +2488,7 @@ static void test_create_unordered_access_view(void)
static void test_create_root_signature(void)
{
D3D12_ROOT_SIGNATURE_DESC root_signature_desc;
D3D12_DESCRIPTOR_RANGE descriptor_ranges[1];
D3D12_DESCRIPTOR_RANGE descriptor_ranges[2];
D3D12_ROOT_PARAMETER root_parameters[3];
ID3D12RootSignature *root_signature;
ID3D12Device *device, *tmp_device;
@@ -2517,12 +2517,12 @@ static void test_create_root_signature(void)
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(SUCCEEDED(hr), "Failed to create root signature, hr %#x.\n", hr);
ok(hr == S_OK, "Failed to create root signature, hr %#x.\n", hr);
refcount = get_refcount(device);
ok(refcount == 2, "Got unexpected refcount %u.\n", (unsigned int)refcount);
hr = ID3D12RootSignature_GetDevice(root_signature, &IID_ID3D12Device, (void **)&tmp_device);
ok(SUCCEEDED(hr), "Failed to get device, hr %#x.\n", hr);
ok(hr == S_OK, "Failed to get device, hr %#x.\n", hr);
refcount = get_refcount(device);
ok(refcount == 3, "Got unexpected refcount %u.\n", (unsigned int)refcount);
refcount = ID3D12Device_Release(tmp_device);
@@ -2536,14 +2536,32 @@ static void test_create_root_signature(void)
refcount = ID3D12RootSignature_Release(root_signature);
ok(!refcount, "ID3D12RootSignature has %u references left.\n", (unsigned int)refcount);
/* empty */
/* sampler and SRV in the same descriptor table */
descriptor_ranges[1].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER;
descriptor_ranges[1].NumDescriptors = 1;
descriptor_ranges[1].BaseShaderRegister = 2;
descriptor_ranges[1].RegisterSpace = 0;
descriptor_ranges[1].OffsetInDescriptorsFromTableStart = 10;
root_parameters[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_DESCRIPTOR_TABLE;
root_parameters[0].DescriptorTable.NumDescriptorRanges = 2;
root_parameters[0].DescriptorTable.pDescriptorRanges = descriptor_ranges;
root_parameters[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
root_signature_desc.NumParameters = 1;
root_signature_desc.pParameters = root_parameters;
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 == E_INVALIDARG, "Failed to create root signature, 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(SUCCEEDED(hr), "Failed to create root signature, hr %#x.\n", hr);
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);
@@ -2569,7 +2587,7 @@ static void test_create_root_signature(void)
ID3D12RootSignature_Release(root_signature);
root_parameters[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_PIXEL;
hr = create_root_signature(device, &root_signature_desc, &root_signature);
ok(SUCCEEDED(hr), "Failed to create root signature, hr %#x.\n", hr);
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);
@@ -2580,7 +2598,7 @@ static void test_create_root_signature(void)
root_parameters[2].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
root_signature_desc.NumParameters = 3;
hr = create_root_signature(device, &root_signature_desc, &root_signature);
ok(SUCCEEDED(hr), "Failed to create root signature, hr %#x.\n", hr);
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);
@@ -2604,7 +2622,7 @@ static void test_create_root_signature(void)
ID3D12RootSignature_Release(root_signature);
root_parameters[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_GEOMETRY;
hr = create_root_signature(device, &root_signature_desc, &root_signature);
ok(SUCCEEDED(hr), "Failed to create root signature, hr %#x.\n", hr);
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);