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++
experiment: checkpoint source-aware XeSS timing candidate and measured limits
Veyra Goal Agentf049a1371741
diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.mdindex 1b2dca1d..796d4aab 100644--- a/docs/CURRENT_STATUS.md+++ b/docs/CURRENT_STATUS.md@@ -3,9 +3,11 @@## 当前执行入口(2026-09-21,链路复核后)最新方案:[补帧稳定性与现有功能收尾](FG_STABILITY_COMPLETION_PLAN_2026-09-21.md)。-本轮只完成方案和文档更新,尚未按新方案改代码或运行测试。+用户已授权执行;源帧关联诊断已构建并运行,XeSS真实源时间提示候选短测有收益,+尚未通过完整节奏/画质验收,默认仍关闭。详见+[本轮诊断与候选](FG_STABILITY_PROGRESS_2026-09-21.md)。开发工作区为 `E:/项目/Veyra/worktrees/playback-nr-20260920`,-分支 `codex/fg-utilization-20260921`、HEAD `e71d715`;现存未提交实验不等于已验收。+分支 `codex/fg-stability-20260921`;开工存档 `d2ae8ee`,诊断存档 `0143baf`。正式版仍为1.4.3,最新本地交付仍为下述1.4.4beta。- **XeSS**:真实1080p到4K超分+NR+4X的源帧连续性比1.4.3差;旧版反复diff --git a/docs/FG_STABILITY_COMPLETION_PLAN_2026-09-21.md b/docs/FG_STABILITY_COMPLETION_PLAN_2026-09-21.mdindex 160d3614..3d13c29e 100644--- a/docs/FG_STABILITY_COMPLETION_PLAN_2026-09-21.md+++ b/docs/FG_STABILITY_COMPLETION_PLAN_2026-09-21.md@@ -2,7 +2,9 @@日期:2026-09-21。状态:用户已授权执行,P0 时间线诊断进行中。开工存档 `d2ae8ee` / `checkpoint/pre-fg-stability-20260921`;-隔离分支 `codex/fg-stability-20260921`。尚无已验收的调度优化。+隔离分支 `codex/fg-stability-20260921`。尚无已完整验收的调度优化。+P0诊断已存档;P1真实源时间提示候选重复短测有收益、默认关闭,仍有输出突发。+证据及剩余验收见 [施工进展](FG_STABILITY_PROGRESS_2026-09-21.md)。允许本地修改、构建与有界测试,不推送、不打包发布。## 目标与边界diff --git a/docs/FG_STABILITY_PROGRESS_2026-09-21.md b/docs/FG_STABILITY_PROGRESS_2026-09-21.mdnew file mode 100644index 00000000..34a15daf--- /dev/null+++ b/docs/FG_STABILITY_PROGRESS_2026-09-21.md@@ -0,0 +1,102 @@+# FG stability execution evidence++## Scope and recoverable state++Worktree: E:/项目/Veyra/worktrees/playback-nr-20260920.+Branch: codex/fg-stability-20260921. Pre-work checkpoint d2ae8ee /+checkpoint/pre-fg-stability-20260921. Diagnostics checkpoint 0143baf.+Goal remains active. No release, package replacement or claim of completion.++## P0/P1: XeSS heavy-load timing candidate++Source-linked XeLL/Present diagnostics distinguish preparation cycle IDs from+actual source identities. Multiple queued sources can share a preparation+cycle; mismatch alone is not a failure. Provider output return records have+no source identity: they must not be attributed to a source by guessing.++Baseline source Present intervals alternate short/long around repeated epoch+resets. Within-burst generated spacing approaches 8.4ms despite consecutive+60fps source PTS; a 4X continuous pair corresponds to 4.167ms spacing.+The SDK scheduler waits are implicated, but exact internal causes remain open.++Candidate VEYRA_TEST_XESS_SOURCE_TIMING=1 supplies the actual consecutive source+PTS delta as frameRenderTime only when generation history is valid, identity+advances by exactly one, PTS increases, and delta is 0.125..500ms. Resets,+skips, repeated/unknown sources retain zero. It never feeds wall Present time+back, fills a fixed nominal period, adds waiting, disables effects or changes+the selected multiplier. Existing source correspondence checks still apply.+Default remains unchanged; this is a diagnostic candidate, not release approval.++Reference examined: Magpie 3841698348bfb246623d4acf791984c8b68a577b,+XeSSFGTiming.h, XeSSFGPresenter.cpp, XeSSFGPacing.h (clean checkout).+Magpie also has timestamp-deadline hooks absent from Veyra; its full timing+implementation has NOT been ported. This candidate uses existing source PTS+directly without copying the upstream median/fallback or timestamp hooks.++### Matched evidence++RTX5070, p001-derived1080.mp4 -> VideoSR quality3 4K + NR + XeSS4.+Same candidate executable, trace enabled, sequential 30s off/on runs:++| Metric | Off | On |+| --- | ---: | ---: |+| Retained source Present/s | 39.94 | 52.30 |+| NVML device GPU mean | 70.09% | 95.08% |+| Retained source interval P99 ms | 46.27 | 21.10 |+| Retained SDK return interval mean ms | 7.693 | 5.367 |+| Retained SDK return interval P99 ms | 23.25 | 18.58 |+| Retained SDK return maximum ms | 23.43 | 19.03 |+| Process age-to-Present-return P95 ms | 56.35 | 38.84 |+| SDK intervals under1ms / samples | 359/1566 | 399/1676 |+| SDK intervals over10ms / samples | 361/1566 | 401/1676 |++Both exit0, failed=false. The candidate improves throughput and long-gap+duration, but burst fractions do not improve. Short/long outputs remain;+this does NOT meet uniform4X acceptance. Source coverage remains below60.+No physical scanout, synchronized output-image quality comparison or glass-to-+glass latency measured. Ring tails differ in duration; raw counts are not+comparable rates. Original rings overwrite10697/16908 records respectively.++Earlier20s runs reproduce source39.98 ->52.35, native4K + NR XeSS4 remains+~60 source/s with candidate on. Neither pair establishes long-run stability.+Candidate-on20s2X smokes also maintain ~60 source/s for native4K+NR and+true1080p-to4K SR+NR, both exit0/failed=false. Evidence:+tests/fg-stability-20260921/source-timing-2x/{native-nr-xess2,sr-nr-xess2}.+These are source cadence/lifecycle checks, not2X visual or scanout acceptance.+The extra native SDK call instrumentation is opt-in and bounded, with no+per-frame file writes. It records return times, not physical display events.++### Commands and artifacts++Root for all artifacts: E:/项目/Veyra/.+Build: scripts/build-isolated.ps1 -Root . -BuildDirectory+E:/项目/Veyra/build/playback-nr-20260920 -DependencyCache+E:/项目/Veyra/build/frame-pacing-20260918/CMakeCache.txt -TempDirectory+E:/项目/Veyra/tmp/fg-stability-20260921 -Targets veyra -DisplayVersion 1.4.4beta.+Build logs: logs/fg-stability-{source-timing,output-trace}-20260921.log; exit0.+Initial staging Copy-Item guessed a Release subdirectory and failed without+copying; corrected to the actual build-root veyra.exe.++Test harness: scripts/acceptance/fg-utilization-matrix.py with --exe+tests/fg-stability-20260921/app/veyra.exe, native user p001.mp4 and derived+tests/nr-fg-followup-20260921/p001-derived1080.mp4, --cases sr-nr-xess4+--seconds30, process TEMP/TMP tmp/fg-stability-20260921. Each process has+seconds+45 watchdog. Evidence roots:+tests/fg-stability-20260921/{timeline-a,source-timing-b,output-off,output-on}.+Per-case result.json records executable hash, environment, exact argv and+telemetry; trace.txt/app.log/stdout.log preserve raw evidence.+analyze-xess-timeline.py generated adjacent xess-timeline.json files.++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.++## Next acceptance and remaining phases++Full-run interval aggregation, sustained run, dynamic+seek/switch/resize and visual correspondence still 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+does not change or complete them. Independent denoising prerequisites remain+unresolved. No software performance claim is extended to other GPUs.diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex 3b0e9932..78abf643 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -5771,3 +5771,21 @@ run or physical display measurements. Present cycle wall includes the returnpath before afterPresent, not pure GPU or exact DXGI duration. Next: distinguishprovider scheduler waits from resource waits before selecting a candidate.No performance improvement accepted, publication or goal completion claimed.++Follow-up: isolated real-source-PTS candidate behind+VEYRA_TEST_XESS_SOURCE_TIMING=1, default off. Only consecutive source IDs and+valid history supply positive PTS delta; resets/skips/unknown sources retain+zero. Added opt-in per-provider-output return trace (no guessed source ID).+Builds succeeded; logs/fg-stability-{source-timing,output-trace}-20260921.log.+Repeated30s same-EXE off/on heavy XeSS4: source39.94->52.30/s,+SDK retained return mean7.693->5.367ms, P99 23.25->18.58ms,+process age-to-return P95 56.35->38.84ms. Under1ms burst fraction remains+~23-24%, so no complete uniform-cadence acceptance. Native4X and native/SR2X+candidate short smokes retain60 source/s; all exit0/failed=false.+Evidence tests/fg-stability-20260921/{source-timing-b,output-off,output-on,+source-timing-2x}; exact argv/hash/environment in each result.json.+See FG_STABILITY_PROGRESS_2026-09-21.md for figures, scopes and next checks.+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.diff --git a/include/veyra/diagnostics/FrameTrace.h b/include/veyra/diagnostics/FrameTrace.hindex 2048a4bd..9037e63a 100644--- a/include/veyra/diagnostics/FrameTrace.h+++ b/include/veyra/diagnostics/FrameTrace.h@@ -5,7 +5,7 @@#include <vector>namespace veyra::diagnostics {-enum class TraceKind { Submitted, Ready, Present, Gpu, Reset, Cancelled, FrameReady, Discarded, XessSleep, XessBind, XessPresent };+enum class TraceKind { Submitted, Ready, Present, Gpu, Reset, Cancelled, FrameReady, Discarded, XessSleep, XessBind, XessPresent, ProviderOutput };inline const char* traceKindName(TraceKind kind) {switch(kind){case TraceKind::Submitted:return "Submitted";@@ -19,6 +19,7 @@ inline const char* traceKindName(TraceKind kind) {case TraceKind::XessSleep:return "XessSleep";case TraceKind::XessBind:return "XessBind";case TraceKind::XessPresent:return "XessPresent";+ case TraceKind::ProviderOutput:return "ProviderOutput";}return "Unknown";}diff --git a/include/veyra/engine/VideoPresenter.h b/include/veyra/engine/VideoPresenter.hindex 4ab11112..5ddc7e73 100644--- a/include/veyra/engine/VideoPresenter.h+++ b/include/veyra/engine/VideoPresenter.h@@ -16,7 +16,7 @@ class VideoPresenter {public:~VideoPresenter(){close();}bool open(gfx::D3D12DeviceContext&, HWND, pipeline::EnhanceGraph&, bool captureCompatible=false);- bool present(gfx::D3D12DeviceContext&,gfx::CommandSlotRing&,pipeline::EnhanceGraph&,unsigned slot,bool generated,bool referencesValid=true,int comparison=0,bool baseReference=false,float split=.5f,pipeline::FrameIdentity identity={},PreviewView view={});+ bool present(gfx::D3D12DeviceContext&,gfx::CommandSlotRing&,pipeline::EnhanceGraph&,unsigned slot,bool generated,bool referencesValid=true,int comparison=0,bool baseReference=false,float split=.5f,pipeline::FrameIdentity identity={},PreviewView view={},int64_t sourcePts100ns=-1);void close();bool beginSourceInput();bool beginSourceProcessing();@@ -85,6 +85,7 @@ private:std::chrono::steady_clock::time_point nextCostLog_{};std::chrono::steady_clock::time_point lastXessFrame_{};pipeline::FrameIdentity lastXessIdentity_{};+ int64_t lastXessPts100ns_=-1;bool xessWasEnabled_=false;bool xessFailed_=false;bool xessGenerationSuppressed_=false;diff --git a/scripts/acceptance/analyze-xess-timeline.py b/scripts/acceptance/analyze-xess-timeline.pyindex d2ea90cf..b696f231 100644--- a/scripts/acceptance/analyze-xess-timeline.py+++ b/scripts/acceptance/analyze-xess-timeline.py@@ -21,6 +21,10 @@ def analyze(path):for line in text.splitlines() if line.startswith("event=")]cycles = {}presents = [row for row in events if row["event"] == "Present"]+ outputs = sorted((row for row in events if row["event"] == "ProviderOutput"),+ key=lambda row: int(row["presentEndHost"]))+ output_gaps = [(int(current["presentEndHost"]) - int(previous["presentEndHost"])) / 10000+ for previous, current in zip(outputs, outputs[1:])]for event in events:if not event["event"].startswith("Xess"):continue@@ -69,6 +73,9 @@ def analyze(path):header = re.search(r"Frame trace: records=(\d+) capacity=(\d+) overwritten=(\d+)", text)return dict(scope="Retained bounded CPU trace only; Present wall time includes descheduling, not GPU execution or scanout.",overwritten=int(header[3]) if header else None, cycles=len(rows), linkedCycles=len(linked),+ sdkReturnIntervalMs=distribution(output_gaps),+ sdkReturnGapsOver10ms=sum(gap>10 for gap in output_gaps),+ sdkReturnGapsUnder1ms=sum(gap<1 for gap in output_gaps),missingOrAmbiguousLinks=len(rows)-len(linked),preparationCycleMismatch=sum(row["preparationCycle"] not in (None, 0, row["cycle"]) for row in rows),sleepMs=distribution([row["sleepMs"] for row in rows if row["sleepMs"] is not None]),diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cppindex bf708aa6..74c00892 100644--- a/src/engine/EngineController.cpp+++ b/src/engine/EngineController.cpp@@ -1346,7 +1346,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sconst auto presentBeginHost=host100ns();const auto begin=Clock::now();const auto before=presenter.submittedCount();presenter.reflexFrame(watch->reflexFrame);- if(!presenter.present(ctx,ring,graph,item.lease->slot,generated,item.lease->referencesValid,comparisonMode_,comparisonBase_,comparisonSplit_,item.identity,previewView()))return {State::Failed};+ if(!presenter.present(ctx,ring,graph,item.lease->slot,generated,item.lease->referencesValid,comparisonMode_,comparisonBase_,comparisonSplit_,item.identity,previewView(),item.pts100ns))return {State::Failed};const auto presentEndHost=host100ns();const double returnDeviation=deviationValid?nowMs()-itemPtsMs:0;item.lease->consumerFence=presenter.consumerFenceValue(ring.lastSignaledValue());const bool didPresent=presenter.submittedCount()>before;s.blit=presenter.blitTiming(ctx.fence());@@ -1460,7 +1460,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sfor(auto& item:out.batch.frames){if(!item.lease)continue;const auto begin=Clock::now();const auto before=presenter.submittedCount();- if(!presenter.present(ctx,ring,graph,item.lease->slot,false,item.lease->referencesValid,comparisonMode_,comparisonBase_,comparisonSplit_,item.identity,previewView())){presentFailed=true;break;}+ if(!presenter.present(ctx,ring,graph,item.lease->slot,false,item.lease->referencesValid,comparisonMode_,comparisonBase_,comparisonSplit_,item.identity,previewView(),item.pts100ns)){presentFailed=true;break;}item.lease->consumerFence=presenter.consumerFenceValue(ring.lastSignaledValue());framePresentMs+=elapsedMs(begin);frameFlow->cpu(diagnostics::CpuStage::Present,elapsedMs(begin),host100ns());if(presenter.submittedCount()>before){++submitted;frameFlow->presented(false,item.lease->consumerFence,host100ns());}diff --git a/src/engine/VideoPresenter.cpp b/src/engine/VideoPresenter.cppindex 246a89b4..1b0328fc 100644--- a/src/engine/VideoPresenter.cpp+++ b/src/engine/VideoPresenter.cpp@@ -73,7 +73,7 @@ bool VideoPresenter::open(gfx::D3D12DeviceContext& ctx,HWND window,pipeline::Enhreturn true;}void VideoPresenter::refresh(ID3D12Device* device){for(unsigned i=0;i<3;++i){Microsoft::WRL::ComPtr<ID3D12Resource> bb;if(SUCCEEDED(sink_.swapChain()->GetBuffer(i,IID_PPV_ARGS(&bb))))device->CreateRenderTargetView(bb.Get(),nullptr,{rtvs_->GetCPUDescriptorHandleForHeapStart().ptr+size_t(i)*inc_});}}-bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing& sharedRing,pipeline::EnhanceGraph& graph,unsigned slot,bool generated,bool referencesValid,int comparison,bool baseReference,float split,pipeline::FrameIdentity identity,PreviewView view) {+bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing& sharedRing,pipeline::EnhanceGraph& graph,unsigned slot,bool generated,bool referencesValid,int comparison,bool baseReference,float split,pipeline::FrameIdentity identity,PreviewView view,int64_t sourcePts100ns) {auto& ring=presentationQueue_?presentationRing_:sharedRing;auto* fence=presentationFence_?presentationFence_.Get():ctx.fence();const auto presentStart=std::chrono::steady_clock::now();@@ -173,7 +173,13 @@ bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing&// Present intervals include the provider's own wait. Do not feed that// wait back into its pacing. Intel explicitly permits zero when an// independent frame-time estimate is unavailable.- constexpr float elapsed=0.0f;+ float elapsed=0.0f;+ static const bool sourceTiming=GetEnvironmentVariableW(L"VEYRA_TEST_XESS_SOURCE_TIMING",nullptr,0)>0;+ if(sourceTiming&&!reset&&lastXessPts100ns_>=0&&sourcePts100ns>lastXessPts100ns_&&+ identity.sourceFrameId==lastXessIdentity_.sourceFrameId+1){+ const auto delta=double(sourcePts100ns-lastXessPts100ns_)/10000;+ if(delta>=0.125&&delta<500)elapsed=float(delta);+ }auto* motion=graph.presentMotion(slot);auto* depth=graph.presentDepth();if(enabled){@@ -201,7 +207,7 @@ bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing&if(!xess->tag(list,bb,mapped,depth,fullBuffer,true,reset,elapsed)){xessFailed_=true;return false;}gpuTimer_.mark(list,diagnostics::GpuStage::FgBatch,true);}else if(!xess->tag(list,bb,motion,depth,fgRect,false,reset,elapsed)){xessFailed_=true;return false;}- lastXessFrame_=now;lastXessIdentity_=identity;xessWasEnabled_=enabled;+ lastXessFrame_=now;lastXessIdentity_=identity;xessWasEnabled_=enabled;lastXessPts100ns_=sourcePts100ns;previousXessView_=view;previousXessWidth_=rc.right;previousXessHeight_=rc.bottom;}if(auto* fsr=sink_.fsr()){diff --git a/src/gfx/XessPacing.cpp b/src/gfx/XessPacing.cppindex 36cb745e..88002445 100644--- a/src/gfx/XessPacing.cpp+++ b/src/gfx/XessPacing.cpp@@ -25,6 +25,7 @@ struct PacingState {std::mutex statsMutex;ThunkHook hook;bool installed = false;+ const bool traceEnabled=GetEnvironmentVariableW(L"VEYRA_TEST_TRACE_XESS",nullptr,0)>0;uint8_t* base = nullptr;PresentFn native = nullptr;SchedFn sched = nullptr;@@ -209,7 +210,15 @@ int64_t detour(void* ctx, uint32_t a2, uint32_t a3, uint64_t a4, void* arg5, voielse if (caller == s.base + XessPacing::kLastFrameCallerRva) tryPace(ctx, arg5, arg6, arg7, true);else {std::lock_guard statsLock(s.statsMutex);++s.forwarded;}}+ const auto host=[](){return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now().time_since_epoch()).count()/100;};+ const auto nativeBegin=s.traceEnabled?host():0;const auto result=s.native(ctx, a2, a3, a4, arg5, arg6, arg7);+ if(s.traceEnabled){+ diagnostics::FrameTraceEvent event;event.kind=diagnostics::TraceKind::ProviderOutput;+ event.host100ns=event.presentEndHost=host();event.presentBeginHost=nativeBegin;+ event.milliseconds=double(event.presentEndHost-nativeBegin)/10000;+ Logger::instance().recordFrame(event);+ }LARGE_INTEGER now{};QueryPerformanceCounter(&now);std::lock_guard statsLock(s.statsMutex);if(s.lastPresentQpc!=0){