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++
Diagnose fixed 6X deadlines and retain prior pairs across soft drops
Veyra Goal Agent1be28a45d824
diff --git a/docs/FG_CADENCE_REPAIR_PLAN_2026-09-20.md b/docs/FG_CADENCE_REPAIR_PLAN_2026-09-20.mdindex 1e7c6bd1..9aba1922 100644--- a/docs/FG_CADENCE_REPAIR_PLAN_2026-09-20.md+++ b/docs/FG_CADENCE_REPAIR_PLAN_2026-09-20.md@@ -39,3 +39,30 @@ Input/depth barrier experiment and fixed20ms phase experiment were reverted forEvidence: E:/项目/Veyra/tests/fg-cadence-repair-20260920/{fixed6-slots16,fixed6-nr-off,barrier6,phase20-slots16}, corresponding stdout/stderr/JSON files; build logs slots-build.log, barrier-build.log, phase-build.log in E:/项目/Veyra/logs/fg-cadence-repair-20260920. All bounded harness runs exited0 for lifecycle only: minimumTargetRatio=0 deliberately disables a target-throughput assertion. No scanout measurement or subjective smoothness claim follows from these numbers.Next investigation must address the overload equilibrium: admitting work by the last generated deadline permits earlier subframes to expire, and repeated reject/warmup transitions remove additional temporal coverage. A fixed phase shift cannot cure a sustained throughput deficit. Any replacement must preserve original media time/audio speed, bounded queue/latency, accurate effective multiplier reporting and reset/resource lifetime correctness. XeSS final regression and lifecycle acceptance remain pending. Goal remains active; no shutdown until final work/report is complete.++## Queue and prefix deadline experiments++All below are 30-second NR-on fixed6X runs. Metrics cover only each final retained trace window. Test-only environment switches isolate changes from normal playback. Exit0 checks lifecycle, not throughput (minimumTargetRatio=0).++| Run | Submission FPS | P95 gap ms | Complete 6-frame batches | Discarded generated frames |+| --- | ---: | ---: | ---: | ---: |+| subframe16 | 62.663 | 17.926 | 0 | 1566 |+| queue16 | 66.883 | 17.854 | 0 | 1538 |+| first16 | 203.170 | 16.799 | 114 | 663 |+| reserve16 | 101.126 | 17.046 | 88 | 0 |+| profile16 | 276.589 | 14.363 | 168 | 244 |+| carry16 | 246.569 | 16.603 | 227 | 0 |+| spacing16 | 268.191 | 15.329 | 237 | 0 |+| spacing6 | 216.506 | 15.377 | 201 | 9 |+| remaining16 | 274.567 | 15.357 | 240 | 0 |+| always16 | 58.551 | 17.947 | 0 | 1620 |++Sixteen command slots unless named spacing6 (default6). Per-frame CPU fence observations show most baseline discards precede observed readiness; this is not exact GPU completion timing. A last-subframe-only deadline admits batches whose early frames are already infeasible. Using the first deadline with the whole batch cost over-rejects; measured first-FG stage cost improves admission. Carrying predicted GPU start across retired completion watches prevents underestimating queued work. Applying 90% minimum output spacing removes most catch-up bursts.++These are not accepted fixes: spacing16 still has 52 rejected pairs followed by 52 warmups in 5.709s, and spacing6 has 94 of each in 6.651s. Both retain periodic15-17ms holes. Command slot enlargement alone was previously ineffective. Pending experiment subtracts fence-completed stages from the queued-work prediction to test whether conservative accumulated predictions cause unnecessary rejection.++Hooks: VEYRA_TEST_TRACE_SUBFRAMES, ADMISSION_QUEUE, ADMISSION_FIRST, ADMISSION_RESERVE, ADMISSION_PROFILE, SUBFRAME_SPACING and ADMISSION_REMAINING (all admission/spacing names also prefixed VEYRA_TEST_). Failed alternatives must be removed before production enablement. Artifacts use tests/fg-cadence-repair-20260920/<run> and <run>.json; builds use corresponding logs/fg-cadence-repair-20260920/*-build.log. No physical scanout or subjective smoothness result is claimed.++remaining16 deducts stages whose completion fences passed: 48 rejected/warmup pairs remain in5.612s. always16 bypasses admission entirely (VEYRA_TEST_ADMISSION_ALWAYS), retains fixed6X and minimum spacing, and demonstrates unbounded lateness is not a solution: almost all generated frames expire before observed completion. Each60Hz input requires approximately NR6.8ms + flow1.2ms + FG9.8ms plus other work on this RTX5070. These serial GPU stages exceed16.667ms, independently of CPU completion polling. This is evidence of a compute deficit at the tested quality, not an excuse for the baseline80fps collapse.++A separate code defect was found at soft-drop boundaries: incrementing presentationGeneration invalidated earlier leased A/B output when a later input was dropped. Keep resetting processing history, but increment the presentation generation only on hard boundaries. Add regression checks for drop-only, explicit-reset-plus-drop, and resize-plus-drop. This does not override expiry, resource fences, or comparison suppression; GPU regression is pending.diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex d3a016b1..34b69f8f 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -4740,3 +4740,15 @@ User explicitly clarified automatic downshift is only a fallback; full6X unevenConfirmed full6X with effects off on p001.mp4: retained360.002 software submissions/s, P95 interval3.3488ms; not the requested NR-on acceptance. NR-on enlarged command ring removes CPU waits but remains61.196/s. Removing repeated FG input/depth COMMON transitions yielded77.230/s; adding fixed20ms file phase with16 slots yielded62.609/s. Both experiments reverted. Details, boundaries and artifact paths are appended to docs/FG_CADENCE_REPAIR_PLAN_2026-09-20.md. No new runtime files.Commands: scripts/build-isolated.ps1 with reused build/slider-reset-20260919, target veyra_fg_sustained_tests, DisplayVersion1.4.3, explicit E:/项目/Veyra/tmp/fg-cadence-repair-20260920; scripts/run-short-test.ps1 with p001, multiplier6, profile file-4k, duration30/45 and timeout110; python scripts/acceptance/analyze-fg-cadence.py <run>/frame-trace.txt --trace --output <run>.json. One analyzer invocation ran before barrier6 exited and correctly reported missing trace; repeated after process exit successfully. All GPU runs sequential. Current fixed6X NR-on issue remains unresolved, and the active goal is not marked complete. No shutdown, package or publication.++### Fixed6X queue/prefix diagnostics (continued)++Added opt-in per-subframe readiness/discard traces and analyzer correlation; observations are upper bounds on GPU completion. Tested queued cost, first-frame admission, measured first-FG cost, carried queue prediction and minimum output spacing. Full results and failed variants are recorded in FG_CADENCE_REPAIR_PLAN_2026-09-20.md. Best retained16-slot result268.191 submissions/s has zero discarded generated frames and zero sub-ms bursts but still15-17ms holes; default6 slots216.506/s, nine discarded frames. Neither passes fixed6X cadence acceptance. Production behavior has not enabled these experimental hooks.++Build/run/analyze commands remain those above; each new run30s with95s watchdog, GPU runs sequential. New artifacts subframe16, queue16, first16, reserve16, profile16, carry16, spacing16, spacing6 in E:/项目/Veyra/tests/fg-cadence-repair-20260920. remaining-build.log succeeded; remaining16 tests completion-fence-informed queue estimates next. No shutdown or publication.++remaining16 reached274.567/s in its retained window but kept48 rejected/warmup pairs; always16 (admission bypass) collapsed to58.551/s with1620 expired generated frames. Neither accepted. Build reset-boundary-build.log succeeded for sustained, live timing and presentation worker tests. Both CPU logs contain no FAIL, including four new soft/hard presentation-boundary checks and five queue-budget checks. Soft drop now resets processing history without suppressing a prior still-leased interpolation pair; hard boundaries continue to invalidate it.++XeSS xess-final2 and xess-final4 ran30s each: lifecycle passed, app submissions60/s, SDK-reported output120/240 respectively, no admission skips or post-evaluation expiration in reported samples. These are not per-subframe scanout measurements. content-build.log succeeded, content6 GPU regression exited0 (150s watchdog, actual about5s): dynamic2/4/6/default, reset/recovery and D3D12 validation passed with zero errors. Diagnostic readback on source frames13/21/29 found adjacent generated images different (3.0-6.9 million changed RGB channels; mean absolute byte difference0.218-1.079). This excludes byte-identical repetition in these samples, not incorrect temporal order or interpolation artifacts. Readback is test-only. Artifacts remain under the previously recorded E:/ paths.++Fixed6X uniform-cadence acceptance remains open. Experimental queue/profile/spacing controls remain opt-in and must not be described as production-ready. No publication, package or shutdown.diff --git a/include/veyra/diagnostics/FrameTrace.h b/include/veyra/diagnostics/FrameTrace.hindex b4c9b7f7..b9ec2850 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 };+enum class TraceKind { Submitted, Ready, Present, Gpu, Reset, Cancelled, FrameReady, Discarded };inline const char* traceKindName(TraceKind kind) {switch(kind){case TraceKind::Submitted:return "Submitted";@@ -14,6 +14,8 @@ inline const char* traceKindName(TraceKind kind) {case TraceKind::Gpu:return "Gpu";case TraceKind::Reset:return "Reset";case TraceKind::Cancelled:return "Cancelled";+ case TraceKind::FrameReady:return "FrameReady";+ case TraceKind::Discarded:return "Discarded";}return "Unknown";}diff --git a/include/veyra/engine/FgRecoveryBudget.h b/include/veyra/engine/FgRecoveryBudget.hindex 64c3a1b0..5f3774db 100644--- a/include/veyra/engine/FgRecoveryBudget.h+++ b/include/veyra/engine/FgRecoveryBudget.h@@ -56,12 +56,13 @@ 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){+ bool admit(int64_t now,int64_t deadline,double elapsed,double present,bool warmingHistory=false,double queuedMs=0){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 progress=std::clamp(elapsed,0.0,baseCost(now).value_or(0));- const bool fits=double(deadline-now)/10000+10>=std::max(0.0,cost.value_or(0)-progress)+std::max(0.0,present);+ 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);if(!fits){limited_=true;recoveryPairs_=0;return false;}diff --git a/include/veyra/engine/LivePresentationResetPolicy.h b/include/veyra/engine/LivePresentationResetPolicy.hindex cfac3ed6..bfe75bcf 100644--- a/include/veyra/engine/LivePresentationResetPolicy.h+++ b/include/veyra/engine/LivePresentationResetPolicy.h@@ -5,9 +5,13 @@namespace veyra::engine {-// A capture mailbox overwrite breaks temporal processing history, but it does-// not invalidate already-produced real frames. Keep those real frames eligible-// for presentation while suppressing generated frames from the prior epoch.+// A missing future input breaks processing history, not an earlier A/B pair+// whose generated textures are still leased. Hard boundaries invalidate both.+constexpr bool presentationGenerationResetRequired(bool explicitReset, pipeline::FrameFlags flags) {+ return explicitReset || pipeline::breaksHistory(+ flags & ~static_cast<pipeline::FrameFlags>(pipeline::FrameFlagBits::Drop));+}+constexpr bool presentationDrainRequired(bool explicitReset, pipeline::FrameFlags flags) {return explicitReset|| pipeline::hasFrameFlag(flags, pipeline::FrameFlagBits::Resize)diff --git a/scripts/acceptance/analyze-fg-cadence.py b/scripts/acceptance/analyze-fg-cadence.pyindex 912bc66d..725b21b0 100644--- a/scripts/acceptance/analyze-fg-cadence.py+++ b/scripts/acceptance/analyze-fg-cadence.py@@ -100,6 +100,19 @@ def analyze_trace(path):key = state(a) + "->" + state(b)transitions[key] = transitions.get(key, 0) + 1span = (int(presents[-1]["host"]) - int(presents[0]["host"])) / 1e7+ ready = {(e["batch"], e["detail"]): e for e in events if e["event"] == "FrameReady"}+ discarded = [e for e in events if e["event"] == "Discarded"]+ observed_delays = [(int(e["host"]) - int(ready[(e["batch"], e["detail"])]["host"])) / 10000+ for e in discarded if (e["batch"], e["detail"]) in ready]+ discard_summary = {+ "count": len(discarded),+ "withRetainedReadyObservation": len(observed_delays),+ "readyObservedBeforeDiscard": sum(v >= 0 for v in observed_delays),+ "readyObservedAfterDiscard": sum(v < 0 for v in observed_delays),+ "observedReadyToDiscardMs": distribution(observed_delays) if observed_delays else None,+ "latenessMs": distribution([float(e["ms"]) for e in discarded]) if discarded else None,+ "note": "CPU fence observations are upper bounds on GPU completion time; absent observations are unknown",+ }return {"scope": "Bounded memory trace, final retained window only; software submission, not scanout","seconds": span, "samples": len(presents), "submitFps": (len(presents) - 1) / span,"intervalMs": distribution(intervals),@@ -110,6 +123,7 @@ def analyze_trace(path):"batchPresentCounts": counts, "onlyRealBatches": len(only_real),"onlyRealRejectedBatches": rejected, "onlyRealWarmupBatches": warmup,"batchTransitions": transitions,+ "discardedSubframes": discard_summary,"presentCpuMs": distribution([float(p["ms"]) for p in presents]),"mediaStepMs": distribution([(int(b["pts"]) - int(a["pts"])) / 10000 for a, b in zip(presents, presents[1:])])}diff --git a/src/base/Log.cpp b/src/base/Log.cppindex 04276054..4758d1fd 100644--- a/src/base/Log.cpp+++ b/src/base/Log.cpp@@ -170,7 +170,9 @@ std::string Logger::diagnosticReport(){std::ostringstream o;o<<"Veyra 本地诊o<<"\nFrame trace: records="<<trace.size()<<" capacity="<<diagnostics::FrameTrace::capacity<<" overwritten="<<overwritten<<"\nHost timestamps are monotonic 100ns; Ready is observed GPU completion, Present is submission, not scanout."<<"\nDetail: Submitted=skipped FG count, Ready=invalid FG count, Present=subframe, Gpu=stage index, Reset=reason enum."- <<" Count: Submitted=FG evaluated, Ready=valid FG, Present=1, Reset=outcome enum, Cancelled=unpresented frames.\n";+ <<" Count: Submitted=FG evaluated, Ready=valid FG, Present=1, Reset=outcome enum, Cancelled=unpresented frames."+ <<" FrameReady: detail=subframe, ms=CPU-observed readiness since processing start (upper bound)."+ <<" Discarded: detail=subframe, count=PreviewFrameReadiness enum, ms=deadline lateness.\n";for(const auto& e:trace)o<<"event="<<diagnostics::traceKindName(e.kind)<<" host="<<e.host100ns<<" session="<<e.session<<" revision="<<e.identity.settingsRevision<<" epoch="<<e.identity.epoch<<" source="<<e.identity.sourceFrameId<<" batch="<<e.batch<<" fence="<<e.fence<<" pts="<<e.pts100ns<<" detail="<<e.detail<<" count="<<e.count<<" ms="<<e.milliseconds<<'\n';diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cppindex 177c7aca..6529aaa8 100644--- a/src/engine/EngineController.cpp+++ b/src/engine/EngineController.cpp@@ -496,6 +496,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,spipeline::EnhanceGraph::FrameOutputs output;std::shared_ptr<FrameFlowWindow> flow;Clock::time_point processStart;+ int64_t predictedGpuStart100ns=0;std::optional<double> gpuExecutionMs,fgExecutionMs;bool real=false;std::atomic<bool> ready=false;@@ -560,6 +561,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sfor(const auto& sample:graph.takeGpuTimings())record(sample);for(const auto& sample:presenter.takeGpuTimings(ctx.fence()))record(sample);};+ const bool traceSubframes=GetEnvironmentVariableW(L"VEYRA_TEST_TRACE_SUBFRAMES",nullptr,0)>0;// Shared with the presenter: resolve each batch on this single// object so SDK status and generated counts are consumed once.auto pollCompletions=[&]{@@ -569,7 +571,10 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sauto& watch=**it;auto& batch=watch.output;const auto completedFence=ctx.fence()->GetCompletedValue();for(unsigned i=0;i<batch.batch.count;++i){const auto& item=batch.batch.frames[i];- if(!watch.frameReadyObserved[i]&&item.lease&&completedFence>=item.lease->readyFence)watch.frameReadyObserved[i]=host100ns();+ if(!watch.frameReadyObserved[i]&&item.lease&&completedFence>=item.lease->readyFence){+ watch.frameReadyObserved[i]=host100ns();+ if(traceSubframes)traceFrame(diagnostics::TraceKind::FrameReady,item.identity,batch.batch.batchId,item.lease->readyFence,item.pts100ns,item.subframe,1,elapsedMs(watch.processStart));+ }}if(!graph.resolveGeneration(batch)){++it;continue;}// The GPU may finish between the first poll and resolve.@@ -1044,7 +1049,8 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sconst bool previewOnlyReset=!hardFrameReset&&temporalBreak;if(hardFrameReset)++metricsWindowEpoch;const bool historyReset=hardFrameReset||temporalBreak;- if(historyReset){++historyResets;++presentationGeneration;}+ if(historyReset)++historyResets;+ if(presentationGenerationResetRequired(reset,pkt.flags))++presentationGeneration;// A mailbox Drop must reset SR/NR/flow/FG history, but draining// the two-batch presenter here discarded completed real frames.if(liveScheduler&&presentationDrainRequired(reset,pkt.flags))drainLivePresentation();@@ -1098,16 +1104,51 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s// deadlines on the audio master clock. A pair whose last// generated timestamp can no longer be reached spends no FG// Evaluate; the real frame keeps its normal cadence (plan §4.1).+ double queuedGpuMs=0;if(!isCapture&&!isImage&&!rereadCached&&!transaction&&options.fg&&!presentSinkFrameGeneration(options.settings.frameGenerationBackend)){- admitFg=[&,historyReset](const pipeline::FrameBatch& batch,bool warmingHistory){+ if(GetEnvironmentVariableW(L"VEYRA_TEST_ADMISSION_QUEUE",nullptr,0)){+ const auto start=std::chrono::duration_cast<std::chrono::nanoseconds>(processStart.time_since_epoch()).count()/100;+ int64_t finish=0;+ for(const auto& previous:pendingCompletions){+ if(ctx.fence()->GetCompletedValue()>=std::max(previous->output.videoFenceValue,previous->output.genFenceValue))continue;+ const auto began=std::chrono::duration_cast<std::chrono::nanoseconds>(previous->processStart.time_since_epoch()).count()/100;+ const auto cost=previous->output.fgEvaluated?fgBudget.predicted(start,previous->output.historyReset||previous->output.fgRecovery):fgBudget.baseCost(start);+ finish=std::max({finish,began,previous->predictedGpuStart100ns})+int64_t(cost.value_or(0)*10000);+ if(GetEnvironmentVariableW(L"VEYRA_TEST_ADMISSION_REMAINING",nullptr,0)&&ctx.fence()->GetCompletedValue()>=previous->output.videoFenceValue){+ const auto timing=frameFlow->snapshot(start).gpuTiming;+ double remaining=0;bool known=true;+ for(const auto& item:previous->output.batch.frames){+ if(item.kind!=pipeline::FrameKind::Generated||!item.lease||ctx.fence()->GetCompletedValue()>=item.lease->readyFence)continue;+ const auto stage=size_t(diagnostics::GpuStage::Fg1)+item.subframe-1;+ if(stage>=timing.size()||!timing[stage].p95){known=false;break;}+ remaining+=*timing[stage].p95;+ }+ if(known&&!previous->output.historyReset&&!previous->output.fgRecovery)+ finish=std::min(finish,start+int64_t(remaining*10000));+ }+ }+ queuedGpuMs=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(GetEnvironmentVariableW(L"VEYRA_TEST_ADMISSION_ALWAYS",nullptr,0))return true;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);const auto now=host100ns();- const auto deadline=now+lastGenerated-int64_t(nowMs()*10000.0);+ const auto admissionPts=GetEnvironmentVariableW(L"VEYRA_TEST_ADMISSION_FIRST",nullptr,0)?pipeline::FrameBatch::interpolate(a,batch.b100ns,1,previewFgMultiplier):lastGenerated;+ const auto reserve=GetEnvironmentVariableW(L"VEYRA_TEST_ADMISSION_RESERVE",nullptr,0)?100000:0;+ auto deadline=now+admissionPts-int64_t(nowMs()*10000.0)-reserve;+ if(GetEnvironmentVariableW(L"VEYRA_TEST_ADMISSION_PROFILE",nullptr,0)&&!warmingHistory){+ const auto first=frameFlow->snapshot(now).gpuTiming[size_t(diagnostics::GpuStage::Fg1)].p95;+ const auto whole=fgBudget.predicted(now),base=fgBudget.baseCost(now);+ if(first&&whole&&base){+ const auto firstPts=pipeline::FrameBatch::interpolate(a,batch.b100ns,1,previewFgMultiplier);+ deadline=now+firstPts-int64_t(nowMs()*10000.0)-100000+interval/previewFgMultiplier+int64_t(std::max(0.0,*whole-*base-*first)*10000);+ }+ }const auto elapsed=elapsedMs(processStart),blit=livePresentGpu.p95();- const auto admitted=fgBudget.admit(now,deadline,elapsed,blit,warmingHistory);+ const auto admitted=fgBudget.admit(now,deadline,elapsed,blit,warmingHistory,queuedGpuMs);logAdmission(batch,now,deadline,elapsed,blit,admitted,warmingHistory,"file-audio");return admitted;};@@ -1238,6 +1279,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sconst auto timeline=liveTimeline;const uint64_t jobGeneration=presentationGeneration.load();auto watch=std::make_shared<CompletionWatch>();watch->output=out;watch->flow=frameFlow;watch->processStart=processStart;watch->real=!rereadCached;+ watch->predictedGpuStart100ns=std::chrono::duration_cast<std::chrono::nanoseconds>(processStart.time_since_epoch()).count()/100+int64_t(queuedGpuMs*10000);watch->captureArrival=captureArrival;watch->presentationGeneration=jobGeneration;watch->reflexFrame=currentReflexFrame;pendingCompletions.push_back(watch);@@ -1273,6 +1315,8 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sconst auto decisionTime=host100ns();const bool generationExpired=generated&&(isCapture?timeline.expired(item.pts100ns,decisionTime,100000):!fileAwaitingVideo&&previewGeneratedExpired(nowMs(),itemPtsMs));const auto readiness=previewFrameReadiness(item,comparisonMode_!=0||!generatedPresentationCurrent(jobGeneration,presentationGeneration.load()),generationExpired,[&]{return graph.resolveFrame(batch,s.next);});+ if(traceSubframes&&generated&&(readiness==PreviewFrameReadiness::Expired||readiness==PreviewFrameReadiness::Suppressed))+ traceFrame(diagnostics::TraceKind::Discarded,item.identity,batch.batch.batchId,item.lease->readyFence,item.pts100ns,item.subframe,unsigned(readiness),isCapture?double(decisionTime-timeline.deadline(item.pts100ns))/10000:nowMs()-itemPtsMs);if(readiness==PreviewFrameReadiness::Pending){if(elapsedMs(s.readyStart)>2000){veyra::log::error("capture-present","GPU frame ready timeout");return {State::Failed};}return {State::Pending,host100ns()+2000};@@ -1293,6 +1337,11 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sif(nowMs()+.25<itemPtsMs)return {State::Pending,now+std::min<int64_t>(10000,int64_t((itemPtsMs-nowMs())*10000))};}const auto optionalNow=host100ns();+ if(!isCapture&&!fileAwaitingVideo&&options.fg&&!presentSinkFrameGeneration(options.settings.frameGenerationBackend)&&GetEnvironmentVariableW(L"VEYRA_TEST_SUBFRAME_SPACING",nullptr,0)){+ const auto interval=std::max<int64_t>(1,int64_t(sourceIntervalMs*10000)/std::max(1u,batch.batch.count));+ const auto due=cadence.due(optionalNow+int64_t((itemPtsMs-nowMs())*10000),interval);+ if(optionalNow<due)return {State::Pending,due};+ }if(presentationEffective.enabled){const auto interval=std::max<int64_t>(1,int64_t(sourceIntervalMs*10000)/std::max(1u,batch.batch.count));const auto mediaDeadline=isCapture?timeline.deadline(item.pts100ns):fileAwaitingVideo?optionalNow:optionalNow+int64_t((itemPtsMs-nowMs())*10000);diff --git a/tests/integration/FgAdmissionTests.cpp b/tests/integration/FgAdmissionTests.cppindex e549d4da..9ba9eb23 100644--- a/tests/integration/FgAdmissionTests.cpp+++ b/tests/integration/FgAdmissionTests.cpp@@ -66,11 +66,22 @@ int wmain(int argc,wchar_t** argv){unsigned nonblack=0;for(size_t p=0;p+3<image.pixels.size();p+=4)nonblack+=image.pixels[p]>8||image.pixels[p+1]>8||image.pixels[p+2]>8;ok=ok&&nonblack>image.width*image.height/20;}+ sink::RgbaImage previousGenerated;if(i==13||i==21||i==29)for(unsigned j=0;j<out.batch.count;++j){const auto& f=out.batch.frames[j];if(f.kind!=pipeline::FrameKind::Generated)continue;sink::RgbaImage image;ok=ok&&sink::readRgba8(ctx,ring,f.lease->texture.Get(),image);unsigned nonblack=0;for(size_t p=0;p+3<image.pixels.size();p+=4)nonblack+=image.pixels[p]>8||image.pixels[p+1]>8||image.pixels[p+2]>8;ok=ok&&nonblack>image.width*image.height/20;+ if(!previousGenerated.pixels.empty()&&previousGenerated.pixels.size()==image.pixels.size()){+ uint64_t difference=0,changed=0;+ for(size_t p=0;p<image.pixels.size();++p)if(p%4!=3){+ const auto delta=std::abs(int(image.pixels[p])-int(previousGenerated.pixels[p]));+ difference+=delta;changed+=delta!=0;+ }+ std::cout<<"CONTENT frame="<<i<<" subframe="<<f.subframe<<" adjacentChangedChannels="<<changed+ <<" adjacentMeanAbsoluteDifference="<<double(difference)/(image.width*image.height*3ull)<<std::endl;+ }+ previousGenerated=std::move(image);}std::cout<<"frame="<<i<<" skip="<<out.fgSkippedBeforeEval<<" evaluate="<<out.fgEvaluated<<" recovery="<<out.fgRecovery<<" batch="<<out.batch.count<<" pass="<<ok<<std::endl;}diff --git a/tests/unit/LiveGpuSchedulerTests.cpp b/tests/unit/LiveGpuSchedulerTests.cppindex d78da642..3a77cf2c 100644--- a/tests/unit/LiveGpuSchedulerTests.cpp+++ b/tests/unit/LiveGpuSchedulerTests.cpp@@ -72,6 +72,15 @@ int main(){check(!scheduler.push([](int64_t){return Scheduler::Step{State::Complete};},[]{}),"failed scheduler rejects new work");veyra::engine::TimingWindow timing;for(unsigned i=0;i<100;++i)timing.add(i);check(timing.p95()==94,"percentile order statistic");timing.clear();timing.add(6);check(timing.p95()==6,"reset removes old timing window");veyra::engine::FgRecoveryBudget budget;+ {+ veyra::engine::FgRecoveryBudget queued;+ queued.complete(10,true,false,10000000,4);+ check(queued.admit(10000000,10020000,0,0),"idle GPU can fit the measured batch");+ check(!queued.admit(10000000,10020000,0,0,false,5),"uncompleted earlier work consumes the new pair deadline");+ check(queued.admit(10000000,10020000,5,0,false,5),"elapsed queue work is counted only once");+ check(!queued.admit(10000000,9920000,100,0,false,5),"CPU time cannot erase unsubmitted FG even with queued work");+ check(queued.admit(10000000,10020000,0,0,false,-5),"negative queue prediction cannot invent extra GPU work");+ }{using Window=veyra::engine::TimingWindow;const Window::Clock::time_point start{};diff --git a/tests/unit/LivePresentationTimingTests.cpp b/tests/unit/LivePresentationTimingTests.cppindex 6b50f691..db82dd43 100644--- a/tests/unit/LivePresentationTimingTests.cpp+++ b/tests/unit/LivePresentationTimingTests.cpp@@ -41,6 +41,10 @@ int main(){constexpr auto drop=static_cast<veyra::pipeline::FrameFlags>(veyra::pipeline::FrameFlagBits::Drop);constexpr auto resize=static_cast<veyra::pipeline::FrameFlags>(veyra::pipeline::FrameFlagBits::Resize);check(veyra::pipeline::breaksHistory(drop),"mailbox overwrite resets temporal history");+ check(!veyra::engine::presentationGenerationResetRequired(false,drop),"missing future input retains an earlier complete interpolation pair");+ check(!veyra::engine::presentationGenerationResetRequired(false,0),"preview skip alone does not invalidate leased earlier output");+ check(veyra::engine::presentationGenerationResetRequired(true,drop),"explicit reset invalidates old output even when accompanied by a drop");+ check(veyra::engine::presentationGenerationResetRequired(false,resize|drop),"drop cannot mask a resource boundary");check(!veyra::engine::presentationDrainRequired(false,drop),"mailbox overwrite retains queued real presentation");check(veyra::engine::presentationDrainRequired(false,resize),"resize drains resource-bound presentation");check(!veyra::engine::generatedPresentationCurrent(4,5),"history reset suppresses queued generated frame");