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(fg): capability-driven 2X..6X multi-frame generation

Veyra Goal Agent35dd632ab11e
diff --git a/apps/veyra/SettingsWindow.cpp b/apps/veyra/SettingsWindow.cpp
index a58edd67..4d325375 100644
--- a/apps/veyra/SettingsWindow.cpp
+++ b/apps/veyra/SettingsWindow.cpp
@@ -55,6 +55,19 @@ void syncProtection(const engine::ProtectionSettings& protection){
putText(206,(L"NR保护区域 · "+std::to_wstring(count)+L"/4").c_str());
}
void selectDiscrete(int group,int value){for(int j=0;j<(group==0?3:2);++j){auto h=item(700+group*10+j);if(j==value)SetPropW(h,L"veyra.selected",HANDLE(1));else RemovePropW(h,L"veyra.selected");InvalidateRect(h,nullptr,FALSE);}}
+// Multiplier list is capability-driven: the DLSS runtime reports how many
+// generated frames it supports (1 = 2X only on Ada, 5 = 6X on Blackwell), and
+// the XeSS unlock path raises its own ceiling. Unknown capability offers the
+// full list; the engine gate rejects an unsupported request with a message.
+int multiplierChoiceCount(engine::FrameGenerationBackend backend){
+ int cap=6;
+ if(backend==engine::FrameGenerationBackend::XeSS)cap=2; // raised by the MFG unlock path
+ else if(controller){const auto snapshot=controller->snapshot();if(snapshot.fgMultiFrameMax>0)cap=std::clamp(snapshot.fgMultiFrameMax+1,2,6);}
+ int count=1;
+ for(size_t i=1;i<engine::kFgMultiplierChoiceCount;++i)if(int(engine::kFgMultiplierChoices[i])<=cap)++count;
+ return count;
+}
+int multiplierChoiceIndex(uint32_t multiplier){for(size_t i=0;i<engine::kFgMultiplierChoiceCount;++i)if(engine::kFgMultiplierChoices[i]==multiplier)return int(i);return 0;}
void populate(engine::EnhancementSettings s){
populating=true;
float v[]={s.model.intensity,s.model.tone,s.model.structure,s.model.skin,float(s.model.style),float(s.model.autoMask),float(s.model.uiCorrection),s.residual.total,s.residual.darken,s.residual.brighten,s.residual.color,s.residual.luminance};
@@ -63,9 +76,9 @@ void populate(engine::EnhancementSettings s){
check(200,enhancementEnabled&&s.nr?BST_CHECKED:BST_UNCHECKED);
check(201,enhancementEnabled&&s.sr?BST_CHECKED:BST_UNCHECKED);
for(int j=0;j<3;++j){auto h=item(730+j);if(j==int(s.srTarget))SetPropW(h,L"veyra.selected",HANDLE(1));else RemovePropW(h,L"veyra.selected");InvalidateRect(h,nullptr,FALSE);}
- const int multiplierCount=s.frameGenerationBackend==engine::FrameGenerationBackend::XeSS?2:4;
- if(send(202,CB_GETCOUNT)!=multiplierCount){send(202,CB_RESETCONTENT);const wchar_t* choices[]={L"关闭补帧",L"2X · 一张中间帧",L"3X · 两张中间帧",L"4X · 三张中间帧"};for(int i=0;i<multiplierCount;++i)send(202,CB_ADDSTRING,0,LPARAM(choices[i]));}
- send(207,CB_SETCURSEL,s.videoSrQuality,0);send(202,CB_SETCURSEL,s.multiplier-1,0);
+ const int multiplierCount=multiplierChoiceCount(s.frameGenerationBackend);
+ if(send(202,CB_GETCOUNT)!=multiplierCount){send(202,CB_RESETCONTENT);const wchar_t* choices[]={L"关闭补帧",L"2X · 一张中间帧",L"3X · 两张中间帧",L"4X · 三张中间帧",L"6X · 五张中间帧"};for(int i=0;i<multiplierCount;++i)send(202,CB_ADDSTRING,0,LPARAM(choices[i]));}
+ send(207,CB_SETCURSEL,s.videoSrQuality,0);send(202,CB_SETCURSEL,multiplierChoiceIndex(s.multiplier),0);
send(208,CB_SETCURSEL,int(s.frameGenerationBackend),0);send(203,CB_SETCURSEL,int(s.nrPolicy),0);
send(218,CB_SETCURSEL,int(s.nrRuntime));
check(219,s.captureCompatible?BST_CHECKED:BST_UNCHECKED);check(220,s.lowLatency?BST_CHECKED:BST_UNCHECKED);
@@ -84,7 +97,7 @@ bool read(engine::EnhancementSettings& s,bool allPages=false){s=enhancementEnabl
s.model={v[0],v[1],v[2],v[3],int(v[4]),int(v[5]),int(v[6])};s.residual={v[7],v[8],v[9],v[10],v[11]};if(enhancementEnabled){s.nr=checked(200)==BST_CHECKED;s.sr=checked(201)==BST_CHECKED;}s.videoSrQuality=uint32_t(send(207,CB_GETCURSEL,0,0));s.nrPolicy=static_cast<pipeline::NrSizePolicy>(send(203,CB_GETCURSEL,0,0));if(allPages){
const auto multiplier=send(202,CB_GETCURSEL,0,0),generation=send(208,CB_GETCURSEL,0,0),flowBackend=send(209,CB_GETCURSEL,0,0),flowQuality=send(204,CB_GETCURSEL,0,0),content=send(205,CB_GETCURSEL,0,0);
if(multiplier==CB_ERR||generation==CB_ERR||flowBackend==CB_ERR||flowQuality==CB_ERR||content==CB_ERR){message(L"设置控件未完成初始化;未保存预设");return false;}
- s.multiplier=uint32_t(multiplier+1);s.frameGenerationBackend=static_cast<engine::FrameGenerationBackend>(generation);s.opticalFlowBackend=static_cast<engine::OpticalFlowBackend>(flowBackend);s.amdFlowHalfResolution=checked(215)==BST_CHECKED;s.flow=static_cast<engine::FlowQuality>(flowQuality);s.content=static_cast<engine::ContentRate>(content);
+ s.multiplier=(multiplier>=0&&multiplier<int(engine::kFgMultiplierChoiceCount))?engine::kFgMultiplierChoices[multiplier]:1;s.frameGenerationBackend=static_cast<engine::FrameGenerationBackend>(generation);s.opticalFlowBackend=static_cast<engine::OpticalFlowBackend>(flowBackend);s.amdFlowHalfResolution=checked(215)==BST_CHECKED;s.flow=static_cast<engine::FlowQuality>(flowQuality);s.content=static_cast<engine::ContentRate>(content);
s.audioSync=static_cast<engine::AudioSyncMode>(send(216,CB_GETCURSEL));
s.nrRuntime=static_cast<engine::NrRuntime>(send(218,CB_GETCURSEL));
s.captureCompatible=checked(219)==BST_CHECKED;s.lowLatency=checked(220)==BST_CHECKED;
@@ -99,7 +112,8 @@ bool read(engine::EnhancementSettings& s,bool allPages=false){s=enhancementEnabl
bool liveField(int id){
if(id==202){
const auto index=send(id,CB_GETCURSEL);if(index==CB_ERR)return false;
- const bool accepted=SendMessageW(GetParent(window),WM_APP+44,202,index+1)!=0;
+ const uint32_t requested=(index>=0&&index<int(engine::kFgMultiplierChoiceCount))?engine::kFgMultiplierChoices[index]:1;
+ const bool accepted=SendMessageW(GetParent(window),WM_APP+44,202,requested)!=0;
populate(enhancementEnabled?controller->snapshot().desired:configuredSettings);
message(accepted?L"已请求补帧;无需先开启NR。":L"总增强正在切换,请待当前事务完成。");return accepted;
}
diff --git a/apps/veyra/ui/AppShell.cpp b/apps/veyra/ui/AppShell.cpp
index c72bc0c9..35655fbf 100644
--- a/apps/veyra/ui/AppShell.cpp
+++ b/apps/veyra/ui/AppShell.cpp
@@ -39,6 +39,9 @@
#include "veyra/engine/Subtitles.h"
namespace {
constexpr DWORD ShellStyle=WS_POPUP|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_SYSMENU|WS_CLIPCHILDREN;
+// Daily-mode multiplier combo lists 2X/3X/4X/6X (index 0..3), which maps to
+// kFgMultiplierChoices[1..4]; index-independent so 5X can stay unoffered.
+uint32_t multiplierFromDailyIndex(int index){const int i=index+1;return (index>=0&&i<int(veyra::engine::kFgMultiplierChoiceCount))?veyra::engine::kFgMultiplierChoices[i]:2;}
enum {Open=101,Play,Stop,Save,Nr,Sr,Fg,Seek,Info,Capture,Export,Realtime,Recent,Multiplier,Settings,OriginalHold,CompareToggle,Split,Reference,Fullscreen,ModeSwitch=220,Master,DailyPreset,Volume,Mute,Subtitle,SubtitleLoad,SubtitleSize,ImageOpen,InspectorDrawer,TabEnhance,TabFg,TabPresets,TabExport,JobProgress,Details,Brand,MediaTitle,TimeLabel,EmptyTitle,EmptyHint,ProRailVideo,ProRailCapture,WindowMin,WindowMax,WindowClose,FpsLabel,RemotePlay,TabAudio,VideoSurface=1000};
veyra::engine::EngineController engine;
#ifdef VEYRA_ENABLE_REMOTEPLAY
@@ -291,7 +294,7 @@ control(L"BUTTON",L"DLSS5 NR",Nr,BS_AUTOCHECKBOX,425,10,110,30);control(L"BUTTON
control(L"BUTTON",L"采集",Capture,BS_PUSHBUTTON,690,10,75,30);control(L"BUTTON",L"导出视频",Export,BS_PUSHBUTTON,773,10,103,30);control(L"BUTTON",L"性能/诊断",Info,BS_PUSHBUTTON,884,10,100,30);
control(L"BUTTON",L"实时NR档",Realtime,BS_AUTOCHECKBOX,952,10,100,30);
control(L"BUTTON",L"最近打开",Recent,BS_PUSHBUTTON,1072,10,75,30);
-auto mult=control(L"COMBOBOX",L"",Multiplier,CBS_DROPDOWNLIST,1150,10,70,180);for(auto label:{L"2X",L"3X",L"4X"})SendMessageW(mult,CB_ADDSTRING,0,reinterpret_cast<LPARAM>(label));SendMessageW(mult,CB_SETCURSEL,initialOptions.fgMultiplier-2,0);
+auto mult=control(L"COMBOBOX",L"",Multiplier,CBS_DROPDOWNLIST,1150,10,70,180);for(auto label:{L"2X",L"3X",L"4X",L"6X"})SendMessageW(mult,CB_ADDSTRING,0,reinterpret_cast<LPARAM>(label));{int sel=0;for(size_t i=1;i<veyra::engine::kFgMultiplierChoiceCount;++i)if(veyra::engine::kFgMultiplierChoices[i]==initialOptions.fgMultiplier)sel=int(i)-1;SendMessageW(mult,CB_SETCURSEL,sel,0);}
control(L"BUTTON",L"参数与预设",Settings,BS_PUSHBUTTON,1225,10,100,30);
auto original=control(L"BUTTON",L"按住原图 V",OriginalHold,BS_PUSHBUTTON,0,0,110,30);SetWindowSubclass(original,interaction,OriginalHold,0);
control(L"BUTTON",L"原图/增强切换",CompareToggle,BS_PUSHBUTTON,0,0,120,30);control(L"BUTTON",L"分屏拖动",Split,BS_PUSHBUTTON,0,0,95,30);
@@ -354,7 +357,7 @@ case WM_APP+45:{if(masterPendingRevision)return 0;auto settings=uiState.enhanced
if(wp==213){auto current=engine.snapshot();if(uiState.mode!=veyra::ui::Mode::Professional||!current.running||!current.frames)return 0;bool space=false;for(auto q:settings.protection.regions)space|=q.empty();if(!space)return 0;cancelProtection();protectionArmed=true;SetFocus(video);return 1;}
if(wp==214){cancelProtection();settings.protection={};}else if(wp==206)settings.protection.enabled=lp==BST_CHECKED;else return 0;
return applySettings(settings)?1:0;}
-case WM_APP+44:{if(masterPendingRevision)return 0;auto setting=uiState.enhanced?engine.snapshot().desired:uiState.configured;const bool enabled=wp==202?lp>1:lp==BST_CHECKED;if(wp==200)setting.nr=enabled;else if(wp==201)setting.sr=enabled;else if(wp==202){if(lp<1||lp>4)return 0;setting.multiplier=uint32_t(lp);if(!setting.validate().empty())return 0;}else return 0;
+case WM_APP+44:{if(masterPendingRevision)return 0;auto setting=uiState.enhanced?engine.snapshot().desired:uiState.configured;const bool enabled=wp==202?lp>1:lp==BST_CHECKED;if(wp==200)setting.nr=enabled;else if(wp==201)setting.sr=enabled;else if(wp==202){bool allowed=false;for(auto m:veyra::engine::kFgMultiplierChoices)if(uint32_t(lp)==m)allowed=true;if(!allowed)return 0;setting.multiplier=uint32_t(lp);if(!setting.validate().empty())return 0;}else return 0;
const bool enablesMaster=enabled&&!uiState.enhanced;if(enablesMaster){masterPreviousEnabled=false;uiState.enhanced=true;}applySettings(setting);if(auto pending=engine.snapshot();enablesMaster&&pending.running){masterPendingRevision=pending.desired.revision;masterPendingSession=pending.sessionId;}veyra::log::info("ui-feature",std::format("click={} enabled={} requestedRevision={} draft-independent=true",wp==200?"NR":wp==201?"SR":"FG",enabled,engine.snapshot().desired.revision));return 1;}
case WM_APP+43:showDiagnostics=false;layout();return 0;
case WM_APP+42:refreshDailyPresets();return 0;
@@ -386,8 +389,8 @@ case Multiplier:case Realtime:case Nr:case Fg:{auto changed=engine.snapshot().de
if(id==Nr)changed.nr=IsDlgButtonChecked(hwnd,Nr)==BST_CHECKED;
if(id==Sr)changed.sr=IsDlgButtonChecked(hwnd,Sr)==BST_CHECKED;
if(id==Realtime)changed.nrPolicy=IsDlgButtonChecked(hwnd,Realtime)==BST_CHECKED?veyra::pipeline::NrSizePolicy::Realtime:veyra::pipeline::NrSizePolicy::Native;
-if(id==Fg)changed.multiplier=IsDlgButtonChecked(hwnd,Fg)==BST_CHECKED?uint32_t(SendDlgItemMessageW(hwnd,Multiplier,CB_GETCURSEL,0,0)+2):1;
-if(id==Multiplier&&HIWORD(wp)==CBN_SELCHANGE&&changed.multiplier>1)changed.multiplier=uint32_t(SendDlgItemMessageW(hwnd,Multiplier,CB_GETCURSEL,0,0)+2);
+if(id==Fg)changed.multiplier=IsDlgButtonChecked(hwnd,Fg)==BST_CHECKED?multiplierFromDailyIndex(int(SendDlgItemMessageW(hwnd,Multiplier,CB_GETCURSEL,0,0))):1;
+if(id==Multiplier&&HIWORD(wp)==CBN_SELCHANGE&&changed.multiplier>1)changed.multiplier=multiplierFromDailyIndex(int(SendDlgItemMessageW(hwnd,Multiplier,CB_GETCURSEL,0,0)));
engine.requestSettings(changed);break;}
case Fullscreen:toggleFullscreen();break;
@@ -557,6 +560,10 @@ CoInitializeEx(nullptr,COINIT_APARTMENTTHREADED);
initialOptions=veyra::engine::PlayerOptions::from(veyra::ui::defaultSettings());
int argc=0;auto argv=CommandLineToArgvW(GetCommandLineW(),&argc);for(int i=1;i<argc;++i){const std::wstring arg=argv[i];if(arg==L"--export-worker"&&i+1<argc)workerMapping=reinterpret_cast<HANDLE>(_wcstoui64(argv[++i],nullptr,10));else if(arg==L"--smoke-view"&&i+1<argc)smokeView=argv[++i];else if(arg==L"--smoke-fg-only")smokeFgOnly=true;else if(arg==L"--smoke-transport")smokeTransport=true;else if(arg==L"--smoke-repair-ui")smokeRepair=true;else if(arg==L"--smoke-repair-ui-reject")smokeRepair=smokeRepairReject=true;else if(arg==L"--smoke-hover")smokeZoom=smokeHover=true;else if(arg==L"--smoke-protection")smokeProtection=true;else if(arg==L"--smoke-zoom")smokeZoom=true;else if(arg==L"--smoke-empty")smokeEmpty=true;else if(arg==L"--smoke-dual")smokeDual=true;else if(arg==L"--smoke-dual-pause"){smokeDual=smokeDualPause=true;}else if(arg==L"--smoke-master-reject")smokeMaster=smokeMasterReject=true;else if(arg==L"--smoke-master")smokeMaster=true;else if(arg==L"--smoke-audio")smokeAudio=true;else if(arg==L"--smoke-job-cancel")smokeJobCancel=true;else if(arg==L"--smoke-job-exit")smokeJobExit=true;else if(arg==L"--smoke-job")smokeJob=true;else if(arg==L"--smoke-dual-export"&&i+1<argc)smokeDualOutput=argv[++i];else if(arg==L"--smoke-seconds"&&i+1<argc)smokeSeconds=std::clamp(_wtoi(argv[++i]),1,240);else if(arg==L"--export-out"&&i+1<argc)exportOutput=argv[++i];else if(arg==L"--max-frames"&&i+1<argc)exportFrames=std::max(1,_wtoi(argv[++i]));else if(arg==L"--cancel-after-ms"&&i+1<argc)cancelAfterMs=std::clamp(_wtoi(argv[++i]),1,240000);else if(arg==L"--hevc")exportHevc=true;else if(arg==L"--smoke-rollback-flow"){smokeRollback=true;smokeRollbackFlow=true;}else if(arg==L"--smoke-rollback")smokeRollback=true;else if(arg==L"--smoke-ui")smokeUi=true;else if(arg==L"--no-fg")initialOptions.fg=false;else if(arg==L"--smoke-settings")smokeSettings=true;else if(arg==L"--smoke-screenshot")smokeScreenshot=true;else if(arg==L"--smoke-controls")smokeControls=true;else if(arg==L"--smoke-save"&&i+1<argc)smokeSave=argv[++i];else if(arg==L"--native")initialOptions.realtime=false;else if(arg==L"--realtime")initialOptions.realtime=true;else if(arg==L"--fg")initialOptions.fg=true;else if(arg==L"--fg-multiplier"&&i+1<argc){initialOptions.fgMultiplier=std::clamp(_wtoi(argv[++i]),2,4);initialOptions.fg=true;}else if(arg==L"--video-sr"&&i+1<argc){initialOptions.settings.videoSrQuality=std::clamp(_wtoi(argv[++i]),1,4);initialOptions.sr=true;}else if(arg==L"--nr-ampere")initialOptions.settings.nrRuntime=veyra::engine::NrRuntime::Ampere;else if(arg==L"--nr-community")initialOptions.settings.nrRuntime=veyra::engine::NrRuntime::Community;else if(arg==L"--nr-original")initialOptions.settings.nrRuntime=veyra::engine::NrRuntime::Original;else if(arg==L"--sr")initialOptions.sr=true;else if(arg==L"--no-nr")initialOptions.nr=false;else if(arg==L"--nr")initialOptions.nr=true;else if(arg==L"--no-sr")initialOptions.sr=false;else autoInput=arg;}LocalFree(argv);
+// The legacy argument clamp caps --fg-multiplier at 4X. Re-read the flag here so
+// 6X (and 2X/3X/4X) can be exercised from the command line for diagnostics and
+// smoke tests; the interactive UI uses the capability-driven list instead.
+{int fgArgc=0;auto fgArgv=CommandLineToArgvW(GetCommandLineW(),&fgArgc);for(int i=1;i+1<fgArgc;++i)if(!_wcsicmp(fgArgv[i],L"--fg-multiplier")){const int value=_wtoi(fgArgv[i+1]);if(value>=2&&value<=6){initialOptions.fgMultiplier=uint32_t(value);initialOptions.fg=true;}else if(value==1){initialOptions.fg=false;initialOptions.fgMultiplier=2;}}if(fgArgv)LocalFree(fgArgv);}
if(workerMapping){const int code=veyra::engine::runExportWorker(workerMapping);CoUninitialize();return code;}
if(smokeSeconds<=0&&exportOutput.empty()){uiPreferences=preferences.load();initialOptions=veyra::engine::PlayerOptions::from(preferences.startup(initialOptions.snapshot()));engine.setVolume(uiPreferences.volume,uiPreferences.muted);uiState.subtitles=uiPreferences.subtitles;subtitlePixels=uiPreferences.subtitleSize;}
engine.requestSettings(initialOptions.snapshot());
diff --git a/include/veyra/engine/EngineController.h b/include/veyra/engine/EngineController.h
index 94ddee52..b5b80264 100644
--- a/include/veyra/engine/EngineController.h
+++ b/include/veyra/engine/EngineController.h
@@ -57,6 +57,11 @@ struct PlayerSnapshot {
uint64_t previewSkipped=0;
double playbackSpeed=0;
bool fgBudgetLimited=false,xessGenerationSuppressed=false;
+ // Runtime-reported DLSSG MultiFrameCountMax: 1 = 2X only, 5 = 6X.
+ // 0 = not queried yet (no session). The UI uses this to offer only the
+ // multipliers the active GPU can actually honour.
+ int fgMultiFrameMax=0;
+ bool fgCapabilityKnown=false;
bool running=false,failed=false,image=false,capture=false,remotePlay=false;
int remotePlayState=0; uint64_t remotePlaySkipped=0;
bool remoteRecovering=false;unsigned remoteReconnectAttempts=0;std::wstring remoteRecoveryMessage;
@@ -105,5 +110,7 @@ private:
std::atomic<float> volume_{1};uint64_t sessionId_=0;
std::atomic<double> seekSeconds_{-1};
std::atomic<int> comparisonMode_{0};std::atomic<bool> comparisonBase_{false};std::atomic<float> comparisonSplit_{.5f};
+ // Guarded by mutex_: DLSSG MultiFrameCountMax of the active session.
+ int fgMultiFrameMaxCap_=0;
};
}
diff --git a/include/veyra/engine/EnhancementSettings.h b/include/veyra/engine/EnhancementSettings.h
index d6853ce7..3a3f5fed 100644
--- a/include/veyra/engine/EnhancementSettings.h
+++ b/include/veyra/engine/EnhancementSettings.h
@@ -7,6 +7,10 @@
#include "veyra/pipeline/ResolutionPlan.h"
namespace veyra::engine {
enum class FrameGenerationBackend { Dlss, XeSS };
+// Multipliers the UI offers. 5X is intentionally absent: the DLSS runtime
+// exposes 2/3/4/6 and MFG buyers pick from those; 1 = generation off.
+inline constexpr uint32_t kFgMultiplierChoices[]={1,2,3,4,6};
+inline constexpr size_t kFgMultiplierChoiceCount=sizeof(kFgMultiplierChoices)/sizeof(kFgMultiplierChoices[0]);
enum class NrRuntime { Original, Community, Ampere };
constexpr std::string_view nrRuntimeName(NrRuntime runtime) {
switch(runtime) {
@@ -114,7 +118,7 @@ struct EnhancementSettings {
if(videoSrQuality>4)return "invalid video SR quality";
if(!pipeline::validSrTarget(srTarget))return "invalid SR target";
if(opticalFlowBackend!=OpticalFlowBackend::Nvidia&&opticalFlowBackend!=OpticalFlowBackend::AmdFidelityFx&&opticalFlowBackend!=OpticalFlowBackend::GpuDis)return "invalid optical flow backend";
- if(multiplier<1||multiplier>4)return "unsupported multiplier";
+ if(multiplier<1||multiplier>6)return "unsupported multiplier";
if(!pipeline::validNrSizePolicy(nrPolicy))return "invalid NR size policy";
if(flow<FlowQuality::Performance||flow>FlowQuality::Quality||content<ContentRate::Transport||content>ContentRate::Capture60To30)return "invalid flow/content mode";
return {};
diff --git a/include/veyra/ngx/DlssFgBackend.h b/include/veyra/ngx/DlssFgBackend.h
index 61a6df37..a2f211ee 100644
--- a/include/veyra/ngx/DlssFgBackend.h
+++ b/include/veyra/ngx/DlssFgBackend.h
@@ -1,8 +1,12 @@
#pragma once
-// DLSS Frame Generation (DLSSG 2X) backend using the official NGX SDK 310.7
-// DLSSG helpers (Playbook section 14). V1 requests 2X only: one generated
-// frame per real-frame pair (MultiFrameCount = MultiFrameIndex = 1).
+// DLSS Frame Generation backend using the official NGX SDK 310.7 DLSSG helpers
+// (Playbook section 14). Multi-frame generation passes MultiFrameCount =
+// multiplier-1 and MultiFrameIndex = 1..count, so the backend supports 2X
+// through 6X (up to five generated frames per real-frame pair). The caller
+// must still validate the requested multiplier against the runtime's
+// MultiFrameCountMax capability before creating the feature; Blackwell
+// reports 5 (6X), Ada reports 1 (2X) unless the runtime gate is unlocked.
//
// Capability contract (Playbook 14.2): before Create, the caller must have
// queried FrameGeneration.Available and logged GPU/driver/HAGS/runtime
diff --git a/include/veyra/pipeline/EnhanceGraph.h b/include/veyra/pipeline/EnhanceGraph.h
index ea0399c3..55b6fd9a 100644
--- a/include/veyra/pipeline/EnhanceGraph.h
+++ b/include/veyra/pipeline/EnhanceGraph.h
@@ -54,6 +54,10 @@ class NvOfSession;
namespace veyra::pipeline {
struct ColorDescription;
+// One generated-frame texture per (parity, subframe): 2 parities x 5 generated
+// frames = 6X multi-frame generation. Sized once, reused for every FG backend.
+inline constexpr unsigned kGeneratedPoolSlots=10;
+
struct EnhanceGraphDesc {
uint32_t sourceWidth = 0;
uint32_t sourceHeight = 0;
@@ -142,7 +146,7 @@ public:
bool nextFrameSlotAvailable()const {
const unsigned slot=unsigned(realFrameIndex_%2);
if(!realLeases_[slot].expired())return false;
- for(unsigned i=slot;i<6;i+=2)if(!generatedLeases_[i].expired())return false;
+ for(unsigned i=slot;i<kGeneratedPoolSlots;i+=2)if(!generatedLeases_[i].expired())return false;
return true;
}
// Nonblocking. The scheduler polls at a GPU-ready/deadline boundary; no
@@ -278,8 +282,8 @@ private:
ComPtr<ID3D12Resource> confTex_;
ComPtr<ID3D12Resource> flowTex_;
ComPtr<ID3D12Resource> depthTex_;
- ComPtr<ID3D12Resource> genFrame_[6];
- ComPtr<ID3D12Resource> fgDisable_[6],fgDisableReadback_[6],fgDisableInit_;
+ ComPtr<ID3D12Resource> genFrame_[kGeneratedPoolSlots];
+ ComPtr<ID3D12Resource> fgDisable_[kGeneratedPoolSlots],fgDisableReadback_[kGeneratedPoolSlots],fgDisableInit_;
ComPtr<ID3D12Resource> nrZeroMotion_;
ComPtr<ID3D12Resource> nrZeroDepth_;
ComPtr<ID3D12Resource> nvofRawTex_;
@@ -322,7 +326,7 @@ private:
// Per-run state.
uint64_t realFrameIndex_ = 0;
uint64_t epoch_ = 0;
- std::weak_ptr<FrameLease> realLeases_[2],generatedLeases_[6];
+ std::weak_ptr<FrameLease> realLeases_[2],generatedLeases_[kGeneratedPoolSlots];
uint32_t nextListSlot_ = 0;
uint64_t uploadFences_[2] = {};
// FFmpeg may recycle a hardware surface as soon as its AVFrame is freed.
diff --git a/include/veyra/pipeline/FrameBatch.h b/include/veyra/pipeline/FrameBatch.h
index 09c221e0..c441e1d5 100644
--- a/include/veyra/pipeline/FrameBatch.h
+++ b/include/veyra/pipeline/FrameBatch.h
@@ -32,11 +32,13 @@ struct FrameBatch {
uint64_t batchId=0;
FrameIdentity identity;
int64_t a100ns=0,b100ns=0;
- std::array<BatchFrame,4> frames{};
+ // 6X multi-frame generation needs one real frame plus up to five generated
+ // frames in a single batch.
+ std::array<BatchFrame,6> frames{};
uint32_t count=0;
static int64_t interpolate(int64_t a,int64_t b,uint32_t j,uint32_t n) {
// The application accepts at most one second between continuous endpoints.
- if(n<2||n>4||j==0||j>=n||b<=a||a>INT64_MAX-10000000||b>a+10000000)
+ if(n<2||n>6||j==0||j>=n||b<=a||a>INT64_MAX-10000000||b>a+10000000)
throw std::invalid_argument("invalid interpolation interval");
const int64_t d=b-a;return a+(d/n)*j+((d%n)*j+n/2)/n;
}
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index ad1ce2ab..42789d01 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -61,7 +61,7 @@ bool EngineController::idle()const{std::lock_guard lock(mutex_);return !busy_&&!
void EngineController::open(HWND video,const std::wstring& path,PlayerOptions opts){
const bool captureReplay=opts.captureReplayForTest;
const bool disableAdmission=opts.captureReplayDisableFgAdmissionForTest;
- {std::lock_guard lock(mutex_);snapshot_={};activeFlow_.reset();previewView_={};snapshot_.sessionId=++sessionId_;snapshot_.transport=TransportState::Opening;savePath_.clear();desired_=opts.snapshot();desired_.revision=++nextRevision_;snapshot_.desired=desired_;opts=PlayerOptions::from(desired_);}
+ {std::lock_guard lock(mutex_);snapshot_={};activeFlow_.reset();previewView_={};fgMultiFrameMaxCap_=0;snapshot_.sessionId=++sessionId_;snapshot_.transport=TransportState::Opening;savePath_.clear();desired_=opts.snapshot();desired_.revision=++nextRevision_;snapshot_.desired=desired_;opts=PlayerOptions::from(desired_);}
opts.captureReplayForTest=captureReplay;
opts.captureReplayDisableFgAdmissionForTest=disableAdmission;
post([this,video,path,opts]{paused_=false;seekSeconds_=-1;run(video,path,opts);});
@@ -69,7 +69,7 @@ void EngineController::open(HWND video,const std::wstring& path,PlayerOptions op
#ifdef VEYRA_ENABLE_REMOTEPLAY
void EngineController::openRemotePlay(HWND window,source::RemotePlayConnectDesc desc,PlayerOptions opts){
auto request=std::make_shared<source::RemotePlayConnectDesc>(std::move(desc));
- {std::lock_guard lock(mutex_);snapshot_={};activeFlow_.reset();previewView_={};snapshot_.sessionId=++sessionId_;snapshot_.transport=TransportState::Opening;snapshot_.remotePlay=true;snapshot_.capture=true;savePath_.clear();desired_=opts.snapshot();desired_.revision=++nextRevision_;snapshot_.desired=desired_;opts=PlayerOptions::from(desired_);}
+ {std::lock_guard lock(mutex_);snapshot_={};activeFlow_.reset();previewView_={};fgMultiFrameMaxCap_=0;snapshot_.sessionId=++sessionId_;snapshot_.transport=TransportState::Opening;snapshot_.remotePlay=true;snapshot_.capture=true;savePath_.clear();desired_=opts.snapshot();desired_.revision=++nextRevision_;snapshot_.desired=desired_;opts=PlayerOptions::from(desired_);}
post([this,window,request,opts]{paused_=false;seekSeconds_=-1;run(window,L"remoteplay:",opts,request);});
}
remoteplay::ControllerFeedback EngineController::remotePlayFeedback(){std::lock_guard lock(mutex_);return activeRemote_?activeRemote_->takeFeedback():remoteplay::ControllerFeedback{};}
@@ -82,6 +82,16 @@ void EngineController::setVolume(float gain,bool mute){if(!std::isfinite(gain))r
bool EngineController::requestSettings(EnhancementSettings s){
if(!s.validate().empty()){veyra::log::warn("settings","invalid whole settings transaction rejected");status(L"整套设置无效,未应用任何字段",false);return false;}
std::lock_guard lock(mutex_);if(snapshot_.image)s.multiplier=1;
+ // Capability gate: refuse a multiplier the active GPU/runtime cannot honour
+ // instead of letting the graph fail and silently turning frame generation
+ // off. The previous value is preserved and the reason is surfaced.
+ if(s.multiplier>1&&s.frameGenerationBackend==FrameGenerationBackend::Dlss&&fgMultiFrameMaxCap_>0&&
+ int(s.multiplier)-1>fgMultiFrameMaxCap_){
+ snapshot_.status=std::format(L"此显卡最多支持 {}X 帧生成;请求未应用",fgMultiFrameMaxCap_+1);
+ snapshot_.failed=false;
+ veyra::log::info("settings",std::format("multiplier gate: requested={} maxGeneratedFrames={} applied=unchanged",s.multiplier,fgMultiFrameMaxCap_));
+ return false;
+ }
// Revision partitions GPU history and measurements. Audio-only edits must
// not invalidate in-flight video, and identical notifications are no-ops.
s.revision=desired_.revision;if(s==desired_)return true;
@@ -241,9 +251,24 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
failure=FailedBackend::Infrastructure;
if(opened&&graph.xessEnabled()&&!presenter.xessActive()){opened=false;failure=FailedBackend::Fg;}
}
- if(opened)return true;
- auto reduced=selected.snapshot();
- if(FAILED(ctx.device()->GetDeviceRemovedReason())||!disableFailedBackend(reduced,failure))return false;
+ if(opened)return true;
+ auto reduced=selected.snapshot();
+ // Requested multiplier above this GPU's capability: clamp to what
+ // the runtime supports and say so, instead of dropping frame
+ // generation entirely (the old behaviour users saw as "选了 4X
+ // 之后补帧直接没了").
+ bool clampedOverCapability=false;
+ if(failure==FailedBackend::Fg&&reduced.multiplier>1&&graph.fgMultiFrameCountMax()>0&&
+ int(reduced.multiplier)-1>graph.fgMultiFrameCountMax()){
+ const uint32_t clamped=uint32_t(graph.fgMultiFrameCountMax()+1);
+ veyra::log::warn("backend-recovery",std::format("requested multiplier {} exceeds GPU capability maxGeneratedFrames={}; applying {}X with frame generation kept",reduced.multiplier,graph.fgMultiFrameCountMax(),clamped));
+ reduced.multiplier=clamped;
+ clampedOverCapability=true;
+ if(!backendRecoveryWarning.empty())backendRecoveryWarning+=L";";
+ backendRecoveryWarning+=std::format(L"此显卡最多支持 {}X 帧生成,已按 {}X 应用",clamped,clamped);
+ }
+ if(FAILED(ctx.device()->GetDeviceRemovedReason()))return false;
+ if(!clampedOverCapability&&!disableFailedBackend(reduced,failure))return false;
veyra::log::warn("backend-recovery",std::format("initialization failed component={} attempt={} revision={} -> nr={} sr={} multiplier={}; original SDK error above",unsigned(failure),attempt+1,reduced.revision,reduced.nr,reduced.sr,reduced.multiplier));
if(!backendRecoveryWarning.empty())backendRecoveryWarning+=L";";
backendRecoveryWarning+=std::wstring(backendFailureName(failure))+L"初始化失败,已关闭依赖效果(错误码见日志)";
@@ -257,7 +282,19 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
return false;
};
const auto initialRequested=options.snapshot();
- if(!initializePreview(gd,options)){status(L"视频初始化失败,请查看对应组件的诊断日志",true);break;}
+ const bool previewInitialized=initializePreview(gd,options);
+ {
+ // Publish the runtime's multi-frame capability so the UI can
+ // offer only what this GPU can honour (Ada=2X, Blackwell=6X).
+ // Published on failure too: a rejected multiplier must still
+ // teach the settings UI what the ceiling is.
+ std::lock_guard lock(mutex_);
+ fgMultiFrameMaxCap_=graph.fgMultiFrameCountMax();
+ snapshot_.fgMultiFrameMax=fgMultiFrameMaxCap_;
+ snapshot_.fgCapabilityKnown=fgMultiFrameMaxCap_>0;
+ if(fgMultiFrameMaxCap_>0)veyra::log::info("settings",std::format("frame-generation capability: maxGeneratedFrames={} maxMultiplier={}",fgMultiFrameMaxCap_,fgMultiFrameMaxCap_+1));
+ }
+ if(!previewInitialized){status(L"视频初始化失败,请查看对应组件的诊断日志",true);break;}
if(!backendRecoveryWarning.empty()){
std::lock_guard lock(mutex_);desired_.rejectVideoRequest(initialRequested,options.snapshot());snapshot_.desired=desired_;snapshot_.backendWarning=backendRecoveryWarning;
}
diff --git a/src/engine/VideoPresenter.cpp b/src/engine/VideoPresenter.cpp
index b3c7990a..c8dedc58 100644
--- a/src/engine/VideoPresenter.cpp
+++ b/src/engine/VideoPresenter.cpp
@@ -10,12 +10,14 @@ bool VideoPresenter::open(gfx::D3D12DeviceContext& ctx,HWND window,pipeline::Enh
d.hdr=graph.hdrOutput();d.hdr10=graph.hdr10Output();d.xess=graph.xessEnabled();d.captureCompatible=captureCompatible;lastXessFrame_={};lastXessIdentity_={};xessWasEnabled_=false;
Status st=Status::Ok;if(!sink_.initialize(ctx.device(),ctx.directQueue(),d,st))return false;
std::vector<uint8_t> vs,ps;
- if(!pipeline::loadShaderBytes("PresentBlit_vs.dxil",vs)||!pipeline::loadShaderBytes("PresentBlit_ps.dxil",ps)||!pass_.create(ctx.device(),vs,ps,12,graph.outputFormat()))return false;
+ // SRV layout: 0..1 video frames, 2..11 generated frames (2 parities x 5
+ // subframes, 6X), 12..15 comparison references.
+ if(!pipeline::loadShaderBytes("PresentBlit_vs.dxil",vs)||!pipeline::loadShaderBytes("PresentBlit_ps.dxil",ps)||!pass_.create(ctx.device(),vs,ps,16,graph.outputFormat()))return false;
D3D12_DESCRIPTOR_HEAP_DESC hd{};hd.Type=D3D12_DESCRIPTOR_HEAP_TYPE_RTV;hd.NumDescriptors=3;
if(FAILED(ctx.device()->CreateDescriptorHeap(&hd,IID_PPV_ARGS(&rtvs_))))return false;
inc_=ctx.device()->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);refresh(ctx.device());
- for(unsigned i=0;i<8;++i)pipeline::makeSrv(ctx.device(),i<2?graph.videoFrameResource(i):graph.generatedFrameResource(i-2),graph.outputFormat(),{pass_.heap->GetCPUDescriptorHandleForHeapStart().ptr+size_t(i)*pass_.increment});
- for(unsigned i=0;i<4;++i)pipeline::makeSrv(ctx.device(),i<2?graph.sourceReference(i):graph.baseReference(i-2),DXGI_FORMAT_R16G16B16A16_FLOAT,{pass_.heap->GetCPUDescriptorHandleForHeapStart().ptr+size_t(i+8)*pass_.increment});
+ for(unsigned i=0;i<12;++i)pipeline::makeSrv(ctx.device(),i<2?graph.videoFrameResource(i):graph.generatedFrameResource(i-2),graph.outputFormat(),{pass_.heap->GetCPUDescriptorHandleForHeapStart().ptr+size_t(i)*pass_.increment});
+ for(unsigned i=0;i<4;++i)pipeline::makeSrv(ctx.device(),i<2?graph.sourceReference(i):graph.baseReference(i-2),DXGI_FORMAT_R16G16B16A16_FLOAT,{pass_.heap->GetCPUDescriptorHandleForHeapStart().ptr+size_t(i+12)*pass_.increment});
return true;
}
void VideoPresenter::refresh(ID3D12Device* device){for(unsigned i=0;i<3;++i){Microsoft::WRL::ComPtr<ID3D12Resource> bb;if(SUCCEEDED(sink_.swapChain()->GetBuffer(i,IID_PPV_ARGS(&bb))))device->CreateRenderTargetView(bb.Get(),nullptr,{rtvs_->GetCPUDescriptorHandleForHeapStart().ptr+size_t(i)*inc_});}}
@@ -55,7 +57,7 @@ bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing&
if(comparison&&!generated&&referencesValid){
auto* reference=baseReference?graph.baseReference(slot):graph.sourceReference(slot);
D3D12_RESOURCE_BARRIER b{};b.Type=D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;b.Transition.pResource=reference;b.Transition.Subresource=D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;b.Transition.StateBefore=D3D12_RESOURCE_STATE_COMMON;b.Transition.StateAfter=D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE;list->ResourceBarrier(1,&b);
- dims[2]=samplingFlags+(graph.hdr10Output()?4:graph.hdrOutput()?0:1);list->SetGraphicsRoot32BitConstants(0,8,dims,0);list->SetGraphicsRootDescriptorTable(1,{pass_.heap->GetGPUDescriptorHandleForHeapStart().ptr+size_t(8+slot+(baseReference?2:0))*pass_.increment});
+ dims[2]=samplingFlags+(graph.hdr10Output()?4:graph.hdrOutput()?0:1);list->SetGraphicsRoot32BitConstants(0,8,dims,0);list->SetGraphicsRootDescriptorTable(1,{pass_.heap->GetGPUDescriptorHandleForHeapStart().ptr+size_t(12+slot+(baseReference?2:0))*pass_.increment});
if(comparison==2)rect.right=LONG(std::clamp((rc.right*.5f+(std::clamp(split,0.0f,1.0f)-view.centerX)*graph.workWidth()*scale*view.zoom)*sink_.bufferWidth()/rc.right,0.0f,float(sink_.bufferWidth())));list->RSSetScissorRects(1,&rect);list->DrawInstanced(3,1,0,0);
std::swap(b.Transition.StateBefore,b.Transition.StateAfter);list->ResourceBarrier(1,&b);
if(veyra::log::verboseFrameLogs())veyra::log::info("comparison",std::format("real-frame source={} epoch={} revision={} reference={} mode={} split={} (same leased frame)",identity.sourceFrameId,identity.epoch,identity.settingsRevision,baseReference?"base":"input",comparison,split));
diff --git a/src/ngx/DlssFgBackend.cpp b/src/ngx/DlssFgBackend.cpp
index f48281a5..02ba9b08 100644
--- a/src/ngx/DlssFgBackend.cpp
+++ b/src/ngx/DlssFgBackend.cpp
@@ -224,7 +224,10 @@ bool DlssFgBackend::evaluate(ID3D12GraphicsCommandList* cmdList,
const EvalDesc& desc,
Status& status)
{
- if (handle_ == nullptr || desc.multiFrameCount<1 || desc.multiFrameCount>3 || desc.multiFrameIndex<1 || desc.multiFrameIndex>desc.multiFrameCount) {
+ // Up to five generated frames (6X). The graph validates the requested
+ // multiplier against the runtime's MultiFrameCountMax before creating the
+ // feature; this is only the absolute API-level guard.
+ if (handle_ == nullptr || desc.multiFrameCount<1 || desc.multiFrameCount>5 || desc.multiFrameIndex<1 || desc.multiFrameIndex>desc.multiFrameCount) {
status = Status::InvalidArgument;
return false;
}
diff --git a/src/pipeline/EnhanceGraph.cpp b/src/pipeline/EnhanceGraph.cpp
index 83ee9999..b12e615f 100644
--- a/src/pipeline/EnhanceGraph.cpp
+++ b/src/pipeline/EnhanceGraph.cpp
@@ -139,7 +139,7 @@ bool EnhanceGraph::createResources()
if(!fgDisableInit_)return false;
void* initial=nullptr;if(FAILED(fgDisableInit_->Map(0,nullptr,&initial)))return false;
*static_cast<uint32_t*>(initial)=1;fgDisableInit_->Unmap(0,nullptr);
- for(unsigned i=0;i<6;++i){
+ for(unsigned i=0;i<kGeneratedPoolSlots;++i){
D3D12_RESOURCE_DESC bd{};bd.Dimension=D3D12_RESOURCE_DIMENSION_BUFFER;bd.Width=4;bd.Height=1;bd.DepthOrArraySize=1;bd.MipLevels=1;bd.SampleDesc.Count=1;bd.Layout=D3D12_TEXTURE_LAYOUT_ROW_MAJOR;bd.Flags=D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
D3D12_HEAP_PROPERTIES hp{};hp.Type=D3D12_HEAP_TYPE_DEFAULT;
HRESULT hr=context_.device()->CreateCommittedResource(&hp,D3D12_HEAP_FLAG_NONE,&bd,D3D12_RESOURCE_STATE_COMMON,nullptr,IID_PPV_ARGS(&fgDisable_[i]));
@@ -392,11 +392,26 @@ bool EnhanceGraph::initNgxFeatures()
veyra::log::error("graph", "FG unavailable; fail closed");
return false;
}
- if(desc_.enableFg&&(desc_.fgMultiplier<2||desc_.fgMultiplier>4||fgCaps.multiFrameCountMax<desc_.fgMultiplier-1)){veyra::log::error("graph","requested MFG multiplier unsupported");return false;}
- fgCapsAvailable_ = fgCaps.available;
- fgMultiFrameMax_ = fgCaps.multiFrameCountMax;
- veyra::log::info("graph", std::format("FG capability available={} multiFrameMax={}",
- fgCaps.available, fgCaps.multiFrameCountMax));
+ // Publish the capability before validating the request so a rejected
+ // multiplier still teaches the caller what this GPU supports.
+ fgCapsAvailable_ = fgCaps.available;
+ fgMultiFrameMax_ = fgCaps.multiFrameCountMax;
+ // Test-only capability override: lets the Ada (40-series) ceiling and the
+ // capability-driven UI/recovery paths be exercised on a 50-series host
+ // without touching the runtime. Never set by the product UI.
+ {
+ wchar_t overrideText[16]{};
+ if(GetEnvironmentVariableW(L"VEYRA_TEST_FG_MULTIFRAME_MAX",overrideText,16)>0){
+ const int forced=_wtoi(overrideText);
+ if(forced>=0&&forced<=5){
+ fgMultiFrameMax_=forced;fgCaps.multiFrameCountMax=uint32_t(forced);
+ veyra::log::warn("capability",std::format("test-only FG MultiFrameCountMax override={}",forced));
+ }
+ }
+ }
+ veyra::log::info("graph", std::format("FG capability available={} multiFrameMax={}",
+ fgCaps.available, fgCaps.multiFrameCountMax));
+ if(desc_.enableFg&&(desc_.fgMultiplier<2||desc_.fgMultiplier>6||fgCaps.multiFrameCountMax<desc_.fgMultiplier-1)){veyra::log::error("graph",std::format("requested MFG multiplier unsupported request={} maxGeneratedFrames={}",desc_.fgMultiplier,fgCaps.multiFrameCountMax));return false;}
}
if(nrEnabled_){
@@ -741,7 +756,7 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
if(!realLeases_[parity].expired()||!generatedLeases_[parity].expired()){
veyra::log::error("frame-pool",std::format("slot={} still leased; refusing overwrite, batch={}",parity,realFrameIndex_+1));return false;
}
- for(unsigned i=parity;i<6;i+=2)if(!generatedLeases_[i].expired()){veyra::log::error("frame-pool","generated subframe still leased; refusing overwrite");return false;}
+ for(unsigned i=parity;i<kGeneratedPoolSlots;i+=2)if(!generatedLeases_[i].expired()){veyra::log::error("frame-pool","generated subframe still leased; refusing overwrite");return false;}
if (graphOff) {
prevPtsMs_ = ptsMs;
prevValid_ = true;
@@ -1381,7 +1396,7 @@ ID3D12Resource* EnhanceGraph::videoFrameResource(uint32_t slot) const
ID3D12Resource* EnhanceGraph::generatedFrameResource(uint32_t slot) const
{
- return slot < 6 ? genFrame_[slot].Get() : nullptr;
+ return slot < kGeneratedPoolSlots ? genFrame_[slot].Get() : nullptr;
}
// ---------------------------------------------------------------------------
@@ -1442,7 +1457,7 @@ void EnhanceGraph::shutdown()
for(unsigned i=0;i<2;++i){if(upRgb_[i]&&mappedRgb_[i])upRgb_[i]->Unmap(0,nullptr);mappedRgb_[i]=nullptr;upRgb_[i].Reset();}
downsamplePass_={};residualPass_={};flowAdaptPass_={};
nrInput_.Reset();residualRgba_.Reset();nrFlow_.Reset();baseFlow_.Reset();
- for(unsigned i=0;i<6;++i){fgDisable_[i].Reset();fgDisableReadback_[i].Reset();generatedLeases_[i].reset();genFrame_[i].Reset();}for(auto& lease:realLeases_)lease.reset();fgDisableInit_.Reset();
+ for(unsigned i=0;i<kGeneratedPoolSlots;++i){fgDisable_[i].Reset();fgDisableReadback_[i].Reset();generatedLeases_[i].reset();genFrame_[i].Reset();}for(auto& lease:realLeases_)lease.reset();fgDisableInit_.Reset();
encPass_ = ComputePass{};
blitPass_ = ComputePass{};hdrVideoSrPass_={};
yuvPass_ = ComputePass{};
diff --git a/tests/unit/RepairContractTests.cpp b/tests/unit/RepairContractTests.cpp
index 165b704f..718b14d0 100644
--- a/tests/unit/RepairContractTests.cpp
+++ b/tests/unit/RepairContractTests.cpp
@@ -177,7 +177,9 @@ int main(){
check(engine::frameGenerationBackendName(engine::FrameGenerationBackend::Dlss)=="DLSS"&&engine::frameGenerationBackendName(engine::FrameGenerationBackend::XeSS)=="XeSS","frame-generation backend names identify every backend");
check(engine::opticalFlowBackendName(engine::OpticalFlowBackend::Nvidia)=="NVIDIA_NVOF"&&engine::opticalFlowBackendName(engine::OpticalFlowBackend::AmdFidelityFx)=="AMD_FIDELITYFX_OF","optical-flow backend names identify every backend");
s.model.intensity=std::numeric_limits<float>::quiet_NaN();check(!s.validate().empty(),"reject NaN transaction");
- s={};s.multiplier=5;check(!s.validate().empty(),"reject unsupported multiplier");
+ s={};s.multiplier=5;check(s.validate().empty(),"5X multiplier accepted by the API guard (6X ceiling)");
+ s={};s.multiplier=6;check(s.validate().empty(),"6X multiplier accepted");
+ s={};s.multiplier=7;check(!s.validate().empty(),"reject multiplier above the 6X ceiling");
check(pipeline::FrameBatch::interpolate(-200000,0,1,2)==-100000,"negative PTS midpoint");
check(pipeline::FrameBatch::interpolate(0,200000,1,3)==66667&&pipeline::FrameBatch::interpolate(0,200000,2,3)==133333,"rational 3X PTS within tick");
pipeline::FrameBatch b;b.identity={1,2,3};pipeline::BatchFrame f;f.identity=b.identity;f.pts100ns=1;b.append(f);f.identity.settingsRevision=3;