From 77d772217310dc734ce53289110c9be0885a0577 Mon Sep 17 00:00:00 2001 From: nmzik Date: Mon, 5 Oct 2026 18:28:36 +0400 Subject: [PATCH] shader: disable explicit MAD denormal checks for performance testing Comment out the five explicit flush checks and record the substantial 3DMiniGolf menu FPS drop on NVIDIA RTX 5080 Laptop GPU. Preserve separate multiply/add rounding and both NoContraction decorations. The matched runs used silent logging, no debugger, no Vulkan validation, and the cd9fc6ff revert on both revisions. Native denormal behavior remains GPU-dependent. --- .../recompiler/backend/spirv/spirvEmitterAlu.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/graphics/shader/recompiler/backend/spirv/spirvEmitterAlu.cpp b/src/graphics/shader/recompiler/backend/spirv/spirvEmitterAlu.cpp index b83e6db24..2d710558f 100644 --- a/src/graphics/shader/recompiler/backend/spirv/spirvEmitterAlu.cpp +++ b/src/graphics/shader/recompiler/backend/spirv/spirvEmitterAlu.cpp @@ -231,15 +231,18 @@ uint32_t EmitFPFma32(EmitterState& state, uint32_t a, uint32_t b, uint32_t c) { } uint32_t EmitFPMad32(EmitterState& state, uint32_t a, uint32_t b, uint32_t c) { - // Legacy MAD/MAC round and flush between multiply and add, irrespective of SP_DENORM. - a = EmitFlushF32DenormToSignedZero(state, a); - b = EmitFlushF32DenormToSignedZero(state, b); - c = EmitFlushF32DenormToSignedZero(state, c); + // Explicit denormal checks typically drop 3DMiniGolf menu FPS from 28-29 to 21-24 + // on NVIDIA RTX 5080 Laptop GPU, so leave them disabled for this experiment. + // a = EmitFlushF32DenormToSignedZero(state, a); + // b = EmitFlushF32DenormToSignedZero(state, b); + // c = EmitFlushF32DenormToSignedZero(state, c); const auto product = EmitFPMul32(state, a, b); state.builder.AddAnnotation(spv::OpDecorate, product, spv::DecorationNoContraction); - const auto sum = EmitFPAdd32(state, EmitFlushF32DenormToSignedZero(state, product), c); + // const auto sum = EmitFPAdd32(state, EmitFlushF32DenormToSignedZero(state, product), c); + const auto sum = EmitFPAdd32(state, product, c); state.builder.AddAnnotation(spv::OpDecorate, sum, spv::DecorationNoContraction); - return EmitFlushF32DenormToSignedZero(state, sum); + // return EmitFlushF32DenormToSignedZero(state, sum); + return sum; } uint32_t EmitFPMedTri32(EmitterState& state, uint32_t a, uint32_t b, uint32_t c) {