Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++

diagnostics: preserve whole-run XeSS cadence and sustained candidate evidence

Veyra Goal Agentd76577df7103
diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.md
index 796d4aab..b5894b34 100644
--- a/docs/CURRENT_STATUS.md
+++ b/docs/CURRENT_STATUS.md
@@ -3,7 +3,8 @@
## 当前执行入口(2026-09-21,链路复核后)
最新方案:[补帧稳定性与现有功能收尾](FG_STABILITY_COMPLETION_PLAN_2026-09-21.md)。
-用户已授权执行;源帧关联诊断已构建并运行,XeSS真实源时间提示候选短测有收益,
+用户已授权执行;源帧关联诊断已构建并运行,XeSS真实源时间提示候选在120秒测试中保持吞吐收益,
+整段统计仍发现约四分之一的输出间隔短于1ms及约46ms的偶发长间隔;后端/倍率切换回归通过。
尚未通过完整节奏/画质验收,默认仍关闭。详见
[本轮诊断与候选](FG_STABILITY_PROGRESS_2026-09-21.md)。
开发工作区为 `E:/项目/Veyra/worktrees/playback-nr-20260920`,
diff --git a/docs/FG_STABILITY_PROGRESS_2026-09-21.md b/docs/FG_STABILITY_PROGRESS_2026-09-21.md
index 34a15daf..bddfe355 100644
--- a/docs/FG_STABILITY_PROGRESS_2026-09-21.md
+++ b/docs/FG_STABILITY_PROGRESS_2026-09-21.md
@@ -91,10 +91,55 @@ Three synthetic analyzer tests pass (epoch boundaries, rebuild/revision,
missing/ambiguous joins); git diff --check passes. Initial analyzer omitted
epoch-boundary gaps: corrected before drawing conclusions or saving results.
+## Whole-run and lifecycle follow-up
+
+Added opt-in cumulative SDK-return histograms to XessPacing.cpp, bounded to
+1001 quarter-millisecond bins per phase. First5s from first hooked return and
+the remainder are separate. Percentiles are bin upper bounds (overflow uses
+observed maximum). Totals include boundary gaps and are emitted on hook
+release after provider context destruction, not per frame. They measure hook
+lifetime, not application launch or scanout; 2X has no pacing hook coverage.
+
+Same executable SHA256
+6eafd66777b4ce307ccfc14abe70324a694b67f98e66f77327988d0f0419ad74:
+heavy SR+NR+XeSS4, sequential120s on,30s off,30s on. Steady statistics:
+
+| Metric | Off30s | On30s | On120s |
+| --- | ---: | ---: | ---: |
+| SDK interval samples | 2928 | 4198 | 20841 |
+| Mean interval ms | 7.701 | 5.383 | 5.402 |
+| P50 upper ms | 8.500 | 4.250 | 4.250 |
+| P95 upper ms | 23.000 | 12.500 | 12.500 |
+| P99 upper ms | 23.250 | 18.750 | 18.750 |
+| Maximum ms | 41.124 | 43.733 | 45.954 |
+| Intervals under1ms | 668 | 997 | 4940 |
+| Intervals over10ms | 676 | 1008 | 4994 |
+| Retained source presents/s | 40.03 | 52.23 | 52.09 |
+| Process age-to-return P95 ms | 56.312 | 38.752 | 38.990 |
+
+All exit0/failed=false. Sustained throughput improvement repeats, but burst
+fraction and maximum gaps do not improve. Unequal run lengths make maxima
+and raw event counts unsuitable as comparative rates. The matched30s pair
+also has isolated >40ms gaps. This candidate is NOT uniform-cadence accepted.
+Earlier retained-tail maxima understated whole-run spikes. Default stays off.
+
+Evidence roots: tests/fg-stability-20260921/whole-{on120,off30,on30}.
+Build log: logs/fg-stability-whole-output-20260921.log; build exit0.
+Harness and fixed media/configuration are the same as above, with respective
+--seconds120/30/30 and source timing enabled only for on runs.
+
+ui-fg-backends.py EXE p001.mp4 OUTPUT --portable with timing candidate enabled
+passes12 selector transactions: XeSS/DLSS round trips, XeSS2X/4X rebuilds,
+DLSS6X to XeSS supported4X, and off. Three layout sizes checked. Evidence:
+tests/fg-stability-20260921/source-timing-switch/result.json and app.log.
+This script disables NR/SR and is a lifecycle check, not heavy-load visual,
+seek or continuous-resize acceptance. Analyzer3 synthetic tests still pass.
+
## Next acceptance and remaining phases
-Full-run interval aggregation, sustained run, dynamic
-seek/switch/resize and visual correspondence still required before enabling by
+Full-run interval aggregation, sustained run and selector switches now have
+evidence above. Dynamic seek/continuous-resize and visual correspondence
+remain required before enabling by
default. Do not call it an accepted complete repair. Investigate persistent
short/long burst boundaries independently; no extra queue or fixed wait.
P2 DLSS long gaps and P3-P6 remain as listed in the execution plan; this work
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index 78abf643..f3f5735e 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -5789,3 +5789,22 @@ Analyzer's3 synthetic tests pass; diff check passes. One combined shell
off/on loop was policy-rejected before execution; split into independent
invocations without the unnecessary environment removal and both completed.
No new runtime, published package replacement, push or goal completion.
+
+Follow-up whole-run diagnostics: XessPacing.cpp adds trace-only fixed-size
+SDK-return histograms, startup5s and steady phases, release-time summaries.
+Existing context destruction precedes hook release; no new wait or scheduling
+policy. Build command unchanged (build-isolated.ps1, target veyra); exit0,
+log E:/项目/Veyra/logs/fg-stability-whole-output-20260921.log.
+Copied build-root veyra.exe to existing isolated app staging. Matrix harness
+ran sr-nr-xess4 for120s candidate,30s control,30s candidate, sequentially with
+watchdogs. Evidence E:/项目/Veyra/tests/fg-stability-20260921/whole-on120,
+whole-off30,whole-on30. Full steady mean7.701->5.383ms and P99 upper
+23.25->18.75ms; sustained candidate mean5.402ms. Maxima41.124/43.733/45.954ms
+and short-gap fraction remain poor. Source40.03->52.23/s, sustained52.09/s.
+No uniform4X acceptance or default enablement. No loss of quality established
+or claimed: synchronized visual verification remains outstanding.
+Ran ui-fg-backends.py with staged EXE, native p001.mp4, output source-timing-switch,
+--portable and candidate enabled;12 switch transactions and layout checks pass,
+exit0. TEMP/TMP scoped to E:/项目/Veyra/tmp/fg-stability-20260921.
+test-xess-timeline.py3 tests pass; git diff --check passes. No new runtime,
+delivery package, push or release. Goal remains active; P2-P6 not completed.
diff --git a/src/gfx/XessPacing.cpp b/src/gfx/XessPacing.cpp
index 88002445..1aebb957 100644
--- a/src/gfx/XessPacing.cpp
+++ b/src/gfx/XessPacing.cpp
@@ -5,6 +5,7 @@
#include <algorithm>
#include <array>
+#include <cmath>
#include <cstring>
#include <filesystem>
#include <intrin.h>
@@ -20,6 +21,29 @@ using PresentFn = int64_t (*)(void*, uint32_t, uint32_t, uint64_t, void*, void*,
using SchedFn = bool (*)(void*, void*, uint8_t, void*, uint32_t);
using RingSnapshotFn = void* (*)(void*, void*);
+struct OutputIntervals {
+ // Quarter-millisecond bins, with a separate overflow bin at 250ms.
+ std::array<uint64_t,1001> bins{};
+ uint64_t samples=0, under1=0, over10=0;
+ double sumMs=0, maximumMs=0;
+ void add(double ms) {
+ if(ms<0)return;
+ ++samples;sumMs+=ms;maximumMs=(std::max)(maximumMs,ms);
+ under1+=ms<1;over10+=ms>10;
+ ++bins[static_cast<size_t>((std::min)(ms*4,1000.0))];
+ }
+ double percentileUpper(double fraction) const {
+ if(!samples)return 0;
+ const auto rank=static_cast<uint64_t>(std::ceil(double(samples)*fraction));
+ uint64_t cumulative=0;
+ for(size_t i=0;i<bins.size();++i){
+ cumulative+=bins[i];
+ if(cumulative>=rank)return i==1000?maximumMs:double(i+1)*0.25;
+ }
+ return maximumMs;
+ }
+};
+
struct PacingState {
std::mutex mutex;
std::mutex statsMutex;
@@ -48,6 +72,8 @@ struct PacingState {
int32_t logBudget = 6;
int64_t lastPresentQpc = 0, presentGapSum = 0, presentGapMax = 0;
uint64_t presentGapSamples = 0;
+ int64_t firstOutputQpc=0;
+ OutputIntervals startupOutputs,steadyOutputs;
std::array<int64_t,15> periods{};
size_t periodCount=0,periodPosition=0;
int64_t lastBurstQpc=0,periodQpc=0,intervalQpc=0,targetQpc=0;
@@ -63,6 +89,14 @@ double msFromQpc(const PacingState& s, int64_t qpc) {
return s.frequency.QuadPart > 0 ? (double(qpc) * 1000.0) / double(s.frequency.QuadPart) : 0.0;
}
+void logOutputIntervals(const char* phase,const OutputIntervals& stats) {
+ log::info("xess-output-total",std::format(
+ "phase={} samples={} meanMs={:.3f} p50UpperMs={:.3f} p95UpperMs={:.3f} p99UpperMs={:.3f} maxMs={:.3f} under1={} over10={} (cumulative per hook lifetime; 0.25ms bins; SDK returns, not scanout)",
+ phase,stats.samples,stats.samples?stats.sumMs/double(stats.samples):0,
+ stats.percentileUpper(0.50),stats.percentileUpper(0.95),stats.percentileUpper(0.99),
+ stats.maximumMs,stats.under1,stats.over10));
+}
+
std::string narrow(const std::wstring& value) {
if (value.empty()) return {};
const int length = WideCharToMultiByte(CP_UTF8, 0, value.c_str(), int(value.size()), nullptr, 0, nullptr, nullptr);
@@ -223,12 +257,17 @@ int64_t detour(void* ctx, uint32_t a2, uint32_t a3, uint64_t a4, void* arg5, voi
std::lock_guard statsLock(s.statsMutex);
if(s.lastPresentQpc!=0){
const auto gap=now.QuadPart-s.lastPresentQpc;
+ if(s.traceEnabled){
+ auto& totals=now.QuadPart-s.firstOutputQpc<s.frequency.QuadPart*5?s.startupOutputs:s.steadyOutputs;
+ totals.add(msFromQpc(s,gap));
+ }
s.presentGapSum+=gap;s.presentGapMax=(std::max)(s.presentGapMax,gap);
if(++s.presentGapSamples==240){
log::info("xess-present-gaps",std::format("samples={} meanMs={:.3f} maxMs={:.3f} (all hooked present returns, includes burst boundaries; not scanout)",s.presentGapSamples,msFromQpc(s,s.presentGapSum/int64_t(s.presentGapSamples)),msFromQpc(s,s.presentGapMax)));
s.presentGapSamples=0;s.presentGapSum=s.presentGapMax=0;
}
}
+ if(!s.firstOutputQpc)s.firstOutputQpc=now.QuadPart;
s.lastPresentQpc=now.QuadPart;
return result;
}
@@ -296,6 +335,7 @@ XessPacing::State XessPacing::install(HMODULE provider, uint32_t generatedFrames
s.scheduled = s.refused = s.forwarded = s.bypassed = 0;
s.lastScheduledQpc = 0;
s.lastPresentQpc=s.presentGapSum=s.presentGapMax=0;s.presentGapSamples=0;
+ s.firstOutputQpc=0;s.startupOutputs={};s.steadyOutputs={};
s.periods={};s.periodCount=s.periodPosition=0;
s.lastBurstQpc=s.periodQpc=s.intervalQpc=s.targetQpc=0;s.fallbackFrames=0;
s.gapSum = s.gapSamples = 0;
@@ -333,6 +373,11 @@ void XessPacing::release() {
s.native = nullptr;
s.sched = nullptr;
s.ringSnapshot = nullptr;
+ if(s.traceEnabled){
+ std::lock_guard statsLock(s.statsMutex);
+ logOutputIntervals("startup-first5s",s.startupOutputs);
+ logOutputIntervals("steady-after5s",s.steadyOutputs);
+ }
log::info("xess-pacing", std::format("removed (scheduled={} refused={} bypassed={} forwarded={} fallbackFrames={})",
s.scheduled, s.refused, s.bypassed, s.forwarded,s.fallbackFrames));
}