@@ -177,35 +177,37 @@ fn setup(
177177 ) )
178178 . with_child ( ( TextSpan :: default ( ) , overlay_config. text_config . clone ( ) ) ) ;
179179
180- let font_size = overlay_config. text_config . font_size ;
181- p. spawn ( (
182- Node {
183- width : Val :: Px ( font_size * FRAME_TIME_GRAPH_WIDTH_SCALE ) ,
184- height : Val :: Px ( font_size * FRAME_TIME_GRAPH_HEIGHT_SCALE ) ,
185- display : if overlay_config. frame_time_graph_config . enabled {
186- bevy_ui:: Display :: DEFAULT
187- } else {
188- bevy_ui:: Display :: None
189- } ,
190- ..Default :: default ( )
191- } ,
192- Pickable :: IGNORE ,
193- MaterialNode :: from ( frame_time_graph_materials. add ( FrametimeGraphMaterial {
194- values : buffers. add ( ShaderStorageBuffer {
195- // Initialize with dummy data because the default (`data: None`) will
196- // cause a panic in the shader if the frame time graph is constructed
197- // with `enabled: false`.
198- data : Some ( vec ! [ 0 , 0 , 0 , 0 ] ) ,
180+ if overlay_config. frame_time_graph_config . enabled {
181+ let font_size = overlay_config. text_config . font_size ;
182+ p. spawn ( (
183+ Node {
184+ width : Val :: Px ( font_size * FRAME_TIME_GRAPH_WIDTH_SCALE ) ,
185+ height : Val :: Px ( font_size * FRAME_TIME_GRAPH_HEIGHT_SCALE ) ,
186+ display : if overlay_config. frame_time_graph_config . enabled {
187+ bevy_ui:: Display :: DEFAULT
188+ } else {
189+ bevy_ui:: Display :: None
190+ } ,
199191 ..Default :: default ( )
200- } ) ,
201- config : FrameTimeGraphConfigUniform :: new (
202- overlay_config. frame_time_graph_config . target_fps ,
203- overlay_config. frame_time_graph_config . min_fps ,
204- true ,
205- ) ,
206- } ) ) ,
207- FrameTimeGraph ,
208- ) ) ;
192+ } ,
193+ Pickable :: IGNORE ,
194+ MaterialNode :: from ( frame_time_graph_materials. add ( FrametimeGraphMaterial {
195+ values : buffers. add ( ShaderStorageBuffer {
196+ // Initialize with dummy data because the default (`data: None`) will
197+ // cause a panic in the shader if the frame time graph is constructed
198+ // with `enabled: false`.
199+ data : Some ( vec ! [ 0 , 0 , 0 , 0 ] ) ,
200+ ..Default :: default ( )
201+ } ) ,
202+ config : FrameTimeGraphConfigUniform :: new (
203+ overlay_config. frame_time_graph_config . target_fps ,
204+ overlay_config. frame_time_graph_config . min_fps ,
205+ true ,
206+ ) ,
207+ } ) ) ,
208+ FrameTimeGraph ,
209+ ) ) ;
210+ }
209211 } ) ;
210212}
211213
0 commit comments