@@ -352,7 +352,12 @@ impl RenderThread {
352352
353353 // For x64 and aarch, process with denormal floats disabled (for performance, #194)
354354 #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" , target_arch = "aarch64" ) ) ]
355- let rendered = no_denormals:: no_denormals ( || graph. render ( & scope) ) ;
355+ let rendered = unsafe {
356+ // SAFETY: potentially risky - "modifying the masking flags, rounding mode, or
357+ // denormals-are-zero mode flags leads to immediate Undefined Behavior: Rust assumes
358+ // that these are always in their default state and will optimize accordingly."
359+ no_denormals:: no_denormals ( || graph. render ( & scope) )
360+ } ;
356361 #[ cfg( not( any( target_arch = "x86" , target_arch = "x86_64" , target_arch = "aarch64" ) ) ) ]
357362 let rendered = graph. render ( & scope) ;
358363
@@ -393,7 +398,12 @@ impl RenderThread {
393398
394399 // For x64 and aarch, process with denormal floats disabled (for performance, #194)
395400 #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" , target_arch = "aarch64" ) ) ]
396- no_denormals:: no_denormals ( || self . render_inner ( output_buffer) ) ;
401+ unsafe {
402+ // SAFETY: potentially risky - "modifying the masking flags, rounding mode, or
403+ // denormals-are-zero mode flags leads to immediate Undefined Behavior: Rust assumes
404+ // that these are always in their default state and will optimize accordingly."
405+ no_denormals:: no_denormals ( || self . render_inner ( output_buffer) )
406+ } ;
397407 #[ cfg( not( any( target_arch = "x86" , target_arch = "x86_64" , target_arch = "aarch64" ) ) ) ]
398408 self . render_inner ( output_buffer) ;
399409
0 commit comments