@@ -852,6 +852,8 @@ bool reshade::d3d12::device_impl::create_pipeline(api::pipeline_layout layout, u
852852 uint32_t max_recursion_depth = 1 ;
853853 api::pipeline_flags flags = api::pipeline_flags::none;
854854
855+ bool has_raygen_option = false ;
856+
855857 for (uint32_t i = 0 ; i < subobject_count; ++i)
856858 {
857859 if (subobjects[i].count == 0 )
@@ -986,14 +988,17 @@ bool reshade::d3d12::device_impl::create_pipeline(api::pipeline_layout layout, u
986988 case api::pipeline_subobject_type::max_payload_size:
987989 assert (subobjects[i].count == 1 );
988990 max_payload_size = *static_cast <const uint32_t *>(subobjects[i].data );
991+ has_raygen_option = true ;
989992 break ;
990993 case api::pipeline_subobject_type::max_attribute_size:
991994 assert (subobjects[i].count == 1 );
992995 max_attribute_size = *static_cast <const uint32_t *>(subobjects[i].data );
996+ has_raygen_option = true ;
993997 break ;
994998 case api::pipeline_subobject_type::max_recursion_depth:
995999 assert (subobjects[i].count == 1 );
9961000 max_recursion_depth = *static_cast <const uint32_t *>(subobjects[i].data );
1001+ has_raygen_option = true ;
9971002 break ;
9981003 case api::pipeline_subobject_type::flags:
9991004 assert (subobjects[i].count == 1 );
@@ -1005,7 +1010,7 @@ bool reshade::d3d12::device_impl::create_pipeline(api::pipeline_layout layout, u
10051010 }
10061011 }
10071012
1008- if (!raygen_desc.empty () || !shader_groups.empty ())
1013+ if (has_raygen_option || !raygen_desc.empty () || !shader_groups.empty ())
10091014 {
10101015 com_ptr<ID3D12Device5> device5;
10111016 if (SUCCEEDED (_orig->QueryInterface (&device5)))
@@ -1316,7 +1321,7 @@ void reshade::d3d12::device_impl::destroy_pipeline(api::pipeline pipeline)
13161321 reinterpret_cast <IUnknown *>(pipeline.handle )->Release ();
13171322}
13181323
1319- bool reshade::d3d12::device_impl::create_pipeline_layout (uint32_t param_count, const api::pipeline_layout_param *params, api::pipeline_layout *out_layout)
1324+ bool reshade::d3d12::device_impl::create_pipeline_layout (uint32_t param_count, const api::pipeline_layout_param *params, api::pipeline_layout *out_layout, D3D12_ROOT_SIGNATURE_FLAGS flags )
13201325{
13211326 *out_layout = { 0 };
13221327
@@ -1470,29 +1475,34 @@ bool reshade::d3d12::device_impl::create_pipeline_layout(uint32_t param_count, c
14701475 internal_desc.pParameters = internal_params.data ();
14711476 internal_desc.NumStaticSamplers = static_cast <uint32_t >(internal_static_samplers.size ());
14721477 internal_desc.pStaticSamplers = internal_static_samplers.data ();
1473- internal_desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT;
1474-
1475- if ((global_visibility_mask & api::shader_stage::vertex) == 0 )
1476- internal_desc.Flags |= D3D12_ROOT_SIGNATURE_FLAG_DENY_VERTEX_SHADER_ROOT_ACCESS;
1477- if ((global_visibility_mask & api::shader_stage::hull) == 0 )
1478- internal_desc.Flags |= D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS;
1479- if ((global_visibility_mask & api::shader_stage::domain) == 0 )
1480- internal_desc.Flags |= D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS;
1481- if ((global_visibility_mask & api::shader_stage::geometry) == 0 )
1482- internal_desc.Flags |= D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS;
1483- if ((global_visibility_mask & api::shader_stage::pixel) == 0 )
1484- internal_desc.Flags |= D3D12_ROOT_SIGNATURE_FLAG_DENY_PIXEL_SHADER_ROOT_ACCESS;
1485- if ((global_visibility_mask & api::shader_stage::amplification) == 0 )
1486- internal_desc.Flags |= D3D12_ROOT_SIGNATURE_FLAG_DENY_AMPLIFICATION_SHADER_ROOT_ACCESS;
1487- if ((global_visibility_mask & api::shader_stage::mesh) == 0 )
1488- internal_desc.Flags |= D3D12_ROOT_SIGNATURE_FLAG_DENY_MESH_SHADER_ROOT_ACCESS;
1489-
1490- if (std::pair<D3D12_FEATURE_DATA_SHADER_MODEL, D3D12_FEATURE_DATA_D3D12_OPTIONS> options = { { D3D_SHADER_MODEL_6_6 }, {} };
1491- SUCCEEDED (_orig->CheckFeatureSupport (D3D12_FEATURE_SHADER_MODEL, &options.first , sizeof (options.first ))) &&
1492- SUCCEEDED (_orig->CheckFeatureSupport (D3D12_FEATURE_D3D12_OPTIONS, &options.second , sizeof (options.second ))) &&
1493- options.first .HighestShaderModel >= D3D_SHADER_MODEL_6_6 &&
1494- options.second .ResourceBindingTier >= D3D12_RESOURCE_BINDING_TIER_3)
1495- internal_desc.Flags |= D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED | D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED;
1478+ internal_desc.Flags = flags;
1479+
1480+ if (flags == D3D12_ROOT_SIGNATURE_FLAG_NONE)
1481+ {
1482+ internal_desc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT;
1483+
1484+ if ((global_visibility_mask & api::shader_stage::vertex) == 0 )
1485+ internal_desc.Flags |= D3D12_ROOT_SIGNATURE_FLAG_DENY_VERTEX_SHADER_ROOT_ACCESS;
1486+ if ((global_visibility_mask & api::shader_stage::hull) == 0 )
1487+ internal_desc.Flags |= D3D12_ROOT_SIGNATURE_FLAG_DENY_HULL_SHADER_ROOT_ACCESS;
1488+ if ((global_visibility_mask & api::shader_stage::domain) == 0 )
1489+ internal_desc.Flags |= D3D12_ROOT_SIGNATURE_FLAG_DENY_DOMAIN_SHADER_ROOT_ACCESS;
1490+ if ((global_visibility_mask & api::shader_stage::geometry) == 0 )
1491+ internal_desc.Flags |= D3D12_ROOT_SIGNATURE_FLAG_DENY_GEOMETRY_SHADER_ROOT_ACCESS;
1492+ if ((global_visibility_mask & api::shader_stage::pixel) == 0 )
1493+ internal_desc.Flags |= D3D12_ROOT_SIGNATURE_FLAG_DENY_PIXEL_SHADER_ROOT_ACCESS;
1494+ if ((global_visibility_mask & api::shader_stage::amplification) == 0 )
1495+ internal_desc.Flags |= D3D12_ROOT_SIGNATURE_FLAG_DENY_AMPLIFICATION_SHADER_ROOT_ACCESS;
1496+ if ((global_visibility_mask & api::shader_stage::mesh) == 0 )
1497+ internal_desc.Flags |= D3D12_ROOT_SIGNATURE_FLAG_DENY_MESH_SHADER_ROOT_ACCESS;
1498+
1499+ if (std::pair<D3D12_FEATURE_DATA_SHADER_MODEL, D3D12_FEATURE_DATA_D3D12_OPTIONS> options = { { D3D_SHADER_MODEL_6_6 }, {} };
1500+ SUCCEEDED (_orig->CheckFeatureSupport (D3D12_FEATURE_SHADER_MODEL, &options.first , sizeof (options.first ))) &&
1501+ SUCCEEDED (_orig->CheckFeatureSupport (D3D12_FEATURE_D3D12_OPTIONS, &options.second , sizeof (options.second ))) &&
1502+ options.first .HighestShaderModel >= D3D_SHADER_MODEL_6_6 &&
1503+ options.second .ResourceBindingTier >= D3D12_RESOURCE_BINDING_TIER_3)
1504+ internal_desc.Flags |= D3D12_ROOT_SIGNATURE_FLAG_CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED | D3D12_ROOT_SIGNATURE_FLAG_SAMPLER_HEAP_DIRECTLY_INDEXED;
1505+ }
14961506
14971507 com_ptr<ID3DBlob> signature_blob, error_blob;
14981508 com_ptr<ID3D12RootSignature> signature;
@@ -1532,6 +1542,10 @@ bool reshade::d3d12::device_impl::create_pipeline_layout(uint32_t param_count, c
15321542 return false ;
15331543 }
15341544}
1545+ bool reshade::d3d12::device_impl::create_pipeline_layout (uint32_t param_count, const api::pipeline_layout_param *params, api::pipeline_layout *out_layout)
1546+ {
1547+ return create_pipeline_layout (param_count, params, out_layout, D3D12_ROOT_SIGNATURE_FLAG_NONE);
1548+ }
15351549void reshade::d3d12::device_impl::destroy_pipeline_layout (api::pipeline_layout layout)
15361550{
15371551 if (layout == 0 )
0 commit comments