@@ -352,7 +352,12 @@ impl RenderThread {
352
352
353
353
// For x64 and aarch, process with denormal floats disabled (for performance, #194)
354
354
#[ 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
+ } ;
356
361
#[ cfg( not( any( target_arch = "x86" , target_arch = "x86_64" , target_arch = "aarch64" ) ) ) ]
357
362
let rendered = graph. render ( & scope) ;
358
363
@@ -393,7 +398,12 @@ impl RenderThread {
393
398
394
399
// For x64 and aarch, process with denormal floats disabled (for performance, #194)
395
400
#[ 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
+ } ;
397
407
#[ cfg( not( any( target_arch = "x86" , target_arch = "x86_64" , target_arch = "aarch64" ) ) ) ]
398
408
self . render_inner ( output_buffer) ;
399
409
0 commit comments