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

feat(ui): add latency dashboard chart and live output queue status

Veyra Goal Agent9057d2fb5e05
diff --git a/apps/veyra/ui/LiveStatusDashboard.h b/apps/veyra/ui/LiveStatusDashboard.h
new file mode 100644
index 00000000..af54a6b3
--- /dev/null
+++ b/apps/veyra/ui/LiveStatusDashboard.h
@@ -0,0 +1,72 @@
+#pragma once
+#include <deque>
+#include <optional>
+
+namespace veyra::ui::live_status {
+struct DashboardHistory {
+ std::deque<std::optional<double>> points;
+ uint64_t session=0,revision=0;unsigned low=0,good=0;bool overloaded=false;
+ void sample(const engine::PlayerSnapshot& s){
+ if(session!=s.sessionId||revision!=s.applied.revision){points.clear();low=good=0;overloaded=false;session=s.sessionId;revision=s.applied.revision;}
+ const bool active=s.running&&!s.image&&s.transport==engine::TransportState::Playing&&!s.applying;
+ auto value=active?s.metrics.flow.cpuTiming[size_t(diagnostics::CpuStage::EnhancementDelayEstimate)].mean:std::optional<double>{};
+ points.push_back(value);if(points.size()>120)points.pop_front();
+ const bool xess=s.applied.frameGenerationBackend==engine::FrameGenerationBackend::XeSS&&s.applied.multiplier>1;
+ const double actual=xess?s.metrics.flow.xessSdkSubmitFps:s.metrics.flow.presentSubmitFps;
+ const double target=s.nominalSourceFps*(s.captureHalfRate?.5:1)*s.applied.multiplier;
+ if(!active||!s.metrics.flow.rateWindowReady||target<=0){low=good=0;overloaded=false;return;}
+ if(actual<target*.95){good=0;if(++low>=8)overloaded=true;}
+ else{low=0;if(++good>=8)overloaded=false;}
+ }
+};
+inline void paintDashboard(HWND h,HDC dc,int w,int height,const engine::PlayerSnapshot& s,const DashboardHistory& history){
+ const auto& f=s.metrics.flow;const bool active=s.running&&!s.image&&s.transport==engine::TransportState::Playing;
+ auto text=[&](std::wstring str,int x,int y,int width,int ht,int size,COLORREF color){chromeText(dc,h,str,x,y,width,ht,size,color);};
+ auto card=[&](int x,int y,int width,int ht){
+ AlphaGraphics draw(dc);auto& g=draw.get();g.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
+ Gdiplus::GraphicsPath p;const float r=float(dip(h,12)),xx=float(dip(h,x)),yy=float(dip(h,y)),ww=float(dip(h,width)),hh=float(dip(h,ht));
+ p.AddArc(xx,yy,r,r,180,90);p.AddArc(xx+ww-r,yy,r,r,270,90);p.AddArc(xx+ww-r,yy+hh-r,r,r,0,90);p.AddArc(xx,yy+hh-r,r,r,90,90);p.CloseFigure();
+ Gdiplus::SolidBrush bg(Gdiplus::Color(155,29,32,32));g.FillPath(&bg,&p);
+ Gdiplus::Pen edge(Gdiplus::Color(40,132,145,140),1);g.DrawPath(&edge,&p);
+ };
+ text(L"实时处理状态",12,7,w-100,24,12,textColor);text(L"详情 +",w-65,7,55,24,10,secondary);
+ const int gap=6,left=10,cw=(w-20-gap*3)/4,top=38;
+ const diagnostics::GpuStage stages[]={diagnostics::GpuStage::Flow,diagnostics::GpuStage::Nr,diagnostics::GpuStage::Sr,diagnostics::GpuStage::FgBatch};
+ const wchar_t* names[]={L"光流延迟",L"NR延迟",L"超分延迟",L"帧生成延迟"};
+ 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(s.metrics.gpu[size_t(stages[i])].state==diagnostics::SampleState::NotExecuted)value=L"未开启";else if(a.mean)value=std::format(L"{:.1f}",*a.mean);}
+ if(i==3&&s.applied.multiplier>1&&s.applied.frameGenerationBackend==engine::FrameGenerationBackend::XeSS)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;
+ card(10,chartTop,w-20,chartH);
+ text(L"增强额外延迟",20,chartTop+8,w-135,20,10,secondary);
+ const auto extra=active?f.cpuTiming[size_t(diagnostics::CpuStage::EnhancementDelayEstimate)].mean:std::optional<double>{};
+ text(extra?std::format(L"{:.1f}",*extra):L"—",w-103,chartTop+30,85,30,23,textColor);
+ text(L"ms · 总计估计",w-103,chartTop+62,85,18,9,secondary);
+ const int x0=20,x1=w-117,y0=chartTop+35,y1=chartTop+chartH-24;
+ if(x1>x0&&y1>y0){
+ double peak=10;for(const auto& v:history.points)if(v)peak=std::max(peak,*v*1.15);
+ {AlphaGraphics draw(dc);auto& g=draw.get();g.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
+ Gdiplus::Pen grid(Gdiplus::Color(50,150,160,155),1),line(Gdiplus::Color(240,203,219,210),float(dip(h,1)));
+ grid.SetDashStyle(Gdiplus::DashStyleDash);for(int i=0;i<3;++i){int y=y0+(y1-y0)*i/2;g.DrawLine(&grid,dip(h,x0),dip(h,y),dip(h,x1),dip(h,y));}
+ std::optional<Gdiplus::PointF> prev;size_t index=120-history.points.size();
+ for(const auto& v:history.points){const float x=float(dip(h,x0))+float(dip(h,x1-x0))*float(index++)/119;
+ if(!v){prev.reset();continue;}Gdiplus::PointF p(x,float(dip(h,y1))-float(dip(h,y1-y0))*float(*v/peak));if(prev)g.DrawLine(&line,*prev,p);prev=p;}}
+ text(L"30秒前",x0,y1+3,65,16,8,secondary);text(L"现在",x1-28,y1+3,28,16,8,secondary);
+ }
+ card(10,bottom,bw,58);card(16+bw,bottom,bw,58);
+ text(L"待输出画面",20,bottom+6,bw-20,18,10,secondary);
+ const bool xess=s.applied.multiplier>1&&s.applied.frameGenerationBackend==engine::FrameGenerationBackend::XeSS;
+ text(std::format(L"{} 帧{}",active?f.pendingOutputFrames:0,xess?L" *":L""),20,bottom+27,bw-20,23,17,textColor);
+ std::wstring status=L"待机";COLORREF color=RGB(145,151,149);
+ if(s.failed){status=L"错误";color=RGB(245,86,86);}
+ else if(active&&!s.applying&&f.rateWindowReady){status=history.overloaded?L"过载":L"正常";color=history.overloaded?RGB(242,185,65):RGB(111,211,127);}
+ else if(s.applying&&s.running)status=L"调整中";else if(active)status=L"采样中";else if(s.transport==engine::TransportState::Paused)status=L"已暂停";
+ 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"* 不含SDK内部队列 · 耗时单位ms":L"耗时单位ms · 额外延迟为稳态估计",12,height-18,w-24,16,8,secondary);
+}
+}
diff --git a/apps/veyra/ui/LiveStatusPanel.h b/apps/veyra/ui/LiveStatusPanel.h
index eaf42d4a..48bec8a9 100644
--- a/apps/veyra/ui/LiveStatusPanel.h
+++ b/apps/veyra/ui/LiveStatusPanel.h
@@ -1,17 +1,18 @@
#pragma once
#include "WorkspaceChrome.h"
#include <chrono>
+#include "LiveStatusDashboard.h"
namespace veyra::ui {
namespace live_status {
-struct State {engine::EngineController* engine;int scroll=0,maxScroll=0;bool advanced=false;};
+struct State {engine::EngineController* engine;int scroll=0,maxScroll=0;bool advanced=false;DashboardHistory history;};
inline LRESULT CALLBACK proc(HWND h,UINT message,WPARAM wp,LPARAM lp){
auto* state=reinterpret_cast<State*>(GetWindowLongPtrW(h,GWLP_USERDATA));
if(message==WM_NCCREATE){state=new State{static_cast<engine::EngineController*>(reinterpret_cast<CREATESTRUCTW*>(lp)->lpCreateParams)};SetWindowLongPtrW(h,GWLP_USERDATA,LONG_PTR(state));}
if(!state)return DefWindowProcW(h,message,wp,lp);
switch(message){
case WM_CREATE:SetTimer(h,1,250,nullptr);return 0;
- case WM_TIMER:if(IsWindowVisible(h))InvalidateRect(h,nullptr,FALSE);return 0;
+ case WM_TIMER:state->history.sample(state->engine->snapshot());if(IsWindowVisible(h))InvalidateRect(h,nullptr,FALSE);return 0;
case WM_SIZE:InvalidateRect(h,nullptr,FALSE);return 0;
case WM_LBUTTONUP:if(GET_Y_LPARAM(lp)<dip(h,34)){state->advanced=!state->advanced;state->scroll=0;InvalidateRect(h,nullptr,FALSE);}return 0;
case WM_MOUSEWHEEL:state->scroll=std::clamp(state->scroll-GET_WHEEL_DELTA_WPARAM(wp)/WHEEL_DELTA*50,0,state->maxScroll);InvalidateRect(h,nullptr,FALSE);return 0;
@@ -20,6 +21,7 @@ inline LRESULT CALLBACK proc(HWND h,UINT message,WPARAM wp,LPARAM lp){
PaintBuffer paint(h);fillSurface(paint.dc,paint.rect,h);
const int width=MulDiv(paint.rect.right,96,veyra::ui::layoutDpi(h)),height=MulDiv(paint.rect.bottom,96,veyra::ui::layoutDpi(h));
const auto s=state->engine->snapshot();const auto& f=s.metrics.flow;
+ if(!state->advanced){paintDashboard(h,paint.dc,width,height,s,state->history);return 0;}
const bool playing=s.running&&!s.image&&s.transport==engine::TransportState::Playing;
const bool xess=s.applied.frameGenerationBackend==engine::FrameGenerationBackend::XeSS&&s.applied.multiplier>1;
auto write=[&](const std::wstring& value,int x,int y,int w,int ht,int size,COLORREF color){chromeText(paint.dc,h,value,x,y,w,ht,size,color);};
diff --git a/docs/LIVE_STATUS_DASHBOARD_2026-09-12.md b/docs/LIVE_STATUS_DASHBOARD_2026-09-12.md
new file mode 100644
index 00000000..b5ae4706
--- /dev/null
+++ b/docs/LIVE_STATUS_DASHBOARD_2026-09-12.md
@@ -0,0 +1,10 @@
+
+## 2026-09-12 状态面板卡片与曲线
+
+按用户图片将默认实时状态面板改为深色圆角卡片:光流/NR/SR/FG四项最近一秒GPU均值;30秒额外延迟估计历史(250ms采样,缺失断线、不填0);旁边总估计;底部待输出帧数和状态。详情保留旧阶段诊断。代码 apps/veyra/ui/LiveStatusDashboard.h。
+
+FrameFlowMetrics.pendingOutputFrames 接实际呈现作业中尚未消费的有效帧机会(含待GPU完成、待截止时间的原帧/有效生成帧,不把两个batch冒充两帧),正常呈现、过期、取消均扣除;XeSS SDK内部队列不可观测,卡片星号注明不含内部队列。低于请求目标95%持续8个250ms样本判黄过载;达到阈值持续8样本恢复绿正常;failed红错误;待机/暂停/采样/调整灰。95%容差防止59.94相对60等正常抖动报警;无目标不据此推断性能。软件reported failed以外未知故障不能凭低FPS武断标红。
+
+构建logs/dashboard-final-build.log通过;中途scope guard初始化/文本替换两次编译错误修复,保留dashboard-build.log和dashboard-build2.log。UI脚本logs/dashboard-ui.log通过(模式切换/全屏/详情),overview截图实际查看布局完整。修复待机applying残留显示后最终构建通过。repair_contract 88checks0failures,logs/dashboard-contract.log。
+
+用户4K视频原生NR+2X实际12秒smoke退出0,294原帧、292生成、failed=false。logs/dashboard-4k.log,稳态pendingFrames=1,额外延迟估计约0.4–0.5ms,absLatenessP95=0.81ms。仅本地RTX运行验证,未做PS5/采集卡实测和人为故障红灯注入。没有发布、push或二进制入Git;桌面PS5测试版仍指向已更新EXE。
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index a8839b3b..6e239cf4 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -1692,3 +1692,13 @@ LiveStatusPanel主数改“增强额外延迟 · 估计”,原驻留均值/P95
构建 out/remoteplay/build-extra-delay.cmd 通过,logs/extra-delay-final-build.log。repair_contract_tests 88 checks 0 failures(含预读取不计延迟、基线扣除、未知/无效样本检查),logs/extra-delay-contract.log。UI首次脚本过早检查WM_CREATE子控件失败,保留logs/extra-delay-ui.log;加同步WM_NULL等待创建处理完毕后重跑通过,logs/extra-delay-ui-retry.log,overview实际截图已查看。最终仅修改底栏文案后重新构建通过。
用户GTAVI_An_Extended_Look_4K_Native.mp4实测12秒 --native --nr --fg-multiplier 2 --no-sr --smoke-seconds 12,exit0、291原帧/289生成、failed=false、末段约60呈现/秒、absLatenessP95=0.92ms,旧驻留P95=67.022ms;证据logs/extra-delay-4k.log。未执行实卡/PS5新对照测量。软件路径仍 out/remoteplay/product-repair/veyra.exe,桌面PS5测试版指向此处。未发布、未push、无二进制入Git。
+
+## 2026-09-12 状态面板卡片与曲线
+
+按用户图片将默认实时状态面板改为深色圆角卡片:光流/NR/SR/FG四项最近一秒GPU均值;30秒额外延迟估计历史(250ms采样,缺失断线、不填0);旁边总估计;底部待输出帧数和状态。详情保留旧阶段诊断。代码 apps/veyra/ui/LiveStatusDashboard.h。
+
+FrameFlowMetrics.pendingOutputFrames 接实际呈现作业中尚未消费的有效帧机会(含待GPU完成、待截止时间的原帧/有效生成帧,不把两个batch冒充两帧),正常呈现、过期、取消均扣除;XeSS SDK内部队列不可观测,卡片星号注明不含内部队列。低于请求目标95%持续8个250ms样本判黄过载;达到阈值持续8样本恢复绿正常;failed红错误;待机/暂停/采样/调整灰。95%容差防止59.94相对60等正常抖动报警;无目标不据此推断性能。软件reported failed以外未知故障不能凭低FPS武断标红。
+
+构建logs/dashboard-final-build.log通过;中途scope guard初始化/文本替换两次编译错误修复,保留dashboard-build.log和dashboard-build2.log。UI脚本logs/dashboard-ui.log通过(模式切换/全屏/详情),overview截图实际查看布局完整。修复待机applying残留显示后最终构建通过。repair_contract 88checks0failures,logs/dashboard-contract.log。
+
+用户4K视频原生NR+2X实际12秒smoke退出0,294原帧、292生成、failed=false。logs/dashboard-4k.log,稳态pendingFrames=1,额外延迟估计约0.4–0.5ms,absLatenessP95=0.81ms。仅本地RTX运行验证,未做PS5/采集卡实测和人为故障红灯注入。没有发布、push或二进制入Git;桌面PS5测试版仍指向已更新EXE。
diff --git a/include/veyra/diagnostics/FrameMetrics.h b/include/veyra/diagnostics/FrameMetrics.h
index bb8ce0aa..3e320b52 100644
--- a/include/veyra/diagnostics/FrameMetrics.h
+++ b/include/veyra/diagnostics/FrameMetrics.h
@@ -47,6 +47,7 @@ struct FrameFlowMetrics {
bool rateWindowReady=false;
std::optional<double> softwareLatencyMs,softwareLatencyP95Ms,slotWaitPerFrameMs;
uint64_t latencySamples=0;
+ uint32_t pendingOutputFrames=0; // valid frame opportunities retained by presenter jobs
std::array<TimingAggregate,size_t(GpuStage::Count)> gpuTiming;
std::array<TimingAggregate,size_t(CpuStage::Count)> cpuTiming;
std::array<TimingAggregate,size_t(PairTiming::Count)> pairTiming;
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index 5261dc18..8b14dc3d 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -680,17 +680,22 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
auto watch=std::make_shared<CompletionWatch>();watch->output=out;watch->flow=frameFlow;watch->processStart=processStart;watch->real=!rereadCached;
pendingCompletions.push_back(watch);
struct LiveStepState {
- unsigned next=0,handled=0;bool readyReported=false;
+ unsigned next=0,handled=0,remaining=0;bool readyReported=false;
Clock::time_point readyStart=Clock::now();std::optional<Clock::time_point> deadlineStart;
double readyMs=0,waitMs=0,presentMs=0,ageMs=0;uint64_t count=0,dropped=0;
diagnostics::GpuSample blit;
};
auto step=std::make_shared<LiveStepState>();
+ for(unsigned i=0;i<out.batch.count;++i)if(out.batch.frames[i].kind!=pipeline::FrameKind::Generated||out.batch.frames[i].validity==pipeline::GenerationValidity::Valid)++step->remaining;
const double sourceIntervalMs=double(liveSourceInterval100ns(pkt.duration,activeSource->info().averageFps))/10000;
const auto baselineReady=pkt.decodedHost100ns>0?pkt.decodedHost100ns:captureArrival;
const bool delayEnhanced=options.nr||options.sr||options.fg;
if(!liveScheduler->push([&,watch,step,timeline,captureArrival,baselineReady,delayEnhanced,lineage,jobGeneration,rereadCached,sourceIntervalMs,flow=frameFlow](int64_t now)->LiveGpuScheduler::Step{
using State=LiveGpuScheduler::State;auto& batch=watch->output;auto& s=*step;
+ auto updatePending=[&](LiveStepState*){
+ unsigned left=0;for(unsigned i=s.next;i<batch.batch.count;++i)if(batch.batch.frames[i].kind!=pipeline::FrameKind::Generated||batch.batch.frames[i].validity==pipeline::GenerationValidity::Valid)++left;
+ flow->update([&](auto& m){m.pendingOutputFrames-=std::min(m.pendingOutputFrames,s.remaining-left);});s.remaining=left;
+ };std::unique_ptr<LiveStepState,decltype(updatePending)> pendingUpdate(&s,updatePending);
if(!watch->ready){
if(elapsedMs(s.readyStart)>2000){veyra::log::error("capture-present","GPU ready timeout");return {State::Failed};}
return {State::Pending,now+2000};
@@ -764,6 +769,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
return {State::Complete};
},[&,watch,step,flow=frameFlow]{
const auto& batch=watch->output;const auto& s=*step;
+ flow->update([&](auto& m){m.pendingOutputFrames-=std::min(m.pendingOutputFrames,s.remaining);});
if(s.handled<batch.batch.count)++presentationCancelledJobs;
if(s.handled<batch.batch.count)traceFrame(diagnostics::TraceKind::Cancelled,batch.batch.identity,batch.batch.batchId,0,batch.batch.b100ns,0,batch.batch.count-s.handled,0);
flow->update([&](auto& m){m.counters.cancelledBeforePresent+=batch.batch.count-s.handled;m.gpuReadyWaitMs=s.readyMs;m.deadlineWaitMs=s.waitMs;if(s.count)m.captureArrivalToPresentReturnMs=s.ageMs;m.counters.generatedExpiredAfterEval+=s.dropped;});
@@ -773,6 +779,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
liveAges.add(s.ageMs);liveWaits.add(s.waitMs);livePresent.add(s.presentMs);liveReady.add(s.readyMs);liveStats.ageP95=liveAges.p95();liveStats.waitP95=liveWaits.p95();liveStats.presentP95=livePresent.p95();liveStats.readyP95=liveReady.p95();}
liveStats.fps=liveSubmissions.size()>1?double(liveSubmissions.size()-1)*1e7/(liveSubmissions.back()-liveSubmissions.front()):0;
})){status(L"视频呈现队列失败",true);break;}
+ frameFlow->update([&](auto& m){m.pendingOutputFrames+=step->remaining;});
advanceLive();
const auto occupancy=liveScheduler->occupancy();frameFlow->update([&](auto& m){m.counters.presentationBatchHighWater=std::max(m.counters.presentationBatchHighWater,occupancy);});
const auto completed=liveStats;
@@ -857,6 +864,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
if(Clock::now()>=nextTimingLog){const auto [retained,overwritten]=Logger::instance().frameTraceSize();
veyra::log::info("frame-trace",std::format("retained={} capacity=8192 overwritten={} (records available in diagnostic preview)",retained,overwritten));}
if(!isCapture&&Clock::now()>=nextTimingLog){const double playbackSpeedNow=[&]{std::lock_guard lock(mutex_);return snapshot_.playbackSpeed;}();
+ {const auto dashboard=frameFlow->snapshot(host100ns());veyra::log::info("output-queue",std::format("pendingFrames={} extraDelayEstimateMs={:.3f}",dashboard.pendingOutputFrames,dashboard.cpuTiming[size_t(diagnostics::CpuStage::EnhancementDelayEstimate)].mean.value_or(-1)));}
veyra::log::info("player-timing",std::format("revision={} decodeP95Ms={:.3f} graphSubmitP95Ms={:.3f} gpuReadyP95Ms={:.3f} presentP95Ms={:.3f} gpuColorP95Ms={:.3f} gpuSrP95Ms={:.3f} gpuFlowP95Ms={:.3f} gpuNrP95Ms={:.3f} gpuResidualP95Ms={:.3f} gpuFgBatchP95Ms={:.3f} gpuBlitP95Ms={:.3f} slotWaits={} slotWaitMs={:.3f} commandSubmits={} displaySubmits={} expiredGenerated={} previewSkipped={} playbackSpeed={:.3f} processed={}",options.settings.revision,decodeTimes.p95(),processTimes.p95(),liveScheduler?completed.readyP95:gpuReadyTimes.p95(),presentP95,gpuP95(diagnostics::GpuStage::Color),gpuP95(diagnostics::GpuStage::Sr),gpuP95(diagnostics::GpuStage::Flow),gpuP95(diagnostics::GpuStage::Nr),gpuP95(diagnostics::GpuStage::Residual),gpuP95(diagnostics::GpuStage::FgBatch),gpuP95(diagnostics::GpuStage::Blit),slotWaitCount,slotWaitMilliseconds,commandSubmits,submitted,expired,measured.flow.counters.previewSkippedBeforeGraph,playbackSpeedNow,sourceFrames-statsSourceBase));nextTimingLog=Clock::now()+std::chrono::seconds(1);}
if(isCapture&&Clock::now()>=nextTimingLog){
logFrameFlow(measured.flow,"active");