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(fsr-telemetry): cumulative submission accounting, application-side FG timing

Veyra Goal Agent0d3c07331bad
diff --git a/apps/veyra/ui/LiveStatusDashboard.h b/apps/veyra/ui/LiveStatusDashboard.h
index ccb88c6b..43d9c76f 100644
--- a/apps/veyra/ui/LiveStatusDashboard.h
+++ b/apps/veyra/ui/LiveStatusDashboard.h
@@ -36,7 +36,10 @@ inline void paintDashboard(HWND h,HDC dc,int w,int height,const engine::PlayerSn
for(int i=0;i<4;++i){int x=left+i*(cw+gap);card(x,top,cw,58);text(names[i],x+6,top+7,cw-10,17,9,secondary);
const auto& a=f.gpuTiming[size_t(stages[i])];std::wstring value=L"—";
if(active){if(a.mean)value=std::format(L"{:.1f}",*a.mean);else if(s.metrics.gpu[size_t(stages[i])].state==diagnostics::SampleState::NotExecuted)value=(i==3&&s.applied.multiplier>1)?L"等待补帧":L"未开启";}
- if(i==3&&s.applied.multiplier>1&&engine::presentSinkFrameGeneration(s.applied.frameGenerationBackend))value=L"不可测";
+ // Present-sink FG backends now report an application-side GPU sample;
+ // show it instead of a hardcoded placeholder, and only say
+ // "sampling" while no sample has arrived yet.
+ if(i==3&&s.applied.multiplier>1&&engine::presentSinkFrameGeneration(s.applied.frameGenerationBackend)&&!a.mean)value=L"采样中";
text(value,x+6,top+27,cw-10,24,14,textColor);
}
const int chartTop=104,chartH=std::max(92,height-188),bottom=chartTop+chartH+8,bw=(w-26)/2;
@@ -71,6 +74,6 @@ inline void paintDashboard(HWND h,HDC dc,int w,int height,const engine::PlayerSn
text(L"当前状态",26+bw,bottom+6,bw-20,18,10,secondary);
{AlphaGraphics draw(dc);Gdiplus::SolidBrush dot(Gdiplus::Color(255,GetRValue(color),GetGValue(color),GetBValue(color)));draw.get().FillEllipse(&dot,dip(h,27+bw),dip(h,bottom+35),dip(h,8),dip(h,8));}
text(status,42+bw,bottom+27,bw-38,23,16,textColor);
- text(xess?L"* 耗时不含XeSS FG · 队列不含SDK内部":L"增强阶段GPU计时 · 不含音频和呈现等待",12,height-18,w-24,16,8,secondary);
+ text(xess?L"* 帧生成耗时为应用侧计时,不含提供方内部插值":L"增强阶段GPU计时 · 不含音频和呈现等待",12,height-18,w-24,16,8,secondary);
}
}
diff --git a/apps/veyra/ui/LiveStatusPanel.h b/apps/veyra/ui/LiveStatusPanel.h
index 9f569100..1b83ad89 100644
--- a/apps/veyra/ui/LiveStatusPanel.h
+++ b/apps/veyra/ui/LiveStatusPanel.h
@@ -67,7 +67,9 @@ inline LRESULT CALLBACK proc(HWND h,UINT message,WPARAM wp,LPARAM lp){
const diagnostics::GpuStage stages[]={diagnostics::GpuStage::Color,diagnostics::GpuStage::Sr,diagnostics::GpuStage::Flow,diagnostics::GpuStage::Nr,diagnostics::GpuStage::Residual,diagnostics::GpuStage::FgBatch,diagnostics::GpuStage::Blit};
const wchar_t* names[]={L"② 输入颜色",L"③ 超分 SR",L"④ 光流队列区间",L"⑤ NR 增强",L"⑥ 残差合成",L"⑦ 补帧 FG",L"⑧ 输出合成"};
for(size_t i=0;i<std::size(stages);++i){const auto& sample=s.metrics.gpu[size_t(stages[i])];
- const auto value=xess&&stages[i]==diagnostics::GpuStage::FgBatch?L"SDK内部不可测":sample.state==diagnostics::SampleState::NotExecuted?L"未执行":timing(f.gpuTiming[size_t(stages[i])]);
+ // Present-sink FG (XeSS/FSR) is timed application-side; only fall
+ // back to the placeholder while no sample has been collected.
+ const auto value=(xess&&stages[i]==diagnostics::GpuStage::FgBatch&&!f.gpuTiming[size_t(stages[i])].mean)?L"SDK内部不可测":sample.state==diagnostics::SampleState::NotExecuted?L"未执行":timing(f.gpuTiming[size_t(stages[i])]);
rows.emplace_back(names[i],value);
}
rows.emplace_back(L"⑨ 等待显示时间",timing(f.cpuTiming[size_t(diagnostics::CpuStage::DeadlineWait)]));
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index 7af6f6c3..516ed90c 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -60,6 +60,15 @@
- **验证**:`veyra_bitstream_probe 48000 --write-test` 在本机 SPDIF 上打开独占 AC-3 载波并写穿数据通路(`endpoint[1] wrote 245760 bytes through the exclusive carrier`);delivery 短测 PASS `logs/delivery/e09ea0d7fdb34e38b238ee12dd255fc5/result.json`。UI 文案与帮助同步更新("位流优先:优先直通给功放(无直通时解码为 PCM)")。
- **未验证(如实)**:本机采集卡不提供位流(G-1),**没有端到端的真实 Dolby 源验证**;需要持"支持位流输入的采集卡 + 支持解码的功放/回音壁"的用户按"位流优先"模式实测并回传 `capture-audio-bitstream` 日志(应出现 `passthrough to receiver kind=... endpoint="..."`)。E-AC-3/Atmos 直通依赖端点驱动声明,当前主流 Windows 端点普遍不支持。
+### 2026-09-16 FSR 统计显示修复:SDK 提交归零 / 补帧受限误报 / 帧生成耗时不可测
+
+用户报告 FSR 开启后"SDK提交 0.0 fps + 当前状态:补帧受限",而实测日志显示 FSR 在正常补帧(`real=479 generated=466 presented=945`)。排查定位两处统计缺陷并修复:
+
+- **提交计数相位丢失**(EngineController):present-sink FG 的 `xessSdkSubmitFps` 原来按"每次提交前后计数差"喂入;AMD provider 在**自己的线程**上报呈现,回调落在提交窗口之后时差值恒 0(XeSS 的计数在渲染线程同步维护所以"秒出")。改为**累计对齐**:每次提交后喂"累计值 - 已喂值",任何迟到的增量都会在下一次提交补上;settings 变化时随 presenter 一起归零。UI 的"补帧受限"判定(`actual<target*0.95` 连续 8 次)以该值为输入——归零被修复后误报随之消失。
+- **帧生成耗时"不可测"**(VideoPresenter/EngineController/UI):present-sink FG 现在在提交列表上对 XeSS/FSR 的应用侧工作(输入拷贝、barrier、provider prepare)打 `FgBatch` GPU 时间戳;`measured.gpu[FgBatch]` 在 present-sink 模式下取 presenter 样本(图内 DLSS FG 仍用 graph 样本);Dashboard/Panel 去掉硬编码"不可测",无样本时显示"采样中"。实测 `gpuFgBatchP95Ms=0.197`(4K30 + FSR 2X)。
+- 证据:本机 30 秒 FSR 运行 `real=839/generated=838/presented=1677`、`presentSubmitFps=30.00`、`gpuFgBatchP95Ms=0.197`;delivery 短测 PASS `logs/delivery/442f41e29b684e7e87174bc075d4e282/result.json`。
+- **边界(如实)**:FgBatch 为**应用侧**计时(提供方内部的插值工作不经过我们的队列,无法打点);用户机器上"SDK提交=0"的原始触发未能在本机复现(本机 r3 正常),累计对齐是针对该症状的根治性修法,需要用户在 r4 包上复测确认。
+
## 2026-09-15 采集卡直播窗口标题修复(第三方工具“识别不到 Veyra”)
用户反馈除 OBS 外各平台直播工具无法识别“正在采集中的 Veyra”,且顺序敏感:先抓到窗口再开采集卡正常,先开采集卡再抓就抓不到。实机取证确认根因是 Veyra 自己:采集卡来源 `capture:`/`capture2:` 连接串被当文件名写进主窗口标题,实测标题长 776 字符(`Veyra — capture2:<十六进制设备路径>:...`),空闲/播放文件时为正常短名;直播伴侣日志把该标题截断到 259 字符后参与来源命名,其包内前端以 `${exe} ${title}` 命名来源。同场会话的 mediasdk_server 日志显示“采集卡已运行再添加 game 来源”的 hook 通路实际成功(`Load Shared Texture Success, size: 842 x 494`、`OnAutoSwitchMode from Window to Game`、GameSource 连续 60 秒以上有数据),因此本轮不做换链/画面的猜测性改动。
diff --git a/include/veyra/engine/VideoPresenter.h b/include/veyra/engine/VideoPresenter.h
index 08c83549..44cf4482 100644
--- a/include/veyra/engine/VideoPresenter.h
+++ b/include/veyra/engine/VideoPresenter.h
@@ -35,7 +35,11 @@ public:
// per-frame history reset, never a per-frame toggle.
void setXessGenerationSuppressed(bool v){xessGenerationSuppressed_=v;}
bool xessGenerationSuppressed() const {return xessGenerationSuppressed_;}
-diagnostics::GpuSample blitTiming(ID3D12Fence* f,uint64_t revision=0,uint64_t epoch=0){gpuTimer_.collect(f);if((revision&&gpuTimer_.last().identity.settingsRevision!=revision)||(epoch&&gpuTimer_.last().identity.epoch!=epoch)){diagnostics::GpuSample pending;pending.state=diagnostics::SampleState::Pending;return pending;}return gpuTimer_.last().gpu[size_t(diagnostics::GpuStage::Blit)];}
+ diagnostics::GpuSample blitTiming(ID3D12Fence* f,uint64_t revision=0,uint64_t epoch=0){gpuTimer_.collect(f);if((revision&&gpuTimer_.last().identity.settingsRevision!=revision)||(epoch&&gpuTimer_.last().identity.epoch!=epoch)){diagnostics::GpuSample pending;pending.state=diagnostics::SampleState::Pending;return pending;}return gpuTimer_.last().gpu[size_t(diagnostics::GpuStage::Blit)];}
+ // Application-side frame-generation timing for present-sink backends
+ // (XeSS/FSR): the copies, barriers and provider prepare work recorded on
+ // our list. collect() is idempotent, so this is safe alongside blitTiming.
+ diagnostics::GpuSample fgTiming(ID3D12Fence* f,uint64_t revision=0,uint64_t epoch=0){gpuTimer_.collect(f);if((revision&&gpuTimer_.last().identity.settingsRevision!=revision)||(epoch&&gpuTimer_.last().identity.epoch!=epoch)){diagnostics::GpuSample pending;pending.state=diagnostics::SampleState::Pending;return pending;}return gpuTimer_.last().gpu[size_t(diagnostics::GpuStage::FgBatch)];}
std::vector<diagnostics::GpuFrameTiming> takeGpuTimings(ID3D12Fence* fence){gpuTimer_.collect(fence);return gpuTimer_.takeCompleted();}
void recordGpuTimings(){gpuTimer_.recordCompleted();}
private:
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index 2e3c5c55..4ac6ced9 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -408,6 +408,12 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
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
+ // after a submission; feeding the cumulative difference at the
+ // next submission cannot lose them. Reset with the presenter.
+ uint64_t fedXessPresented=0,fedXessGenerated=0,fedFsrPresented=0,fedFsrGenerated=0;
double playbackSpeedLastPts=0;Clock::time_point playbackSpeedLastWall{};
CaptureHalfRate captureSampler;
FrameLineageTracker lineageTracker;
@@ -953,7 +959,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);}
+ if(settingsChanged){xessGenerationGate.reset();presenter.setXessGenerationSuppressed(false);fedXessPresented=fedXessGenerated=fedFsrPresented=fedFsrGenerated=0;}
playbackSpeedLastWall={};
if(liveScheduler){liveStats={};liveStats.identity=out.batch.identity;liveSubmissions.clear();liveAges.clear();liveWaits.clear();livePresent.clear();liveReady.clear();}
if(settingsChanged||!completionRates)completionRates=std::make_shared<FrameCompletionRates>(host100ns());
@@ -1059,21 +1065,27 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
}
const auto waited=elapsedMs(*s.deadlineStart);s.deadlineStart.reset();s.waitMs+=waited;flow->cpu(diagnostics::CpuStage::DeadlineWait,waited,host100ns());
const auto begin=Clock::now();const auto before=presenter.submittedCount();
- const auto beforeXess=presenter.xessGeneratedCount(),beforeXessPresented=presenter.xessPresentedCount();
- const auto beforeFsr=presenter.fsrGeneratedCount(),beforeFsrPresented=presenter.fsrPresentedCount();
if(!presenter.present(ctx,ring,graph,item.lease->slot,generated,item.lease->referencesValid,comparisonMode_,comparisonBase_,comparisonSplit_,item.identity,previewView()))return {State::Failed};
- const auto xessGenerated=presenter.xessGeneratedCount()-beforeXess,xessPresented=presenter.xessPresentedCount()-beforeXessPresented;
- const auto fsrGenerated=presenter.fsrGeneratedCount()-beforeFsr,fsrPresented=presenter.fsrPresentedCount()-beforeFsrPresented;
item.lease->consumerFence=ring.lastSignaledValue();const bool didPresent=presenter.submittedCount()>before;s.blit=presenter.blitTiming(ctx.fence());
const auto elapsed=elapsedMs(begin);s.presentMs+=elapsed;flow->cpu(diagnostics::CpuStage::Present,elapsed,host100ns());
if(didPresent){
traceFrame(diagnostics::TraceKind::Present,item.identity,batch.batch.batchId,item.lease->consumerFence,item.pts100ns,item.subframe,1,elapsed);
if(veyra::log::verboseFrameLogs())veyra::log::info("submit",std::format("batch={} epoch={} revision={} subframe={} pts100ns={} host100ns={} fence={} (submission, display unmeasured)",batch.batch.batchId,item.identity.epoch,item.identity.settingsRevision,item.subframe,item.pts100ns,host100ns(),item.lease->consumerFence));
}
- if(xessPresented)flow->xessSubmitted(xessPresented,xessGenerated,host100ns());
- // Same metric shape for the AMD provider: frames it actually
- // submitted to the display, real and generated.
- if(fsrPresented)flow->xessSubmitted(fsrPresented,fsrGenerated,host100ns());
+ // Cumulative alignment: feed whatever the providers reported
+ // since the last submission. The AMD provider publishes from
+ // its own thread, so a per-call delta can miss an update that
+ // lands just after the call and would then never be counted.
+ {
+ const auto xessPresentedTotal=presenter.xessPresentedCount(),xessGeneratedTotal=presenter.xessGeneratedCount();
+ const uint64_t xessPresented=xessPresentedTotal-fedXessPresented,xessGenerated=xessGeneratedTotal-fedXessGenerated;
+ if(xessPresented){flow->xessSubmitted(xessPresented,xessGenerated,host100ns());fedXessPresented=xessPresentedTotal;fedXessGenerated=xessGeneratedTotal;}
+ const auto fsrPresentedTotal=presenter.fsrPresentedCount(),fsrGeneratedTotal=presenter.fsrGeneratedCount();
+ const uint64_t fsrPresented=fsrPresentedTotal-fedFsrPresented,fsrGenerated=fsrGeneratedTotal-fedFsrGenerated;
+ // Same metric shape for the AMD provider: frames it actually
+ // submitted to the display, real and generated.
+ if(fsrPresented){flow->xessSubmitted(fsrPresented,fsrGenerated,host100ns());fedFsrPresented=fsrPresentedTotal;fedFsrGenerated=fsrGeneratedTotal;}
+ }
if(didPresent&&!isCapture){
lastFilePresentedMs=itemPtsMs;lastFilePresentLateness=fileAwaitingVideo?0:nowMs()-itemPtsMs;
{std::lock_guard lock(mutex_);if(snapshot_.sessionId==runSessionId&&snapshot_.applied.revision==item.identity.settingsRevision){
@@ -1163,7 +1175,12 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
}
#endif
diagnostics::FrameMetrics measured;pipeline::EnhanceGraph::Metrics graphStats;uint64_t slotWaitCount=0,commandSubmits=0;double slotWaitMilliseconds=0;uint32_t slotsInFlight=0;
- {measured=graph.gpuMetrics();graphStats=graph.metrics();measured.gpu[size_t(diagnostics::GpuStage::Blit)]=presenter.blitTiming(ctx.fence(),options.settings.revision,out.batch.identity.epoch);slotWaitCount=ring.cpuWaitCount()-slotWaitBase;slotWaitMilliseconds=ring.cpuWaitMilliseconds()-slotWaitMsBase;commandSubmits=ring.submitCount()-submitBase;slotsInFlight=ring.inFlightCount();
+ {measured=graph.gpuMetrics();graphStats=graph.metrics();measured.gpu[size_t(diagnostics::GpuStage::Blit)]=presenter.blitTiming(ctx.fence(),options.settings.revision,out.batch.identity.epoch);
+ // Present-sink FG backends record their application-side work on
+ // the presenter's list; surface that sample instead of leaving
+ // the stage unmeasured. The in-graph DLSS FG keeps its own.
+ if(graph.xessEnabled()||graph.fsrEnabled())measured.gpu[size_t(diagnostics::GpuStage::FgBatch)]=presenter.fgTiming(ctx.fence(),options.settings.revision,out.batch.identity.epoch);
+ slotWaitCount=ring.cpuWaitCount()-slotWaitBase;slotWaitMilliseconds=ring.cpuWaitMilliseconds()-slotWaitMsBase;commandSubmits=ring.submitCount()-submitBase;slotsInFlight=ring.inFlightCount();
collectTimings();
}
if(measured.identity.settingsRevision!=options.settings.revision||measured.identity.epoch!=out.batch.identity.epoch){measured={};measured.identity=out.batch.identity;for(auto& sample:measured.gpu)sample.state=diagnostics::SampleState::Pending;}
diff --git a/src/engine/VideoPresenter.cpp b/src/engine/VideoPresenter.cpp
index a44067ce..1695b390 100644
--- a/src/engine/VideoPresenter.cpp
+++ b/src/engine/VideoPresenter.cpp
@@ -93,6 +93,11 @@ bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing&
if(enabled){
// XeSS-FG ONLY_NOW records its input copies on this same command
// list. Keep the Veyra state contract explicit on both sides.
+ // Timed as the application-side frame-generation stage: the
+ // provider's internal interpolation cannot be timestamped, but the
+ // copies and barriers it makes us record can, and that is what the
+ // dashboard shows for present-sink FG backends.
+ gpuTimer_.mark(list,diagnostics::GpuStage::FgBatch);
ID3D12Resource* resources[]={bb,motion,depth};
D3D12_RESOURCE_BARRIER toCopy[3]{};
for(unsigned i=0;i<3;++i){
@@ -106,6 +111,7 @@ bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing&
if(!xess->tag(list,bb,motion,depth,fgRect,true,reset,elapsed)){xessFailed_=true;return false;}
for(auto& barrier:toCopy)std::swap(barrier.Transition.StateBefore,barrier.Transition.StateAfter);
list->ResourceBarrier(3,toCopy);
+ 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;
}
@@ -116,7 +122,9 @@ bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing&
// The AMD presenter degrades inside the provider (generation off, plain
// presentation continues) instead of failing the frame: tearing the
// swapchain down would only cost the session a restart.
+ if(enabled)gpuTimer_.mark(list,diagnostics::GpuStage::FgBatch);
if(!fsr->tag(list,bb,graph.presentMotion(slot),graph.presentDepth(),fgRect,enabled,reset,elapsed))fsrFailed_=true;
+ if(enabled)gpuTimer_.mark(list,diagnostics::GpuStage::FgBatch,true);
if(sink_.fsr()->failed())fsrFailed_=true;
lastFsrFrame_=now;lastFsrIdentity_=identity;fsrWasEnabled_=enabled;
}