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++
fix(fg): seed affordable rejected pairs without extra recovery gap
Veyra Goal Agent57213e106291
diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.mdindex 9635dd19..358819e1 100644--- a/docs/CURRENT_STATUS.md+++ b/docs/CURRENT_STATUS.md@@ -1,5 +1,7 @@# 当前项目状态 / Current Status+最新恢复修正:预算不足时在当前原帧完成可承受的单次预热,避免下一组再次只出原帧。固定 6X 同参数约 280 提交/s,仍有约 15ms 空档,尚未完成均匀呈现修复。126 项 CPU 检查、2X/6X GPU 恢复检查、生命周期、主程序启动和 XeSS 2X 短测通过。详情见本轮部分验收文档,不能用降档结果替代固定 6X 验收。+更新:2026-09-20。发布状态与开发状态分别记录,历史计划不代表当前验收。最新固定 6X 调查:同一 p001.mp4、RTX5070、NR 开启、4K 目标,首帧截止时间与排队成本修正后,固定 6X 末尾留存窗口约 265 提交/s,但仍有 15-17ms 空档,**尚未通过均匀呈现验收**。2X 仍稳定 120;请求 6X 自动回退实际 4X 时稳定 240,此结果不能代替固定 6X 修复。关闭 NR 的诊断对照固定 6X 可达稳定 360,不作为用户解决方案。121 项 CPU 检查及 GPU 恢复/倍率检查通过,详见 [本轮部分验收](FG_CADENCE_REPAIR_ACCEPTANCE_2026-09-20.md)。仅本地构建,未打包或发布。diff --git a/docs/FG_CADENCE_REPAIR_ACCEPTANCE_2026-09-20.md b/docs/FG_CADENCE_REPAIR_ACCEPTANCE_2026-09-20.mdindex 8c54f8af..2203dd28 100644--- a/docs/FG_CADENCE_REPAIR_ACCEPTANCE_2026-09-20.md+++ b/docs/FG_CADENCE_REPAIR_ACCEPTANCE_2026-09-20.md@@ -1,5 +1,36 @@# FG cadence: partial acceptance, fixed 6X still open+## Latest continuation: seed on rejected input++Rejected full groups may now perform one affordable reset evaluation on the+same real input. The next adjacent input can generate immediately, avoiding+an additional real-only warmup group. The admission callback returns an+explicit Skip/Evaluate/Seed decision exactly once. Seed affordability does+not advance budget recovery, and seed-only output remains budget-limited.++Current sequential RTX5070 runs, same media/settings as below:++| Run | Duration | Retained seconds | Submit FPS | P95 / max gap ms |+| --- | ---: | ---: | ---: | ---: |+| reseed-default6, NR on fixed 6X | 45s | 5.483 | 279.593 | 15.105 / 16.747 |+| reseed-default2, NR on 2X | 30s | 9.742 | 119.998 | 8.782 / 9.039 |++The fixed6 retained window contains 240 full groups and 88 seed-only groups;+rejection and warmup counters refer to the same 88 inputs, not 176 inputs.+It has one sub-ms gap, one gap over 16.667ms and no generated discards.+This is an improvement, **not fixed6 uniform-cadence acceptance**. No physical+scanout or screen latency measurement. Prior rollback is ec0f57d.++CPU suite: 126 PASS. reseed-content2/content6 validate reset, seed, true skip,+single callback, dynamic multipliers, PTS and accounting, with zero D3D12+errors. reseed-lifecycle passes pause/seek/resume/mode changes/resize/stop.+reseed-smoke passes main startup and exit. reseed-xess2 runs 30s, app60/s,+SDK120/s in final samples, no admission skips or expirations; not scanout.+All targets built in reseed-metrics-build.log. Evidence under+E:/项目/Veyra/{tests,logs}/fg-cadence-repair-20260920.+The temporary double-callback experiment switch was removed before these+final runs. The historical results below describe the prior checkpoint.+## Scope and resultBranch: `codex/fg-cadence-audit-20260920`. RTX5070, user p001.mp4,diff --git a/docs/FG_CADENCE_REPAIR_PLAN_2026-09-20.md b/docs/FG_CADENCE_REPAIR_PLAN_2026-09-20.mdindex 717bd056..a55eacb1 100644--- a/docs/FG_CADENCE_REPAIR_PLAN_2026-09-20.md+++ b/docs/FG_CADENCE_REPAIR_PLAN_2026-09-20.md@@ -1,5 +1,9 @@# Fixed-media DLSS cadence repair+Continuation: affordable same-input reseeding removes a second lost group+after budget rejection. Fixed6 now measures about280 submissions/s, still+with15ms holes; acceptance remains open. Fallback is not the requested fix.+Latest continuation: prefix admission, carried queue prediction and minimumfile output spacing are now enabled normally; command allocator budget16,two-job capacity unchanged. Experimental admission/spacing flags removed.diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex 83c1fb73..5b448089 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -1,5 +1,28 @@# Veyra 工作记录+## 2026-09-20 Affordable same-input FG seed++Full-group rejection previously forced another real-only warmup on the next+input. Introduced explicit single-call Skip/Evaluate/Seed admission; an+affordable reset seeds the rejected input without publishing interpolation.+GPU candidate accounting and budget-limited reporting remain honest.+Build command: scripts/build-isolated.ps1, reused build/slider-reset-20260919,+targets veyra_fg_sustained_tests, veyra_fg_admission_tests,+veyra_presentation_worker_tests, veyra_presentation_pacing_tests, veyra.+Build log: E:/项目/Veyra/logs/fg-cadence-repair-20260920/reseed-metrics-build.log.+run-short-test.ps1 runs: reseed-default6 (45s, fixed6 NR on), reseed-default2+(30s, >=95% throughput), reseed-content2/content6, reseed-xess2 (30s),+reseed-lifecycle and reseed-smoke (--smoke-empty --smoke-seconds 5). All exit0.+CPU reseed-cpu.log:126 PASS. Integration debugErrors0. Trace analysis via+scripts/acceptance/analyze-fg-cadence.py: fixed6 retained5.483s,279.593/s,+P95/max15.105/16.747ms; 2X retained9.742s,119.998/s,P95/max8.782/9.039ms.+XeSS final app60 SDK120/s, no rejection/expiration. These are software+measurements, not scanout. Outputs E:/项目/Veyra/tests/fg-cadence-repair-20260920;+temporary environment E:/项目/Veyra/tmp/fg-cadence-repair-20260920.+No new runtime, package or publication. Fixed6 uniform cadence still fails.+Two documentation patches failed context validation without changing files;+corrected patch applied. Prior known checkpoint ec0f57d remains available.+## 2026-09-20 存档与 DLSS 高读数低流畅度调查按用户要求先提交已有修复与验收文档为 `b2c3d0e`,标签 `checkpoint/pre-fg-cadence-audit-20260920`,创建 `codex/fg-cadence-audit-20260920`。本轮只改持续测试的停机后内存 trace 导出、新增分析脚本及文档,未改变产品调度。完整命令、设置、统计与下一步修复门槛见 `docs/FG_CADENCE_AUDIT_2026-09-20.md`。diff --git a/include/veyra/engine/FgRecoveryBudget.h b/include/veyra/engine/FgRecoveryBudget.hindex 5f6ebd07..ea4ff765 100644--- a/include/veyra/engine/FgRecoveryBudget.h+++ b/include/veyra/engine/FgRecoveryBudget.h@@ -61,14 +61,17 @@ public:int64_t processingAllowance(int64_t now,int64_t interval)const{return int64_t(std::min(double(std::max<int64_t>(0,interval)),baseCost(now).value_or(0)*10000));}- bool admit(int64_t now,int64_t deadline,double elapsed,double present,bool warmingHistory=false,double queuedMs=0){+ bool canAdmit(int64_t now,int64_t deadline,double elapsed,double present,bool warmingHistory=false,double queuedMs=0)const{const auto cost=predicted(now,warmingHistory);// FG has not been submitted at admission. CPU time can at most cover// the base work; it must never erase the cost of future FG calls.const double queued=std::isfinite(queuedMs)?std::max(0.0,queuedMs):0.0;const double progress=std::clamp(elapsed,0.0,queued+baseCost(now).value_or(0));const bool fits=double(deadline-now)/10000+10>=std::max(0.0,queued+cost.value_or(0)-progress)+std::max(0.0,present);- return recordAdmission(fits);+ return fits;+ }+ bool admit(int64_t now,int64_t deadline,double elapsed,double present,bool warmingHistory=false,double queuedMs=0){+ return recordAdmission(canAdmit(now,deadline,elapsed,present,warmingHistory,queuedMs));}bool admitFile(int64_t now,int64_t firstDeadline,int64_t lastDeadline,int64_t outputInterval,double elapsed,double present,std::optional<double> firstFgMs,bool warmingHistory,double queuedMs){diff --git a/include/veyra/pipeline/EnhanceGraph.h b/include/veyra/pipeline/EnhanceGraph.hindex fde54150..c229df80 100644--- a/include/veyra/pipeline/EnhanceGraph.h+++ b/include/veyra/pipeline/EnhanceGraph.h@@ -151,7 +151,7 @@ public:struct FrameOutputs {FrameBatch batch;uint32_t fgCandidates=0,fgEvaluated=0,fgSkippedBeforeEval=0,fgSkippedForReset=0;- bool historyReset=false,fgRecovery=false;+ bool historyReset=false,fgRecovery=false,fgBudgetSeed=false;ResetReason detectedReset=ResetReason::None;bool contentDuplicate=false;int measuredContentRate=0;double ptsMs = 0.0;@@ -170,7 +170,8 @@ public:// does not own the demuxer). `reset` marks the first frame of a new// temporal epoch (open/seek/...): NVOF/FG history is not consumed.// Returns false on hard failure (run verdict must FAIL).- using FgAdmission=std::function<bool(const FrameBatch&,bool warmingHistory)>;+ enum class FgDecision { Skip, Evaluate, Seed };+ using FgAdmission=std::function<FgDecision(const FrameBatch&,bool warmingHistory)>;// `hardwareSurface` carries the decoded texture for paths whose surface// does not travel inside the AVFrame (D3D11VA). It must be provided exactly// when frame->format == AV_PIX_FMT_D3D11 and is unused otherwise.diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cppindex 2df1df04..c8aa3813 100644--- a/src/engine/EngineController.cpp+++ b/src/engine/EngineController.cpp@@ -1099,7 +1099,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sconst double elapsed=elapsedMs(processStart);const bool admitted=fgBudget.admit(now,deadline,elapsed,presentP95,warmingHistory);logAdmission(batch,now,deadline,elapsed,presentP95,admitted,warmingHistory,pairAnchoredLive?(isRemote?"decoded-pair":"capture-pair"):"continuous");- return admitted;+ return admitted?pipeline::EnhanceGraph::FgDecision::Evaluate:pipeline::EnhanceGraph::FgDecision::Skip;};}// File playback checks both the first output and whole-group@@ -1119,7 +1119,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,squeuedGpuMs=double(std::max<int64_t>(0,finish-start))/10000;}admitFg=[&,historyReset,queuedGpuMs](const pipeline::FrameBatch& batch,bool warmingHistory){- if(fileAwaitingVideo)return true; // Bounded startup lookahead; audio has not started.+ if(fileAwaitingVideo)return pipeline::EnhanceGraph::FgDecision::Evaluate; // Bounded startup lookahead; audio has not started.const auto interval=liveSourceInterval100ns(pkt.duration,activeSource->info().averageFps);const auto a=(historyReset||batch.b100ns<=batch.a100ns||batch.b100ns-batch.a100ns>10000000)?batch.b100ns-interval:batch.a100ns;const auto lastGenerated=pipeline::FrameBatch::interpolate(a,batch.b100ns,previewFgMultiplier-1,previewFgMultiplier);@@ -1131,7 +1131,10 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sconst auto elapsed=elapsedMs(processStart),blit=livePresentGpu.p95();const auto admitted=fgBudget.admitFile(now,firstDeadline,deadline,interval/previewFgMultiplier,elapsed,blit,first,warmingHistory,queuedGpuMs);logAdmission(batch,now,deadline,elapsed,blit,admitted,warmingHistory,"file-audio",firstDeadline,queuedGpuMs);- return admitted;+ if(admitted)return pipeline::EnhanceGraph::FgDecision::Evaluate;+ if(!warmingHistory&&fgBudget.canAdmit(now,deadline,elapsed,blit,true,queuedGpuMs))+ return pipeline::EnhanceGraph::FgDecision::Seed;+ return pipeline::EnhanceGraph::FgDecision::Skip;};}uint64_t processWaitBase=0,processSubmitBase=0;double processWaitMsBase=0,processSlotWaitMs=0;@@ -1237,7 +1240,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sframeFlow->update([&](auto& m){m.lastSubmit100ns=host100ns();});frameFlow->cpu(diagnostics::CpuStage::Submit,processMs,host100ns());frameFlow->cpu(diagnostics::CpuStage::SlotWait,processSlotWaitMs,host100ns());- frameFlow->update([&](auto& m){m.latest.frame=out.batch.identity;m.latest.batchId=out.batch.batchId;m.latest.readyFence=std::max(out.videoFenceValue,out.genFenceValue);m.counters.sourceAccepted+=!rereadCached;++m.counters.realSubmitted;m.counters.previewSkippedBeforeGraph+=previewSkippedSinceSubmit;m.counters.fgCandidate+=out.fgCandidates;m.counters.fgEvaluated+=out.fgEvaluated;m.counters.fgSkippedForReset+=out.fgSkippedForReset;m.counters.fgSkippedBeforeEval+=out.fgSkippedBeforeEval;if(out.fgSkippedBeforeEval)m.lastFgRejected100ns=host100ns();if(!out.hasGenerated)m.counters.fgWarmup+=out.fgEvaluated;});+ frameFlow->update([&](auto& m){m.latest.frame=out.batch.identity;m.latest.batchId=out.batch.batchId;m.latest.readyFence=std::max(out.videoFenceValue,out.genFenceValue);m.counters.sourceAccepted+=!rereadCached;++m.counters.realSubmitted;m.counters.previewSkippedBeforeGraph+=previewSkippedSinceSubmit;m.counters.fgCandidate+=out.fgCandidates;m.counters.fgEvaluated+=out.fgEvaluated;m.counters.fgSkippedForReset+=out.fgSkippedForReset;m.counters.fgSkippedBeforeEval+=out.fgSkippedBeforeEval;if(out.fgSkippedBeforeEval||out.fgBudgetSeed)m.lastFgRejected100ns=host100ns();if(!out.hasGenerated)m.counters.fgWarmup+=out.fgEvaluated;});previewSkippedSinceSubmit=0;if(transaction||frames==0){std::lock_guard lock(mutex_);snapshot_.captureHalfRate=halfRate;diff --git a/src/pipeline/EnhanceGraph.cpp b/src/pipeline/EnhanceGraph.cppindex b47b3dab..fc61b773 100644--- a/src/pipeline/EnhanceGraph.cpp+++ b/src/pipeline/EnhanceGraph.cpp@@ -1890,13 +1890,22 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frameconst bool fgBackendAvailable=fgEnabled_&&(fgBackend_&&fgBackend_->created());const unsigned fgMultiplier=previewMultiplier&&fgBackendAvailable?std::clamp(previewMultiplier,2u,desc_.fgMultiplier):desc_.fgMultiplier;out.fgCandidates=fgBackendAvailable?fgMultiplier-1:0;- const bool resetFg=reset||!prevValid_||fgHistorySkipped_;- const bool runFg=fgBackendAvailable&&(!admitFg||admitFg(out.batch,resetFg));+ bool resetFg=reset||!prevValid_||fgHistorySkipped_;+ const auto decision=fgBackendAvailable?(admitFg?admitFg(out.batch,resetFg):FgDecision::Evaluate):FgDecision::Skip;+ const bool runFg=decision!=FgDecision::Skip;+ // An overloaded preview pair may afford one reset evaluation now. Seed+ // on this real input so the following pair does not lose another group.+ const bool reseedRejected=decision==FgDecision::Seed;+ out.fgBudgetSeed=reseedRejected;+ if(reseedRejected)resetFg=true;// A reset has no usable A/B pair. Seed one complete 2X evaluation group;// all later subframes would repeat reset work and cannot be presented.const uint32_t fgCalls=resetFg?1:fgMultiplier-1;- if(runFg&&resetFg)out.fgSkippedForReset=out.fgCandidates-fgCalls;- out.fgRecovery=runFg&&fgHistorySkipped_;+ if(runFg&&resetFg){+ if(reseedRejected)out.fgSkippedBeforeEval=out.fgCandidates-fgCalls;+ else out.fgSkippedForReset=out.fgCandidates-fgCalls;+ }+ out.fgRecovery=runFg&&(fgHistorySkipped_||reseedRejected);if(fgBackendAvailable&&!runFg){out.fgSkippedBeforeEval=out.fgCandidates;fgHistorySkipped_=true;}if(!runFg)gpuTimer_.resolve(list);if (!ring_.submitAndSignal(slot)) return false;diff --git a/tests/integration/FgAdmissionTests.cpp b/tests/integration/FgAdmissionTests.cppindex 9ba9eb23..05bf6077 100644--- a/tests/integration/FgAdmissionTests.cpp+++ b/tests/integration/FgAdmissionTests.cpp@@ -39,7 +39,7 @@ int wmain(int argc,wchar_t** argv){bool observedWarmup=false;auto admission=[&](const auto&,bool warmingHistory){observedWarmup=warmingHistory;- return engine::admitLiveFg(reject?2000000:900000,1000000,0,std::nullopt,0);+ return engine::admitLiveFg(reject?2000000:900000,1000000,0,std::nullopt,0)?pipeline::EnhanceGraph::FgDecision::Evaluate:pipeline::EnhanceGraph::FgDecision::Skip;};ok=graph.process(frame,packet.pts.toDouble()*1000,i==0||i==20,out,packet.sequence,&packet.colorInfo,nullptr,false,admission);ok=ok&&(observedWarmup==(i==0||i==9||i==10||i==11||i==12||i==20||i==25||i==26||i==27||i==28));@@ -110,6 +110,34 @@ int wmain(int argc,wchar_t** argv){}std::cout<<"ADAPT requested="<<requested<<" effective="<<effective<<" pass="<<ok<<std::endl;}+ // Budget seeding must prime the current real input, publish no reset+ // interpolation, then resume on the very next adjacent input pair.+ for(unsigned i=0;ok&&i<9;++i){+ using Decision=pipeline::EnhanceGraph::FgDecision;+ const auto decision=(i==0||i==2||i==7)?Decision::Seed:i==4?Decision::Skip:Decision::Evaluate;+ pipeline::FramePacket packet;const AVFrame* frame=nullptr;+ ok=source.read(packet,&frame)==source::SourceReadStatus::Frame;+ pipeline::EnhanceGraph::FrameOutputs output;+ unsigned calls=0;+ auto admission=[&](const auto&,bool){++calls;return decision;};+ ok=ok&&graph.process(frame,packet.pts.toDouble()*1000,i==7,output,packet.sequence,&packet.colorInfo,nullptr,false,admission);+ const auto start=std::chrono::steady_clock::now();+ while(ok&&!graph.resolveGeneration(output)){+ if(std::chrono::steady_clock::now()-start>std::chrono::seconds(2)){ok=false;break;}wait.slice(.2);+ }+ const bool seed=decision==Decision::Seed||i==5;+ ok=ok&&calls==1&&output.fgBudgetSeed==(decision==Decision::Seed)&&output.fgCandidates==output.fgEvaluated+output.fgSkippedBeforeEval+output.fgSkippedForReset;+ if(seed)ok=ok&&output.fgEvaluated==1&&!output.hasGenerated&&output.batch.count==1&&output.fgRecovery;+ else if(decision==Decision::Skip)ok=ok&&!output.fgEvaluated&&output.batch.count==1;+ else ok=ok&&output.hasGenerated&&output.batch.count==multiplier&&output.fgEvaluated==multiplier-1;+ if(decision==Decision::Seed)ok=ok&&output.fgSkippedBeforeEval==multiplier-2&&output.fgSkippedForReset==0;+ for(unsigned j=0;ok&&j<output.batch.count;++j){+ const auto& f=output.batch.frames[j];+ if(f.kind==pipeline::FrameKind::Generated)ok=f.validity==pipeline::GenerationValidity::Valid&&f.pts100ns==pipeline::FrameBatch::interpolate(output.batch.a100ns,output.batch.b100ns,j+1,multiplier);+ else ok=f.pts100ns==packet.pts.to100ns();+ }+ std::cout<<"SEED frame="<<i<<" decision="<<unsigned(decision)<<" batch="<<output.batch.count<<" pass="<<ok<<std::endl;+ }ring.drainQueue();graph.shutdown();source.close();unsigned errors=0;if(info)for(UINT64 i=0;i<info->GetNumStoredMessagesAllowedByRetrievalFilter();++i){SIZE_T size=0;info->GetMessage(i,nullptr,&size);std::vector<uint8_t> data(size);auto* m=reinterpret_cast<D3D12_MESSAGE*>(data.data());if(SUCCEEDED(info->GetMessage(i,m,&size))&&m->Severity<=D3D12_MESSAGE_SEVERITY_ERROR){++errors;log::error("debug",m->pDescription);}}ok=ok&&errors==0;diff --git a/tests/unit/LiveGpuSchedulerTests.cpp b/tests/unit/LiveGpuSchedulerTests.cppindex 43e18e05..74eb0530 100644--- a/tests/unit/LiveGpuSchedulerTests.cpp+++ b/tests/unit/LiveGpuSchedulerTests.cpp@@ -82,6 +82,11 @@ int main(){check(!prefix.admitFile(10000000,10000000,10250000,27778,100,0,3,false,0),"CPU delay cannot erase future first interpolation work");prefix.complete(4,true,true,10000000);check(prefix.admitFile(10000000,9900000,10010000,27778,0,0,3,true,0),"history seed has no generated prefix to present");+ check(!prefix.admit(10000000,9900000,0,0),"reject overload before seed budget check");+ check(prefix.canAdmit(10000000,10010000,0,0,true),"cheap seed fits when complete group cannot");+ check(!prefix.canAdmit(10000000,9900000,0,0,true),"expired seed deadline still rejects");+ check(prefix.admit(10000000,10200000,0,0)&&prefix.recovering(),"first admitted group begins recovery");+ check(prefix.canAdmit(10000000,10010000,0,0,true)&&prefix.recovering(),"seed affordability query cannot falsely complete recovery");}{veyra::engine::FgRecoveryBudget queued;