tests: Add some basic RTPSO validation rules tests.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
Hans-Kristian Arntzen 2022-05-06 14:24:16 +02:00
parent b88b04e4f1
commit ce00c9322d
2 changed files with 268 additions and 1 deletions

View File

@ -454,6 +454,80 @@ static D3D12_SHADER_BYTECODE get_static_sampler_rt_lib(void)
return code;
}
static D3D12_SHADER_BYTECODE get_dummy_raygen_rt_lib(void)
{
static const BYTE rt_lib_dxil[] =
{
#if 0
RWStructuredBuffer<uint> RW : register(u0);
[shader("raygeneration")]
void main()
{
RW[0] = 0;
}
#endif
0x44, 0x58, 0x42, 0x43, 0xc6, 0x54, 0x78, 0x8e, 0xd8, 0x6b, 0x64, 0x97, 0x62, 0x4e, 0xd5, 0x8c, 0x7e, 0x0d, 0xa4, 0x6f, 0x01, 0x00, 0x00, 0x00, 0xa0, 0x06, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x30, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x18, 0x01, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x52, 0x44, 0x41, 0x54, 0xb4, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x52, 0x57, 0x00, 0x01, 0x3f, 0x6d, 0x61, 0x69, 0x6e, 0x40, 0x40, 0x59, 0x41, 0x58, 0x58, 0x5a, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x60, 0x00, 0x07, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48,
0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xdc, 0xfb, 0x7e, 0x4a, 0x80, 0xf1, 0x63, 0x2a, 0x07, 0x48, 0xc3, 0x9f, 0x1b, 0x9a, 0xd8, 0x44, 0x58, 0x49, 0x4c, 0x80, 0x05, 0x00, 0x00,
0x63, 0x00, 0x06, 0x00, 0x60, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x03, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x68, 0x05, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00,
0x57, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c,
0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x52, 0x88, 0x48, 0x90, 0x14, 0x20,
0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x91, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x29, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x1b, 0x88, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0xda, 0x60, 0x08, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x12, 0x50, 0x01, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84,
0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x40, 0x73, 0x04, 0x60, 0x30, 0x93, 0x19, 0x8c, 0x03, 0x3b, 0x84, 0xc3, 0x3c, 0xcc, 0x83,
0x1b, 0xc8, 0xc2, 0x2d, 0xcc, 0x02, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0x03, 0x39, 0x88, 0x42, 0x3d, 0x98, 0x83, 0x39, 0x94, 0x83, 0x3c, 0xf0, 0x41, 0x3d, 0xb8,
0xc3, 0x3c, 0xa4, 0xc3, 0x39, 0xb8, 0x43, 0x39, 0x90, 0x03, 0x18, 0xa4, 0x83, 0x3b, 0xd0, 0x83, 0x1f, 0xa0, 0x00, 0x50, 0x18, 0x01, 0x28, 0xc1, 0x20, 0x32, 0x47, 0x80, 0x90, 0xb9, 0x67, 0xb8,
0xfc, 0x09, 0x7b, 0x08, 0xc9, 0x0f, 0x81, 0x66, 0x58, 0x08, 0x14, 0x9c, 0xb2, 0x0c, 0x80, 0x00, 0x00, 0x00, 0x00, 0x03, 0x28, 0x95, 0x01, 0x81, 0x40, 0x6b, 0x20, 0x60, 0x8e, 0x20, 0x98, 0x23,
0x00, 0x05, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d,
0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e,
0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10,
0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78,
0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x3a, 0x0f, 0x24, 0x90, 0x21, 0x23, 0x45, 0x44, 0x00, 0x1e, 0x00, 0xf0, 0x90, 0x87, 0x00, 0x00, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x4f, 0x02, 0x04, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x9e, 0x05, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xb2, 0x40, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x02, 0x25, 0x50, 0x06, 0xc5, 0x30, 0x02, 0x50, 0x18,
0x85, 0x50, 0x0e, 0xa5, 0x50, 0x10, 0xf4, 0x0a, 0x14, 0x10, 0x81, 0xdc, 0x08, 0x00, 0x85, 0x19, 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90,
0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62,
0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x04, 0x80, 0x98, 0x20, 0x00, 0xc5, 0x06, 0x61, 0x20, 0x26, 0x08, 0x80, 0xb1,
0x41, 0x18, 0x0c, 0x0e, 0x6c, 0x69, 0x62, 0x1b, 0x06, 0xc4, 0x20, 0x26, 0x08, 0xc0, 0x31, 0x41, 0x10, 0x00, 0x0a, 0x52, 0x57, 0x13, 0x04, 0x00, 0x99, 0x20, 0x38, 0xce, 0x04, 0x01, 0x48, 0x36,
0x08, 0xc3, 0xb3, 0x61, 0x51, 0x16, 0x46, 0x51, 0x86, 0xc6, 0x71, 0x1c, 0x68, 0x43, 0x10, 0x6d, 0x20, 0x00, 0x09, 0x00, 0x26, 0x08, 0xc1, 0xc3, 0x00, 0x6d, 0x82, 0x00, 0x28, 0x13, 0x04, 0x60,
0xd9, 0x60, 0x18, 0x15, 0xa1, 0x58, 0xd7, 0x06, 0xe1, 0xc1, 0x36, 0x0c, 0x0a, 0x95, 0x4d, 0x10, 0x8a, 0x60, 0x03, 0xb0, 0x61, 0x18, 0x38, 0x6e, 0x43, 0xd0, 0x6d, 0x18, 0x86, 0xcd, 0x23, 0x30,
0x41, 0x78, 0x9a, 0x0d, 0x82, 0x12, 0x06, 0x1b, 0x0a, 0x00, 0x0c, 0x80, 0x49, 0x0c, 0xd8, 0x04, 0xfc, 0xb4, 0x85, 0xa5, 0xb9, 0x01, 0x01, 0x65, 0x05, 0x61, 0x61, 0x69, 0x4d, 0x10, 0x00, 0x66,
0x43, 0xa0, 0x6c, 0x20, 0xca, 0xc0, 0xba, 0xcc, 0x60, 0x43, 0xb1, 0x91, 0x01, 0x00, 0x9c, 0x41, 0x15, 0x36, 0x36, 0xbb, 0x36, 0x97, 0x34, 0xb2, 0x32, 0x37, 0xba, 0x29, 0x41, 0x50, 0x85, 0x0c,
0xcf, 0xc5, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x6d, 0x4a, 0x40, 0x34, 0x21, 0xc3, 0x73, 0xb1, 0x0b, 0x63, 0xb3, 0x2b, 0x93, 0x9b, 0x12, 0x18, 0x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, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d,
0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76,
0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87,
0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c,
0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8,
0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x8c, 0xc8, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x72, 0x10, 0x87,
0x73, 0x70, 0x03, 0x7b, 0x08, 0x07, 0x79, 0x60, 0x87, 0x70, 0xc8, 0x87, 0x77, 0xa8, 0x07, 0x7a, 0x00, 0x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0x60, 0x90, 0x50, 0x44, 0xf0, 0x3c, 0x8f, 0x61, 0x18, 0x43, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
D3D12_SHADER_BYTECODE code;
code.pShaderBytecode = rt_lib_dxil;
code.BytecodeLength = sizeof(rt_lib_dxil);
return code;
}
static D3D12_SHADER_BYTECODE get_default_rt_lib(void)
{
/* Compile with -Tlib_6_3 in DXC. */
@ -1437,7 +1511,6 @@ static ID3D12StateObject *rt_pso_factory_compile(struct raytracing_test_context
rt_pso = NULL;
hr = ID3D12Device5_CreateStateObject(context->device5, &desc, &IID_ID3D12StateObject, (void **)&rt_pso);
ok(SUCCEEDED(hr), "Failed to create RT PSO, hr %#x.\n", hr);
free(factory->subobjects);
for (i = 0; i < factory->allocs_count; i++)
@ -2905,3 +2978,194 @@ void test_raytracing_local_rs_static_sampler(void)
destroy_raytracing_test_context(&context);
}
void test_raytracing_no_global_root_signature(void)
{
struct raytracing_test_context context;
D3D12_ROOT_SIGNATURE_DESC rs_desc;
ID3D12RootSignature *local_rs;
struct rt_pso_factory factory;
D3D12_ROOT_PARAMETER param;
ID3D12StateObject *object;
ID3D12Device *device;
unsigned int i;
if (!init_raytracing_test_context(&context, D3D12_RAYTRACING_TIER_1_0))
return;
ID3D12Device5_QueryInterface(context.device5, &IID_ID3D12Device, (void **)&device);
memset(&rs_desc, 0, sizeof(rs_desc));
rs_desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_LOCAL_ROOT_SIGNATURE;
rs_desc.NumParameters = 1;
rs_desc.pParameters = &param;
memset(&param, 0, sizeof(param));
param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV;
create_root_signature(device, &rs_desc, &local_rs);
/* Just verify that we can correctly create such pipelines. */
for (i = 0; i < 2; i++)
{
rt_pso_factory_init(&factory);
rt_pso_factory_add_dxil_library(&factory, get_dummy_raygen_rt_lib(), 0, NULL);
rt_pso_factory_add_state_object_config(&factory, D3D12_STATE_OBJECT_FLAG_NONE);
rt_pso_factory_add_pipeline_config(&factory, 1);
rt_pso_factory_add_shader_config(&factory, 8, 4);
rt_pso_factory_add_local_root_signature(&factory, local_rs);
object = rt_pso_factory_compile(&context, &factory, i ? D3D12_STATE_OBJECT_TYPE_COLLECTION : D3D12_STATE_OBJECT_TYPE_RAYTRACING_PIPELINE);
ok(!!object, "Failed to create RTPSO object.\n");
if (object)
ID3D12StateObject_Release(object);
}
ID3D12RootSignature_Release(local_rs);
ID3D12Device_Release(device);
destroy_raytracing_test_context(&context);
}
void test_raytracing_missing_required_objects(void)
{
struct raytracing_test_context context;
D3D12_ROOT_SIGNATURE_DESC rs_desc;
struct rt_pso_factory factory;
ID3D12RootSignature *local_rs;
D3D12_ROOT_PARAMETER param;
ID3D12StateObject *object;
ID3D12Device *device;
unsigned int i, j;
if (!init_raytracing_test_context(&context, D3D12_RAYTRACING_TIER_1_0))
return;
ID3D12Device5_QueryInterface(context.device5, &IID_ID3D12Device, (void **)&device);
memset(&rs_desc, 0, sizeof(rs_desc));
rs_desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_LOCAL_ROOT_SIGNATURE;
rs_desc.NumParameters = 1;
rs_desc.pParameters = &param;
memset(&param, 0, sizeof(param));
param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV;
create_root_signature(device, &rs_desc, &local_rs);
/* Just verify that we can correctly create and validate missing parameters. */
for (i = 0; i < 2; i++)
{
for (j = 0; j < 4; j++)
{
rt_pso_factory_init(&factory);
rt_pso_factory_add_dxil_library(&factory, get_dummy_raygen_rt_lib(), 0, NULL);
if (j != 1)
rt_pso_factory_add_pipeline_config(&factory, 1);
if (j != 2)
rt_pso_factory_add_shader_config(&factory, 8, 4);
if (j != 3)
rt_pso_factory_add_local_root_signature(&factory, local_rs);
object = rt_pso_factory_compile(&context, &factory, i ? D3D12_STATE_OBJECT_TYPE_COLLECTION : D3D12_STATE_OBJECT_TYPE_RAYTRACING_PIPELINE);
if (j == 0)
ok(!!object, "Failed to create RTPSO object.\n");
else
ok(!object, "Successfully created RTPSO object which is not expected.\n");
if (object)
ID3D12StateObject_Release(object);
}
}
ID3D12RootSignature_Release(local_rs);
ID3D12Device_Release(device);
destroy_raytracing_test_context(&context);
}
void test_raytracing_reject_duplicate_objects(void)
{
struct raytracing_test_context context;
D3D12_ROOT_SIGNATURE_DESC rs_desc;
ID3D12RootSignature *local_rs_alt;
struct rt_pso_factory factory;
ID3D12RootSignature *local_rs;
D3D12_ROOT_PARAMETER param;
unsigned int pconfig_index;
unsigned int sconfig_index;
ID3D12StateObject *object;
unsigned int lrs_index;
ID3D12Device *device;
unsigned int i, j;
if (!init_raytracing_test_context(&context, D3D12_RAYTRACING_TIER_1_0))
return;
ID3D12Device5_QueryInterface(context.device5, &IID_ID3D12Device, (void **)&device);
memset(&rs_desc, 0, sizeof(rs_desc));
rs_desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_LOCAL_ROOT_SIGNATURE;
rs_desc.NumParameters = 1;
rs_desc.pParameters = &param;
memset(&param, 0, sizeof(param));
param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_UAV;
create_root_signature(device, &rs_desc, &local_rs);
param.Descriptor.RegisterSpace = 1;
create_root_signature(device, &rs_desc, &local_rs_alt);
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
rt_pso_factory_init(&factory);
rt_pso_factory_add_dxil_library(&factory, get_dummy_raygen_rt_lib(), 0, NULL);
pconfig_index = rt_pso_factory_add_pipeline_config(&factory, 1);
sconfig_index = rt_pso_factory_add_shader_config(&factory, 8, 4);
lrs_index = rt_pso_factory_add_local_root_signature(&factory, local_rs);
if (i == 0)
{
/* Duplicate definitions don't cause issues. */
if (j == 0)
rt_pso_factory_add_pipeline_config(&factory, 1);
if (j == 1)
rt_pso_factory_add_shader_config(&factory, 8, 4);
if (j == 2)
rt_pso_factory_add_local_root_signature(&factory, local_rs);
}
else
{
/* Conflicting ones do however. To make this work, we need subobject associations. */
if (j == 0)
{
rt_pso_factory_add_pipeline_config(&factory, 2);
if (i == 2)
rt_pso_factory_add_subobject_to_exports_association(&factory, pconfig_index, 0, NULL);
}
if (j == 1)
{
rt_pso_factory_add_shader_config(&factory, 12, 8);
if (i == 2)
rt_pso_factory_add_subobject_to_exports_association(&factory, sconfig_index, 0, NULL);
}
if (j == 2)
{
rt_pso_factory_add_local_root_signature(&factory, local_rs_alt);
if (i == 2)
rt_pso_factory_add_subobject_to_exports_association(&factory, lrs_index, 0, NULL);
}
}
object = rt_pso_factory_compile(&context, &factory, D3D12_STATE_OBJECT_TYPE_RAYTRACING_PIPELINE);
if (i == 0 || i == 2)
ok(!!object, "Failed to create state object.\n");
else
ok(!object, "Successfully created RTPSO object which is not expected.\n");
if (object)
ID3D12StateObject_Release(object);
}
}
ID3D12RootSignature_Release(local_rs);
ID3D12RootSignature_Release(local_rs_alt);
ID3D12Device_Release(device);
destroy_raytracing_test_context(&context);
}

View File

@ -307,3 +307,6 @@ decl_test(test_shader_waveop_maximal_convergence);
decl_test(test_uav_3d_sliced_view);
decl_test(test_pipeline_no_ps_nonzero_rts);
decl_test(test_root_descriptor_offset_sign);
decl_test(test_raytracing_no_global_root_signature);
decl_test(test_raytracing_missing_required_objects);
decl_test(test_raytracing_reject_duplicate_objects);