@@ -406,16 +406,18 @@ pub fn build_renderer_frame_plan(
406406 } ,
407407 ) ;
408408
409+ let ssgi_preparation = key. feature_mask & super :: FRAME_FEATURE_SSGI != 0 ;
410+ let pt_preparation = key. path_tracing != super :: PathTracingMode :: Off ;
409411 let mut previous_gi = None ;
410- if key . feature_mask & super :: FRAME_FEATURE_SSGI != 0 {
411- for name in [
412- "accel_rebuild" ,
413- "card_capture" ,
414- "sdf_bake" ,
415- "scene_sdf_clipmap" ,
416- "wsrc_bake" ,
417- "card_light" ,
418- ] {
412+ for ( name , enabled ) in [
413+ ( "accel_rebuild" , ssgi_preparation || pt_preparation ) ,
414+ ( "card_capture" , ssgi_preparation || pt_preparation ) ,
415+ ( "sdf_bake" , ssgi_preparation ) ,
416+ ( "scene_sdf_clipmap" , ssgi_preparation ) ,
417+ ( "wsrc_bake" , ssgi_preparation ) ,
418+ ( "card_light" , ssgi_preparation ) ,
419+ ] {
420+ if enabled {
419421 let pass = graph. add_pass ( name) ;
420422 if let Some ( previous) = previous_gi {
421423 graph. after ( pass, previous) ;
@@ -746,6 +748,65 @@ mod tests {
746748 assert ! ( plan. pass( "capture_readback" ) . is_none( ) ) ;
747749 }
748750
751+ #[ test]
752+ fn path_tracing_owns_shared_ray_scene_preparation_without_ssgi_bakes ( ) {
753+ let mut pt_key = key ( 0 ) ;
754+ pt_key. path_tracing = PathTracingMode :: Realtime ;
755+ pt_key. capability = CapabilityTier :: HardwareRayQuery ;
756+ let plan = build_renderer_frame_plan ( pt_key, wgpu:: TextureFormat :: Bgra8UnormSrgb )
757+ . compile ( CompileOptions :: CONSERVATIVE_ALIASING )
758+ . unwrap ( ) ;
759+ for present in [ "accel_rebuild" , "card_capture" , "pt" ] {
760+ assert ! ( plan. pass( present) . is_some( ) , "{present} must serve PT" ) ;
761+ }
762+ for absent in [
763+ "sdf_bake" ,
764+ "scene_sdf_clipmap" ,
765+ "wsrc_bake" ,
766+ "card_light" ,
767+ "ssgi" ,
768+ ] {
769+ assert ! (
770+ plan. pass( absent) . is_none( ) ,
771+ "{absent} must remain SSGI-only"
772+ ) ;
773+ }
774+ let names = plan
775+ . passes
776+ . iter ( )
777+ . map ( |pass| pass. name . as_str ( ) )
778+ . collect :: < Vec < _ > > ( ) ;
779+ assert ! (
780+ names
781+ . iter( )
782+ . position( |name| * name == "card_capture" )
783+ . unwrap( )
784+ < names. iter( ) . position( |name| * name == "pt" ) . unwrap( )
785+ ) ;
786+
787+ let mut combined_key = key ( FRAME_FEATURE_SSGI ) ;
788+ combined_key. path_tracing = PathTracingMode :: Realtime ;
789+ combined_key. capability = CapabilityTier :: HardwareRayQuery ;
790+ let combined = build_renderer_frame_plan ( combined_key, wgpu:: TextureFormat :: Bgra8UnormSrgb )
791+ . compile ( CompileOptions :: CONSERVATIVE_ALIASING )
792+ . unwrap ( ) ;
793+ for present in [
794+ "accel_rebuild" ,
795+ "card_capture" ,
796+ "sdf_bake" ,
797+ "scene_sdf_clipmap" ,
798+ "wsrc_bake" ,
799+ "card_light" ,
800+ "pt" ,
801+ "ssgi" ,
802+ ] {
803+ assert ! (
804+ combined. pass( present) . is_some( ) ,
805+ "{present} must serve the combined SSGI+PT topology"
806+ ) ;
807+ }
808+ }
809+
749810 #[ test]
750811 fn capture_is_a_terminal_copy_pass_over_named_logical_resources ( ) {
751812 let plan = build_renderer_frame_plan (
0 commit comments