diff options
| author | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-10-28 07:47:45 -0400 |
|---|---|---|
| committer | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-10-28 07:47:45 -0400 |
| commit | 32d876ded1aefc52f839d65570e3e3c43ec04415 (patch) | |
| tree | 9030b5090a857d943b5b0341c499af7184abb192 /src/video_core/engines/kepler_compute.cpp | |
| parent | 598bb7750c71ea1378724ddfe9418f27330fa279 (diff) | |
nx2: read debug switches once; key scripts from a file
Several debug switches were read with std::getenv on every macro call, QMD,
semaphore write or draw. The UCRT getenv locks and scans the environment,
thousands of times a frame; a long EDEN_NX2_KEY_SCRIPT made title 4 crawl
at 2 fps. Each is now read once. EDEN_NX2_KEY_SCRIPT=@<file> reads the
script from a file. gdbrsp.py gains 'hits' (log registers, frame chain and
object words at breakpoints, following the stopped thread).
Diffstat (limited to 'src/video_core/engines/kepler_compute.cpp')
| -rw-r--r-- | src/video_core/engines/kepler_compute.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/video_core/engines/kepler_compute.cpp b/src/video_core/engines/kepler_compute.cpp index dc3f9b25b6..4954fe613a 100644 --- a/src/video_core/engines/kepler_compute.cpp +++ b/src/video_core/engines/kepler_compute.cpp @@ -134,7 +134,8 @@ bool KeplerCompute::ProcessNativeMethod(Core::System& system, u32 method, u32 ar }); if (!result.success) { native_macro->native_execution_failed = true; - if (std::getenv("EDEN_NATIVE_DRAW_DIAGNOSTICS")) { + if (static const bool diagnostics = std::getenv("EDEN_NATIVE_DRAW_DIAGNOSTICS") != nullptr; + diagnostics) { std::ofstream dump("native-compute-mme.bin", std::ios::binary); dump.write(reinterpret_cast<const char*>(native_macro->native_code.data()), sizeof(native_macro->native_code)); } @@ -162,7 +163,8 @@ bool KeplerCompute::ProcessNativeMethod(Core::System& system, u32 method, u32 ar LOG_DEBUG(HW_GPU, "Native inline QMD: address={:#x}, program={:#x}, control={:#x}, grid={}/{}/{}", address, program, control, native_registers[0xc8 + 12], native_registers[0xc8 + 13] & 0xffff, native_registers[0xc8 + 14] & 0xffff); - if (std::getenv("EDEN_NATIVE_DRAW_DIAGNOSTICS")) { + if (static const bool diagnostics = std::getenv("EDEN_NATIVE_DRAW_DIAGNOSTICS") != nullptr; + diagnostics) { std::ofstream dump("native-inline-qmd.bin", std::ios::binary); dump.write(reinterpret_cast<const char*>(native_registers.data() + 0xc8), 256); std::ofstream registers("native-inline-compute-registers.bin", std::ios::binary); @@ -203,7 +205,8 @@ bool KeplerCompute::ProcessNativeMethod(Core::System& system, u32 method, u32 ar memory_manager.GpuToCpuAddress(qmd_address).value_or(0), method, argument, 0); if (method == 0xae || (method == 0xaf && !(argument & 2)) || (method == 0xb0 && ((argument & 15) == 0 || (argument & 15) == 1))) return true; - if ((argument & 15) == 12 && std::getenv("EDEN_NATIVE_DRAW_DIAGNOSTICS")) { + static const bool qmd_diagnostics = std::getenv("EDEN_NATIVE_DRAW_DIAGNOSTICS") != nullptr; + if ((argument & 15) == 12 && qmd_diagnostics) { static u32 captured{}; if (captured++ == 0 && memory_manager.IsFullyMappedRange(qmd_address, 256)) { std::array<u32, 64> descriptor{}; @@ -288,7 +291,7 @@ bool KeplerCompute::ProcessNativeMethod(Core::System& system, u32 method, u32 ar if (memory_manager.IsFullyMappedRange(qmd_address, sizeof(qmd))) { memory_manager.ReadBlockUnsafe(qmd_address, qmd.data(), sizeof(qmd)); } - if (std::getenv("EDEN_NATIVE_DRAW_DIAGNOSTICS") && memory_manager.IsFullyMappedRange(qmd_address, sizeof(qmd))) { + if (qmd_diagnostics && memory_manager.IsFullyMappedRange(qmd_address, sizeof(qmd))) { std::ofstream dump("native-qmd.bin", std::ios::binary); dump.write(reinterpret_cast<const char*>(qmd.data()), sizeof(qmd)); std::ofstream macros("native-dispatch-mme.bin", std::ios::binary); |
