@@ -86,7 +86,10 @@ pub(super) fn resolve_task_source(
8686 ) ) ;
8787 }
8888
89- if state. r#type == ReflectionProbeType :: OnChanges {
89+ if matches ! (
90+ state. r#type,
91+ ReflectionProbeType :: OnChanges | ReflectionProbeType :: Realtime
92+ ) {
9093 return resolve_runtime_capture_source ( render_space_id, probe, captures) ;
9194 }
9295 None
@@ -145,6 +148,7 @@ fn cubemap_residency_from_pool(
145148#[ cfg( test) ]
146149mod tests {
147150 use super :: * ;
151+ use crate :: backend:: AssetTransferQueue ;
148152 use crate :: shared:: { ReflectionProbeClear , ReflectionProbeState } ;
149153
150154 #[ test]
@@ -209,4 +213,50 @@ mod tests {
209213 assert ! ( matches!( skybox_source, Sh2ResolvedSource :: Postpone ) ) ;
210214 assert ! ( matches!( color_source, Sh2ResolvedSource :: Postpone ) ) ;
211215 }
216+
217+ #[ test]
218+ fn realtime_task_without_capture_postpones_runtime_cubemap_source ( ) {
219+ let mut scene = SceneCoordinator :: new ( ) ;
220+ let space_id = RenderSpaceId ( 7 ) ;
221+ scene. test_seed_space_identity_worlds ( space_id, Vec :: new ( ) , Vec :: new ( ) ) ;
222+ scene. test_push_reflection_probes (
223+ space_id,
224+ [ ReflectionProbeEntry {
225+ renderable_index : 0 ,
226+ transform_id : 12 ,
227+ state : ReflectionProbeState {
228+ renderable_index : 0 ,
229+ clear_flags : ReflectionProbeClear :: Skybox ,
230+ r#type : ReflectionProbeType :: Realtime ,
231+ ..Default :: default ( )
232+ } ,
233+ } ] ,
234+ ) ;
235+ let assets = AssetTransferQueue :: new ( ) ;
236+ let captures = RuntimeReflectionProbeCaptureStore :: default ( ) ;
237+
238+ let ( key, source) = resolve_task_source (
239+ & scene,
240+ & assets,
241+ & captures,
242+ space_id. 0 ,
243+ TaskHeader {
244+ renderable_index : 42 ,
245+ reflection_probe_renderable_index : 0 ,
246+ } ,
247+ )
248+ . expect ( "realtime probes should resolve to a postponed runtime cubemap source" ) ;
249+
250+ assert_eq ! (
251+ key,
252+ Sh2SourceKey :: RuntimeCubemap {
253+ render_space_id: space_id. 0 ,
254+ renderable_index: 0 ,
255+ generation: 0 ,
256+ size: 0 ,
257+ sample_size: DEFAULT_SAMPLE_SIZE ,
258+ }
259+ ) ;
260+ assert ! ( matches!( source, Sh2ResolvedSource :: Postpone ) ) ;
261+ }
212262}
0 commit comments