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++

fix: correct playback NR UI regressions and capture cadence starvation

Veyra Goal Agentdd69e1f99b1f
diff --git a/apps/veyra/SettingsWindow.cpp b/apps/veyra/SettingsWindow.cpp
index cf023ea6..d969dbda 100644
--- a/apps/veyra/SettingsWindow.cpp
+++ b/apps/veyra/SettingsWindow.cpp
@@ -1148,11 +1148,54 @@ LRESULT CALLBACK holdOriginalProc(HWND h,UINT msg,WPARAM wp,LPARAM lp,UINT_PTR i
return DefSubclassProc(h,msg,wp,lp);
}
+void layoutEnhancePage(int width){
+ auto place=[&](int id,int x,int y,int w,int height=0){
+ for(auto& entry:items)if(GetDlgCtrlID(entry.h)==id){entry.x=x;entry.y=y;entry.w=w;if(height)entry.height=height;break;}
+ };
+ int y=12;
+ auto row=[&](int id,int height){place(id,12,y,-1);y+=height+8;};
+ // Combo height is the dropdown extent, not its collapsed row height.
+ row(200,36);row(1117,24);row(218,36);row(203,36);
+ row(220,36);row(223,36);row(201,36);
+ const int third=(width-40)/3;
+ for(int i=0;i<3;++i)place(730+i,12+i*(third+8),y,third);
+ y+=44;row(207,36);
+ row(206,36);
+ const int half=(width-32)/2;
+ place(213,12,y,half);place(214,20+half,y,half);y+=44;
+ place(1109,12,y,-1,48);y+=56;
+ place(1123,12,y,176,28);place(222,202,y,-1,28);place(622,12,y+32,-1,16);y+=62;
+ row(1100,24);
+ for(int i=0;i<12;++i){
+ if(i==7)row(1101,24);
+ place(1000+i,12,y,176,28);
+ if(i>=4&&i<=6){
+ const int count=i==4?3:2;
+ for(int j=0;j<count;++j)place(700+(i-4)*10+j,12+j*(third+8),y+28,third);
+ y+=72;
+ }else{place(100+i,202,y,-1,28);place(600+i,12,y+32,-1,16);y+=62;}
+ }
+ place(1102,12,y,-1,70);y+=78;
+ row(1124,24);row(260,36);place(261,12,y,-1,28);y+=36;
+ for(int i=0;i<3;++i)place(262+i,12+i*(third+8),y,third);
+ y+=52;row(230,32);place(1145,12,y,-1,52);y+=60;
+ for(int i=0;i<4;++i){
+ place(1141+i,12,y,160,24);place(1131+i,182,y,-1,24);
+ place(631+i,12,y+26,-1,24);y+=58;
+ }
+}
+
void arrange(){
if(!window||!body)return;RECT r{};GetClientRect(window,&r);int width=MulDiv(r.right,96,veyra::ui::layoutDpi(window)),height=MulDiv(r.bottom,96,veyra::ui::layoutDpi(window));
const int sticky=128,viewport=std::max(1,height-sticky);contentHeight=0;
// The child still has its previous size until SetWindowPos below.
if(page==2)layoutColorPage(width);
+ if(page==0)layoutEnhancePage(width);
+ if(page==1)for(auto& entry:items){
+ const auto id=GetDlgCtrlID(entry.h);
+ if(id==244){entry.x=12;entry.w=std::max(80,width-68);}
+ if(id==1147){entry.x=width-48;entry.w=36;}
+ }
for(const auto& [id,row]:rowResets){
auto findItem=[&](int control)->Item&{return *std::find_if(items.begin(),items.end(),[&](const Item& entry){return GetDlgCtrlID(entry.h)==control;});};
auto& value=findItem(row.value);auto& reset=findItem(id);auto& label=findItem(row.label);
@@ -1162,7 +1205,7 @@ void arrange(){
}
int helpHeight=0;
if(smoothMotionHelpExpanded){auto dc=GetDC(window);auto old=SelectObject(dc,font);RECT textRect{0,0,dip(window,std::max(1,width-24)),0};DrawTextW(dc,smoothMotionHelp,-1,&textRect,DT_CALCRECT|DT_WORDBREAK|DT_NOPREFIX);SelectObject(dc,old);ReleaseDC(window,dc);helpHeight=MulDiv(textRect.bottom,96,layoutDpi(window))+16;}
- const auto helpOffset=[&](const Item& entry){const auto id=GetDlgCtrlID(entry.h);return entry.page==1&&(id==1114||id==205||id==1110||id==240||id==241||id==242||id==1150)?helpHeight:0;};
+ const auto helpOffset=[&](const Item& entry){const auto id=GetDlgCtrlID(entry.h);return entry.page==1&&(id==1114||id==205||id==1110||id==240||id==241||id==242||id==243||id==244||id==1147||id==1150)?helpHeight:0;};
for(auto& entry:items){if(GetDlgCtrlID(entry.h)==1120)entry.height=helpHeight;
if(entry.page==page&&!entry.hidden&&(GetDlgCtrlID(entry.h)!=1120||smoothMotionHelpExpanded)){wchar_t cls[32]{};GetClassNameW(entry.h,cls,32);contentHeight=std::max(contentHeight,entry.y+helpOffset(entry)+(_wcsicmp(cls,L"COMBOBOX")==0?36:entry.height)+12);}}
if(page==2)contentHeight=std::max(contentHeight,colorPageContentHeight);
@@ -1171,7 +1214,7 @@ void arrange(){
auto batch=BeginDeferWindowPos(int(items.size()));
for(auto& entry:items){bool fixed=entry.page==-1,visible=!entry.hidden&&(entry.page==page||fixed)&&(GetDlgCtrlID(entry.h)!=1120||smoothMotionHelpExpanded);int w=entry.w<0?width-entry.x-12:entry.w;int y=fixed?(GetDlgCtrlID(entry.h)==400?0:(GetDlgCtrlID(entry.h)==211||GetDlgCtrlID(entry.h)==219)?86:42):entry.y+helpOffset(entry)-scroll;
if(fixed){SetWindowPos(entry.h,nullptr,dip(window,entry.x),dip(window,y),dip(window,std::max(1,w)),dip(window,42),SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOREDRAW);continue;}batch=DeferWindowPos(batch,entry.h,nullptr,dip(window,entry.x),dip(window,y),dip(window,std::max(1,w)),dip(window,entry.height),SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOREDRAW|SWP_NOCOPYBITS|(visible?SWP_SHOWWINDOW:SWP_HIDEWINDOW));}
- EndDeferWindowPos(batch);RedrawWindow(body,nullptr,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN);InvalidateRect(window,nullptr,FALSE);
+ EndDeferWindowPos(batch);RedrawWindow(body,nullptr,nullptr,RDW_INVALIDATE|RDW_ALLCHILDREN|RDW_UPDATENOW);InvalidateRect(window,nullptr,FALSE);
}
HWND add(const wchar_t* cls,const wchar_t* text,int id,DWORD style,int group,int x,int y,int width,int height){auto h=CreateWindowExW(0,cls,text,WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|style,0,0,1,1,group==-1?window:body,reinterpret_cast<HMENU>(INT_PTR(id)),GetModuleHandleW(nullptr),nullptr);SendMessageW(h,WM_SETFONT,WPARAM(font),TRUE);themeControl(h);if(group!=-1)SetWindowSubclass(h,scrollOnly,950,0);items.push_back({h,group,x,y,width,height});return h;}
@@ -1233,18 +1276,18 @@ switch(msg){
case WM_CREATE:{window=h;font=makeFont(h);items.clear();displayedBackendWarning.clear();smoothMotionHelpExpanded=false;
WNDCLASSW bodyClass{};bodyClass.lpfnWndProc=bodyProc;bodyClass.hInstance=GetModuleHandleW(nullptr);bodyClass.lpszClassName=L"VeyraInspectorBody";bodyClass.hCursor=LoadCursorW(nullptr,IDC_ARROW);RegisterClassW(&bodyClass);
// Composite only the scrolling controls, never the video/swapchain window.
- body=CreateWindowExW(WS_EX_CONTROLPARENT,bodyClass.lpszClassName,L"滚动参数",WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS,0,88,300,300,h,nullptr,bodyClass.hInstance,nullptr);
- add(L"BUTTON",L"实验性 NVIDIA NR 降噪 / 增强",200,BS_AUTOCHECKBOX|WS_TABSTOP,0,12,12,-1,36);
+ body=CreateWindowExW(WS_EX_CONTROLPARENT|WS_EX_COMPOSITED,bodyClass.lpszClassName,L"滚动参数",WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS,0,88,300,300,h,nullptr,bodyClass.hInstance,nullptr);
+ add(L"BUTTON",L"实验性 NVIDIA NR 增强",200,BS_AUTOCHECKBOX|WS_TABSTOP,0,12,12,-1,36);
add(L"BUTTON",L"超分辨率",201,BS_AUTOCHECKBOX|WS_TABSTOP,0,12,56,-1,36);
combo(203,0,104,{L"1080p NR · 实时默认",L"原生NR · 高性能成本",L"480p NR",L"720p NR",L"900p NR",L"1440p NR"});
- add(L"STATIC",L"NR 降噪模型参数",1100,0,0,12,146,-1,24);
+ add(L"STATIC",L"模型参数",1100,0,0,12,146,-1,24);
for(int i=0;i<12;++i){const int y=174+i*62+(i>=7?32:0);add(L"STATIC",labels[i],1000+i,0,0,12,y,176,28);
- if(i>=4&&i<=6){const int group=i-4,count=group==0?3:2;for(int j=0;j<count;++j){const auto title=group==0?(j==0?std::wstring(L"003自然"):j==1?std::wstring(L"003电影"):std::wstring(L"003高细节")):j==0?std::wstring(L"关闭"):std::wstring(L"开启");button(title.c_str(),700+group*10+j,0,12+j*88,y+28,80);}continue;}
+ if(i>=4&&i<=6){const int group=i-4,count=group==0?3:2;for(int j=0;j<count;++j){const auto title=group==0?std::to_wstring(j):j==0?std::wstring(L"关闭"):std::wstring(L"开启");button(title.c_str(),700+group*10+j,0,12+j*88,y+28,80);}continue;}
add(L"EDIT",L"",100+i,ES_AUTOHSCROLL|WS_TABSTOP|ES_RIGHT,0,202,y,-1,28);
const wchar_t* range=i<3?L"范围:0–1":i==3?L"-1表示默认;其余范围0–2(效果未证实)":L"范围:0–2";SetPropW(item(100+i),L"veyra.tip",HANDLE(range));
auto slider=add(TRACKBAR_CLASSW,L"",600+i,TBS_HORZ|TBS_NOTICKS|WS_TABSTOP,0,12,y+32,-1,16);SendMessageW(slider,TBM_SETRANGE,TRUE,MAKELPARAM(i==3?-100:0,i<3?100:200));}
add(L"STATIC",L"增强变化量",1101,0,0,12,606,-1,24);
- add(L"STATIC",L"003 风格映射:使用 Veyra 当前 NR 接口的 0/1/2 档参数组合;不是把 033 的闭源 DLL 搬进来。",1102,0,0,12,956,-1,52);
+ add(L"STATIC",L"肤质 / 风格 / 遮罩 / UI键为本地实验参数。未验证的效果不会标成可用能力。",1102,0,0,12,956,-1,70);
button(L"还原默认",211,-1,12,86,88);
add(L"BUTTON",L"直播兼容 · 实验",219,BS_AUTOCHECKBOX|WS_TABSTOP,-1,108,86,-1,36);
SetPropW(item(219),L"veyra.tip",HANDLE(L"直播兼容模式:切换显示交换链,会短暂停顿;不改变增强算法或导出。不保证所有捕获方式有效。"));
diff --git a/docs/CORRECTIVE_AUDIT_2026-09-21.md b/docs/CORRECTIVE_AUDIT_2026-09-21.md
new file mode 100644
index 00000000..7895b82c
--- /dev/null
+++ b/docs/CORRECTIVE_AUDIT_2026-09-21.md
@@ -0,0 +1,103 @@
+# Corrective audit, 2026-09-21
+
+This record supersedes completion claims in the six-issue plan where they
+conflict with the evidence below. This is not whole-product acceptance.
+
+## Confirmed defects and corrections
+
+- The new output cadence comparison used an initial host anchor on unpaced
+ capture. An earlier capture log recorded 202 processed frames but only two
+ presentations. Unpaced cadence now uses current host time; the cap comparison
+ can recover from late deadlines. Regression tests cover 30/60 Hz, caps and reset.
+- Removed the speculative two-second transaction first-sample timeout. Existing
+ source timeout handling remains; a short timeout is not a starvation fix.
+- Settings UI used inconsistent absolute offsets after adding controls. Enhancement
+ controls now use sequential layout, collapsed combo heights and responsive rows.
+ Restored body compositing/immediate invalidation. Static 1280x800 scroll views
+ were inspected; fast motion, multiple monitors and all DPI settings are not
+ visually accepted by this test.
+- Restored NR enhancement terminology and numeric model styles 0/1/2. Named
+ presets remain. Presets are parameter collections, not new model styles.
+- Reverted the recent XeSS frameRenderTime hint derived from accepted Present
+ intervals: these include provider waits and are not independent rendering
+ time. Intel permits zero. This rollback alone did not fix file playback.
+- Video testing found repeated XeSS generation suppression/resumption under the
+ audio-master lateness gate. Removed that automatic generation gate from file
+ presentation, consistent with the user's no-automatic-downgrade requirement.
+ Audio continuity and bounded preview skipping remain. No fixed delay added.
+- Included five temporal RGBA16F textures in graph memory estimates (40 bytes
+ per residual pixel). Previous estimates omitted roughly 316 MiB at 4K.
+- Fixed short-test runner: Start-Process must omit an empty ArgumentList.
+
+## Scope corrections
+
+- The readable 033 CC0 BilateralComic shader applies luminance/chroma shaping
+ and skin protection; it is not evidence of additional NGX model style IDs.
+ The binary engine supplies no auditable source for adding styles 3-6. Do not
+ invent IDs or relabel existing models as new ones.
+- Magpie reference commit: 3841698348bfb246623d4acf791984c8b68a577b.
+ Its NR style choices are also 0/1/2. Residual temporal stabilization is not
+ equivalent to generic input-video denoising. Veyra temporal NR remains optional
+ and off by default; GPU quality and export regression acceptance are pending.
+- Output cap is default off, but VideoPresenter still disables it for XeSS/FSR.
+ The requested all-provider behavior is NOT complete. A 60 Hz display cannot
+ show 120 complete distinct frames per second.
+- Multiline subtitle fitting defaults off; total-screen overflow protection
+ remains. Bitmap subtitles retain authored geometry. Fullscreen lock prevents
+ mouse-triggered controls; it does not prove HDR overlay color issues solved.
+- Capture driver discontinuity filtering and Elgato HDR changes were reviewed;
+ they were not broadly reverted. Real affected-device acceptance remains needed.
+
+## Evidence
+
+Artifacts: E:/项目/Veyra/tests/corrective-audit-20260921/.
+Build: E:/项目/Veyra/build/playback-nr-20260920/.
+Process TEMP/TMP: E:/项目/Veyra/tmp/corrective-audit-20260921/.
+
+VS x64 CMake build targets veyra, live timing, UI contract, control paint,
+capture color, repair preset, subtitle panel, subtitle overlay and bitmap
+subtitle tests passed. UI contract was rerun with an isolated directory to
+actually exercise persistence. Preset and bitmap tests used required arguments.
+Initial empty-argument runner failures were corrected, not counted as passes.
+
+Capture baseline, 15 seconds: 415 received/processed/presented, zero expiry,
+29-30 submissions/s. Complete-runtime NR + XeSS4x capture, 20 seconds:
+988 NR evaluations, 2952 generated frames, 3939 provider presentations.
+The PS5 was shutting down/static: this is not gameplay image-quality acceptance.
+An earlier test from the build directory lacked the runtime and recovered to
+ordinary presentation; it is explicitly NOT a XeSS pass.
+
+Per user steering, subsequent tests use
+E:/项目/Likely7 个人账号/Deepseek Grok/p001.mp4, not the powered-off PS5.
+video-xess.log: 120-second NR + XeSS4x test, 7031 NR evaluations, 11046 generated,
+18075 provider presentations; repeated suppress/resume explains large rate
+variation. No claim of stable XeSS playback follows from that run.
+
+Runtime staging app/ reuses an existing verified portable runtime with the new
+executable. It is a test directory, not a new release package or updated manifest.
+No runtime binary was edited or added to source control; no publication occurred.
+
+## No-gate video comparison
+
+Rebuilt veyra successfully after removing the file generation gate, then ran
+the same p001.mp4 with --smoke-seconds 60 --smoke-view pro --nr --no-sr
+--fg-xess --fg-multiplier 4 through scripts/run-short-test.ps1 (90-second
+watchdog). Exit 0; log video-xess-no-gate.log. 3428 NR evaluations, 10221
+generated frames, 13648 provider presentations. Final source processing was
+60 fps and provider submission rate 240 fps. No gate toggles remained.
+The final timing windows retained 17 preview skips; absolute media-clock
+lateness P95 was 43.79 ms, versus 29.00 ms in the earlier gated run.
+This is NOT input-to-photon latency. The runs differ in duration and UI
+interaction, so neither establishes a controlled latency improvement.
+Steady 240 submissions at the end do not prove artifact-free motion.
+
+UI contract persistence rerun with the isolated prefs-full directory passed.
+git diff --check passed. Test processes exited; no new portable package made.
+
+## Remaining acceptance
+
+Record the no-gate video comparison separately. Check sustained media-clock
+lateness and preview skips, not only provider FPS. Temporal NR quality, actual
+fast UI scrolling/multi-monitor motion, provider output caps and new NR style
+availability remain open. No physical scanout or input-to-photon measurement
+was performed. Whole-software stability has not been established.
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index d6bb920e..f9b5f88a 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -1,5 +1,17 @@
# Veyra 工作记录
+## 2026-09-21 Corrective audit of playback / NR changes
+
+Checkpoint: `checkpoint/pre-corrective-audit-20260921`; isolated branch
+`codex/playback-nr-20260920`. Findings, corrections, actual tests and unfinished
+items are in `docs/CORRECTIVE_AUDIT_2026-09-21.md`. This supersedes earlier
+overbroad acceptance claims. Build/test output is under
+`E:/项目/Veyra/build/playback-nr-20260920` and
+`E:/项目/Veyra/tests/corrective-audit-20260921`.
+User turned PS5 off; continued validation uses p001.mp4. Video reproduced
+repeated XeSS generation suppression despite successful startup/capture tests.
+No publication or shutdown is part of this corrective audit.
+
## 2026-09-21 Complete portable rebuild and actual startup verification
User requested a newly built package after the previous ad-hoc DLL copy did
diff --git a/include/veyra/engine/PresentationScheduler.h b/include/veyra/engine/PresentationScheduler.h
index 571c48e4..30458a15 100644
--- a/include/veyra/engine/PresentationScheduler.h
+++ b/include/veyra/engine/PresentationScheduler.h
@@ -18,6 +18,8 @@ public:
// Unbuffered capture is ready-driven. A late first callback or clock drift
// must not turn its source timestamps into a persistent presentation hold.
int64_t deadline(int64_t pts)const{return paced_?host_+(pts-source_)+delay_:host_;}
+ // The fixed readiness anchor is not an expiry deadline for unpaced input.
+ int64_t cadenceDeadline(int64_t pts,int64_t now)const{return paced_?deadline(pts):now;}
bool expired(int64_t pts,int64_t now,int64_t tolerance)const{return now>deadline(pts)+tolerance;}
private:
uint64_t epoch_=0;int64_t source_=0,host_=0,delay_=0;bool anchored_=false,paced_=true;
diff --git a/include/veyra/engine/PresentationSettings.h b/include/veyra/engine/PresentationSettings.h
index a1ee9e62..2d767213 100644
--- a/include/veyra/engine/PresentationSettings.h
+++ b/include/veyra/engine/PresentationSettings.h
@@ -32,5 +32,10 @@ public:
}
void submitted(int64_t now){last_=now;}
int64_t rateDue(int64_t now,int64_t interval)const{return !last_||interval<=0?now:last_+interval;}
+ bool rateSkipsCandidate(int64_t now,int64_t mediaDeadline,int64_t candidateInterval,int64_t capInterval)const{
+ // Discard only while the cap is still ahead of the next opportunity.
+ // An expired media deadline must never prevent a ready frame recovering.
+ return rateDue(now,capInterval)>=std::max(now,mediaDeadline)+candidateInterval;
+ }
};
}
diff --git a/scripts/run-short-test.ps1 b/scripts/run-short-test.ps1
index 5203aa38..c6527c6a 100644
--- a/scripts/run-short-test.ps1
+++ b/scripts/run-short-test.ps1
@@ -11,7 +11,9 @@ try {
$prefix=[IO.Path]::GetFullPath($LogPrefix)
[IO.Directory]::CreateDirectory([IO.Path]::GetDirectoryName($prefix)) | Out-Null
$quoted=@($Arguments | ForEach-Object { '"' + $_.Replace('"','\"') + '"' })
- $p=Start-Process -FilePath $path -ArgumentList $quoted -PassThru -WindowStyle Hidden -RedirectStandardOutput ($prefix+'.stdout.log') -RedirectStandardError ($prefix+'.stderr.log')
+ $options=@{FilePath=$path;PassThru=$true;WindowStyle='Hidden';RedirectStandardOutput=($prefix+'.stdout.log');RedirectStandardError=($prefix+'.stderr.log')}
+ if($quoted.Count){$options.ArgumentList=$quoted}
+ $p=Start-Process @options
$processHandle=$p.Handle
if(-not $p.WaitForExit($TimeoutSeconds*1000)) {
Stop-Process -Id $p.Id -Force
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index ce5e8014..d46953c0 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -460,7 +460,6 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
// late. Export/images/paused frames never enter these paths.
uint64_t previewSkippedTotal=0,previewSkippedSinceSubmit=0;
bool previewSkipSinceProcess=false;
- XessGenerationGate xessGenerationGate;
// Cumulative provider-submission totals already fed to the frame
// flow. The AMD provider reports presentation from its own thread,
// so per-call deltas systematically miss updates that land just
@@ -939,14 +938,8 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
auto rs=physicalCapture?captureSource.tryRead(pkt,&frame):activeSource->read(pkt,&frame);
// Keep the accepted transaction and rollback state alive until
// the next real capture sample arrives. Never bind old PTS to now.
- const auto transactionWaitStart=Clock::now();
while(transaction&&isCapture&&rs==source::SourceReadStatus::Waiting&&!stop_){
if(paused_&&cachedFrame){frame=cachedFrame;pkt=cachedPacket;rs=source::SourceReadStatus::Frame;break;}
- if(elapsedMs(transactionWaitStart)>2000.0){
- veyra::log::error("capture-start",std::format("no first sample after {:.0f} ms during settings transaction; handing off to recovery",elapsedMs(transactionWaitStart)));
- rs=source::SourceReadStatus::Error;
- break;
- }
advanceLive();waitLive();rs=physicalCapture?captureSource.tryRead(pkt,&frame):activeSource->read(pkt,&frame);
}
if(stop_)break;
@@ -1214,7 +1207,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
// Admission predictions and the XeSS gate must not carry
// samples across a settings revision (new backend/dimensions);
// soft preview-skip history breaks do NOT reopen them.
- if(settingsChanged){xessGenerationGate.reset();presenter.setXessGenerationSuppressed(false);fedXessPresented=fedXessGenerated=fedFsrPresented=fedFsrGenerated=0;}
+ if(settingsChanged){fedXessPresented=fedXessGenerated=fedFsrPresented=fedFsrGenerated=0;}
playbackSpeedLastWall={};
if(liveScheduler){liveStats={};liveSubmissions.clear();liveAges.clear();liveWaits.clear();livePresent.clear();livePresentGpu.clear();liveReady.clear();}
if(settingsChanged||!completionRates)completionRates=std::make_shared<FrameCompletionRates>(host100ns());
@@ -1328,7 +1321,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
}
if(presentationEffective.enabled||presentationEffective.outputRate==OutputRateMode::Custom){
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);
+ const auto mediaDeadline=isCapture?timeline.cadenceDeadline(item.pts100ns,optionalNow):fileAwaitingVideo?optionalNow:optionalNow+int64_t((itemPtsMs-nowMs())*10000);
const unsigned catchUpPercent=!isCapture&&options.fg&&!presentSinkFrameGeneration(options.settings.frameGenerationBackend)?20:10;
auto due=presentationEffective.enabled&&presentationEffective.mode==PacingMode::Even?cadence.due(mediaDeadline,interval,catchUpPercent):mediaDeadline;
int64_t capInterval=0;
@@ -1341,7 +1334,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
// If the next candidate is due before this
// slot, discard this stale display opportunity
// instead of accumulating latency.
- if(capInterval>0&&due>=mediaDeadline+interval){++s.dropped;++s.handled;++s.next;s.deadlineStart.reset();continue;}
+ if(capInterval>0&&cadence.rateSkipsCandidate(optionalNow,mediaDeadline,interval,capInterval)){++s.dropped;++s.handled;++s.next;s.deadlineStart.reset();continue;}
if(generated&&presentationEffective.enabled&&presentationEffective.mode==PacingMode::Even&&due>mediaDeadline+interval){++s.dropped;++s.handled;++s.next;s.deadlineStart.reset();continue;}
if(optionalNow<due)return {State::Pending,due};
if(!presenter.presentationReady())return {State::Pending,optionalNow+2000};
@@ -1395,10 +1388,6 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
anchor=Clock::now();anchorMs=itemPtsMs;
}
fileAwaitingVideo=false;seekPreviewPending=false;
- if(graph.xessEnabled()&&presenter.xessActive()&&xessGenerationGate.observe(nowMs()-itemPtsMs,sourceIntervalMs)){
- presenter.setXessGenerationSuppressed(xessGenerationGate.suppressed());
- veyra::log::info("xess-fg-gate",std::format("event={} revision={} lateMs={:.3f}",xessGenerationGate.suppressed()?"suppress":"resume",item.identity.settingsRevision,nowMs()-itemPtsMs));
- }
}
// Real B owns captureArrival. Generated A/B frames and
// paused cached frames must not invent input anchors.
diff --git a/src/engine/VideoPresenter.cpp b/src/engine/VideoPresenter.cpp
index b87ae43e..f9da89fa 100644
--- a/src/engine/VideoPresenter.cpp
+++ b/src/engine/VideoPresenter.cpp
@@ -170,18 +170,10 @@ bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing&
// the next continuous frame can interpolate without another warmup.
const bool enabled=regionVisible&&!generated&&!comparison&&graph.presentMotion(slot)&&graph.presentDepth()&&identity.sourceFrameId!=lastXessIdentity_.sourceFrameId&&!xessGenerationSuppressed_;
const bool reset=!graph.presentMotionValid(slot)||!xessWasEnabled_||identity.epoch!=lastXessIdentity_.epoch||identity.settingsRevision!=lastXessIdentity_.settingsRevision||graph.motionPreviousSource(slot)!=lastXessIdentity_.sourceFrameId;
- // XeFG uses frameRenderTime as a cadence hint. Magpie's audited XeFG
- // path feeds the interval between accepted presents; Veyra used to
- // hard-code zero, which leaves the provider with no timing information
- // and can make multi-frame bursts uneven. Use only the measured
- // interval, clamp resize/stall spikes, and keep the first/reset frame
- // at zero. This is a hint, not a sleep or a queueing delay.
- float elapsed=0.0f;
- if(!reset&&lastXessFrame_!=std::chrono::steady_clock::time_point{}){
- const double ms=std::chrono::duration<double,std::milli>(now-lastXessFrame_).count();
- if(std::isfinite(ms)&&ms>0.0)elapsed=std::clamp(float(ms),0.25f,100.0f);
- }
- if(veyra::log::verboseFrameLogs())veyra::log::info("xess-fg",std::format("frameRenderTimeMs={:.3f} reset={}",elapsed,reset?1:0));
+ // 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;
auto* motion=graph.presentMotion(slot);
auto* depth=graph.presentDepth();
if(enabled){
diff --git a/src/pipeline/EnhanceGraph.cpp b/src/pipeline/EnhanceGraph.cpp
index 964137ba..72eaa66e 100644
--- a/src/pipeline/EnhanceGraph.cpp
+++ b/src/pipeline/EnhanceGraph.cpp
@@ -296,7 +296,8 @@ bool EnhanceGraph::initialize(const EnhanceGraphDesc& desc)
nvofStandalone_ = desc.enableNvofStandalone && !desc.noFeatures;
if(desc.opticalFlowBackend==engine::OpticalFlowBackend::AmdFidelityFx&&desc.amdFlowHalfResolution){nvofW_=std::max(1u,nvofW_/2);nvofH_=std::max(1u,nvofH_/2);}
uint64_t budget=0,usage=0;
- const uint64_t estimate=uint64_t(workW_)*workH_*(fgEnabled_?100:76)+uint64_t(nrW_)*nrH_*32+uint64_t(srcW_)*srcH_*32;
+ const uint64_t temporalBytes=desc_.nrTemporal?uint64_t(desc_.nrBeforeSr?srcW_:workW_)*(desc_.nrBeforeSr?srcH_:workH_)*40:0;
+ const uint64_t estimate=uint64_t(workW_)*workH_*(fgEnabled_?100:76)+uint64_t(nrW_)*nrH_*32+uint64_t(srcW_)*srcH_*32+temporalBytes;
if(context_.videoMemoryInfo(budget,usage)){
veyra::log::info("memory",std::format("graph lower-bound={}MiB budget={}MiB usage={}MiB; SDK allocations additional",estimate>>20,budget>>20,usage>>20));
if(usage>=budget||estimate>budget-usage){veyra::log::error("memory","insufficient adapter budget for requested graph textures");return false;}
diff --git a/tests/unit/LivePresentationTimingTests.cpp b/tests/unit/LivePresentationTimingTests.cpp
index 6834077c..e430748d 100644
--- a/tests/unit/LivePresentationTimingTests.cpp
+++ b/tests/unit/LivePresentationTimingTests.cpp
@@ -1,9 +1,11 @@
+#define NOMINMAX
#include "veyra/engine/LivePresentationTiming.h"
#include "veyra/engine/LivePresentationResetPolicy.h"
#include "veyra/source/CaptureTiming.h"
#include "veyra/engine/CaptureHalfRate.h"
#include "veyra/engine/FrameRateWindow.h"
#include "veyra/engine/PresentationScheduler.h"
+#include "veyra/engine/PresentationSettings.h"
#include <cmath>
#include <limits>
#include <cstdio>
@@ -12,6 +14,25 @@ int main(){
int failed=0;
auto check=[&](bool ok,const char* label){printf("%s %s\n",ok?"PASS":"FAIL",label);if(!ok)++failed;};
using veyra::engine::CaptureHalfRate;
+ for(int64_t interval:{166667LL,333333LL}){
+ veyra::engine::PresentationScheduler scheduler;
+ veyra::engine::PresentationCadence cadence;
+ scheduler.reset(1,0,1000000,0,false);
+ int presented=0;
+ for(int i=0;i<240;++i){
+ const auto now=1000000+i*interval;
+ const auto due=scheduler.cadenceDeadline(i*interval,now);
+ if(!cadence.rateSkipsCandidate(now,due,interval,interval)){
+ cadence.submitted(now);++presented;
+ }
+ }
+ check(presented==240,"unpaced capture remains presentable after initial anchor");
+ check(!cadence.rateSkipsCandidate(100000000,1000000,interval,interval),"late completion recovers instead of starving on expired media deadline");
+ cadence.submitted(100000000);
+ check(cadence.rateSkipsCandidate(100000001,100000001,interval,interval*4),"active cap still skips candidates before its next slot");
+ cadence.reset();
+ check(!cadence.rateSkipsCandidate(100000001,100000001,interval,interval*4),"reset admits first frame immediately");
+ }
for(double fps:{60.0,60000.0/1001.0}){
CaptureHalfRate sampler;const auto dt=int64_t(std::llround(10000000.0/fps));int kept=0;bool ordered=true;
for(int i=0;i<600;++i){const bool accepted=sampler.accept(i*dt+(i%3-1)*1000,dt,false);kept+=accepted;ordered&=accepted==(i%2==0);}