aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorTakoroka <137927095+Takoroka@users.noreply.github.com>2026-10-28 23:07:49 -0400
committerTakoroka <137927095+Takoroka@users.noreply.github.com>2026-10-28 23:07:49 -0400
commit25b674eabdb92212a6d8149d6616b2af59317695 (patch)
treebf842baa3e7da325eb570fe9e75c4b67b8f33b35 /src/common
parent571f9b58eb8a9c102a91a5d26cd32ebae4330232 (diff)
nx2: measure the TSC on AMD, no rethrows for rejected shaders, debug hooks off the hot path
- AMD CPUs have no CPUID leaf 0x15, so the TSC frequency stayed 0 and every guest CNTPCT read went through QueryPerformanceCounter (~10% of the game's main core in title 1). Measure it like Intel CPUs without a crystal frequency. - A rejected native shader was rethrown (two C++ throws) every time it was bound; return false instead (~1-2% of the GPU thread). - The semaphore watch, pushbuffer entry hashing, first-write trace and per-macro debug logs ran on every command word or macro call; they now cost a flag check unless their environment variable is set (~4% of the GPU thread). Also starts the macro engine's profile zone.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/cpu_features.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/common/cpu_features.cpp b/src/common/cpu_features.cpp
index 8ccb6847f7..52fd003c44 100644
--- a/src/common/cpu_features.cpp
+++ b/src/common/cpu_features.cpp
@@ -225,6 +225,13 @@ const CPUCaps g_cpu_caps = [] {
}
}
+ // AMD CPUs have no leaf 0x15 (Zen 4 stops at 0x10): measure their invariant TSC too, or every
+ // guest clock read (CNTPCT, which games read thousands of times a frame) goes through the
+ // host's much slower QueryPerformanceCounter.
+ if (caps.invariant_tsc && caps.tsc_frequency == 0) {
+ caps.tsc_frequency = X64::EstimateRDTSCFrequency();
+ }
+
if (max_std_fn >= 0x16) {
__cpuid(cpu_id, 0x16);
caps.base_frequency = cpu_id[0];