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++
perf(3b): add optional bounded Auto NR with truthful fallback and UI
Veyra Goal Agente8f0bd108229
diff --git a/docs/PERF_3B_AUTO_NR_2026-10-05.md b/docs/PERF_3B_AUTO_NR_2026-10-05.mdindex 9ef37c00..703d5c24 100644--- a/docs/PERF_3B_AUTO_NR_2026-10-05.md+++ b/docs/PERF_3B_AUTO_NR_2026-10-05.md@@ -52,3 +52,9 @@ E1 已证明最大实例动态子区域与按实际尺寸创建的 NR 不等价候选值得作为明确可选档继续接入,默认不选。不能将一层缩小的收益称为NR内核优化。显存额外约1697MiB、池创建约半秒仍是代价;准入保持本机已测RTX5070/Original/1080p SDR文件、列表第一层、1/2层无SR/FG/时域/NrHold及NVIDIA光流,其他配置保留1080p并显示未激活原因。接口、持久化、灰态、切换画质和导出边界仍待产品回归。原始证据:`E:/项目/Veyra/logs/perf-nr-20261004/B3b-normal-v1-summary/{artifacts,completed,summary}.json`及12组`player.log`/`result.json`/`meters.json`;两组pilot单独保留,不并入三轮统计。++## 产品候选接点(尚待最终验收)++追加policy ID6(旧0–5不变),初始与不准入回退都用固定1080p上限,导出/图片仍按原生;只在EngineController普通文件预览准入时申请池。预热拒绝Auto,最近实例缓存不保留池,避免误接收未预建的图或闲置持有额外1.7GB。池拒绝后排空/释放再以原NR参数重建固定档,不把NR一起禁用,状态如实显示未激活。++实际档位/尺寸发布到快照、性能详情和共享NR编辑器;菜单保留Auto及灰态原因,脚本入口也校验准入,默认不选。恢复/参数事务时控制器从图的当前档位同步,避免已有70%实例被错误重置为100%控制状态。新文字三种翻译齐全(1960条,missing0)。还须真实菜单/持久化/暂停倍速与seek/条件失效/API拒绝/导出画面回归,不能用候选接点代替完成。diff --git a/i18n/catalog.json b/i18n/catalog.jsonindex 01923622..26449e67 100644--- a/i18n/catalog.json+++ b/i18n/catalog.json@@ -1036,6 +1036,13 @@"en": "NR layer 4","ja": "NR 第 4 層"},+ {+ "zh": "NR 自动 %1% · %2×%3",+ "src": "src/ui/QmlPlayerBridge.cpp",+ "zh-TW": "NR 自動 %1% · %2×%3",+ "en": "Auto NR %1% · %2×%3",+ "ja": "NR 自動 %1% · %2×%3"+ },{"zh": "NR 运动来源","src": "qml/NrLayerEditor.qml",@@ -6140,6 +6147,20 @@"en": "The hardware or package does not support this effect; check Components","ja": "選択した効果は現在の GPU またはパッケージに対応していません。コンポーネントを確認してください"},+ {+ "zh": "当前配置未启用自动 NR,保留固定 1080p 档",+ "src": "src/ui/QmlPlayerBridge.cpp",+ "zh-TW": "目前設定未啟用自動 NR,保留固定 1080p 檔",+ "en": "Auto NR is inactive for this configuration; keeping the fixed 1080p policy",+ "ja": "現在の設定では自動 NR は無効です。固定 1080p 設定を維持します"+ },+ {+ "zh": "当前配置未启用自动NR,保留1080p NR",+ "src": "src/engine/EngineController.cpp",+ "zh-TW": "目前設定未啟用自動 NR,保留 1080p NR",+ "en": "Auto NR is inactive for this configuration; keeping 1080p NR",+ "ja": "現在の設定では自動 NR は無効です。1080p NR を維持します"+ },{"zh": "当前非 NVIDIA 适配器:NR、NVIDIA 超分与 DLSS 已禁用;可使用 XeSS 预览和 AMD 光流","src": "src/engine/EngineController.cpp",@@ -9774,6 +9795,27 @@"en": "Auto = follow the Windows display scale","ja": "自動 = Windows の表示スケールに合わせる"},+ {+ "zh": "自动 NR 仅支持一至两层列表的第一层",+ "src": "src/ui/QmlPlayerBridge.cpp",+ "zh-TW": "自動 NR 僅支援一至兩層列表的第一層",+ "en": "Auto NR supports the first layer of a one- or two-layer list",+ "ja": "自動 NR は 1~2 層のリストの最初の層に対応します"+ },+ {+ "zh": "自动 NR 实例池不可用,保留固定 1080p 档",+ "src": "src/ui/QmlPlayerBridge.cpp",+ "zh-TW": "自動 NR 執行個體池無法使用,保留固定 1080p 檔",+ "en": "Auto NR instance pool unavailable; keeping the fixed 1080p policy",+ "ja": "自動 NR のインスタンスプールを使用できません。固定 1080p 設定を維持します"+ },+ {+ "zh": "自动 NR 当前仅验证 RTX 5070",+ "src": "src/ui/QmlPlayerBridge.cpp",+ "zh-TW": "自動 NR 目前僅驗證 RTX 5070",+ "en": "Auto NR is currently verified only on RTX 5070",+ "ja": "自動 NR は現在 RTX 5070 のみで検証済みです"+ },{"zh": "自动 · 恒定质量","src": "include/veyra/engine/EnhancementSettings.h",@@ -9781,6 +9823,27 @@"en": "Auto · constant quality","ja": "自動 · 固定品質"},+ {+ "zh": "自动NR切档失败",+ "src": "src/engine/EngineController.cpp",+ "zh-TW": "自動 NR 切換檔位失敗",+ "en": "Auto NR level switch failed",+ "ja": "自動 NR のレベル切り替えに失敗しました"+ },+ {+ "zh": "自动NR切档排空失败",+ "src": "src/engine/EngineController.cpp",+ "zh-TW": "自動 NR 切換前排空失敗",+ "en": "Failed to drain pending work for an Auto NR switch",+ "ja": "自動 NR 切り替え前の処理完了待機に失敗しました"+ },+ {+ "zh": "自动NR实例池不可用,保留1080p NR",+ "src": "src/engine/EngineController.cpp",+ "zh-TW": "自動 NR 執行個體池無法使用,保留 1080p NR",+ "en": "Auto NR instance pool unavailable; keeping 1080p NR",+ "ja": "自動 NR のインスタンスプールを使用できません。1080p NR を維持します"+ },{"zh": "自动估算","src": "qml/DialogHost.qml",@@ -9823,6 +9886,13 @@"en": "Capture keyboard and mouse automatically","ja": "キーボードとマウスを自動でキャプチャー"},+ {+ "zh": "自动档在预览中按增强耗时调整 100%–40%;预建实例约增加 1.7GB 显存及半秒启动时间。导出按原生尺寸处理。",+ "src": "qml/NrLayerEditor.qml",+ "zh-TW": "自動檔在預覽中依增強耗時調整 100%–40%;預建執行個體約增加 1.7GB 顯示記憶體及半秒啟動時間。匯出依原生尺寸處理。",+ "en": "Auto adjusts preview processing from 100% to 40% using enhancement time. Prebuilt instances add about 1.7GB of VRAM and half a second of startup time. Export uses native dimensions.",+ "ja": "自動設定は強化処理時間に応じてプレビューを 100%~40% に調整します。事前生成したインスタンスは約 1.7GB の VRAM と約 0.5 秒の起動時間を追加します。書き出しは元の解像度で処理します。"+ },{"zh": "自动识别内容节奏","src": "qml/NodePage.qml",@@ -9858,6 +9928,13 @@"en": "Auto (by resolution)","ja": "自動(解像度に応じて)"},+ {+ "zh": "自动(按负载)",+ "src": "qml/NrLayerEditor.qml",+ "zh-TW": "自動(依負載)",+ "en": "Auto (by load)",+ "ja": "自動(負荷に応じて)"+ },{"zh": "自动(独立显卡)","src": "src/ui/QmlPlayerBridge.cpp",@@ -12427,6 +12504,13 @@"en": "Zero motion limits temporal reconstruction; RTX Video Super Resolution does not use this input","ja": "ゼロモーションは時間方向の再構成を制限します。RTX ビデオ超解像はこの入力を使いません"},+ {+ "zh": "需 1080p SDR 文件、Lecram 和 NVIDIA 光流;关闭超分、补帧、抗闪烁、调色及 HDR",+ "src": "src/ui/QmlPlayerBridge.cpp",+ "zh-TW": "需 1080p SDR 檔案、Lecram 與 NVIDIA 光流;關閉超解析度、補幀、抗閃爍、調色及 HDR",+ "en": "Requires 1080p SDR files, Lecram and NVIDIA optical flow; disable upscaling, frame generation, temporal stabilization, color adjustments and HDR",+ "ja": "1080p SDR ファイル、Lecram、NVIDIA オプティカルフローが必要です。超解像、フレーム生成、ちらつき抑制、色調整、HDR を無効にしてください"+ },{"zh": "需系统解码/转换","src": "src/source/CaptureCardSource.cpp",diff --git a/include/veyra/engine/AutoNrController.h b/include/veyra/engine/AutoNrController.hindex 2ed42e5a..48af67ba 100644--- a/include/veyra/engine/AutoNrController.h+++ b/include/veyra/engine/AutoNrController.h@@ -10,7 +10,7 @@ namespace veyra::engine {// until the source/settings session itself changes.class AutoNrController {public:- void reset(int64_t now100ns) {level_=0;switches_.clear();lowSince_.reset();next_=now100ns+5000000;lastSwitch_=now100ns-30000000;}+ void reset(int64_t now100ns,unsigned initialLevel=0) {level_=initialLevel<5?initialLevel:0;switches_.clear();lowSince_.reset();next_=now100ns+5000000;lastSwitch_=now100ns-30000000;}std::optional<unsigned> observe(int64_t now100ns,std::optional<double> p95Ms,uint64_t samples,double budgetMs) {if(now100ns<next_)return {};next_=now100ns+5000000;diff --git a/include/veyra/engine/EngineController.h b/include/veyra/engine/EngineController.hindex df3d4514..a66953ba 100644--- a/include/veyra/engine/EngineController.h+++ b/include/veyra/engine/EngineController.h@@ -65,6 +65,9 @@ struct PlayerSnapshot {std::wstring status=L"请打开视频或图片";EnhancementSettings desired,applied;bool applying=false;bool nrActive=false,srActive=false,fgActive=false;+ bool nrAutoActive=false;+ uint32_t nrAutoPercent=0,nrAutoWidth=0,nrAutoHeight=0;+ std::wstring nrAutoStatus;bool videoHdrActive=false; // TrueHDR actually running this graph (needs an HDR display path)std::wstring backendWarning;std::wstring sourceNotice;@@ -83,6 +86,7 @@ struct PlayerSnapshot {// Source geometry for the UI: coded size and the container's display aspect// ratio (0 = use coded size). Known at open time, before the first frame.uint32_t sourceWidth=0,sourceHeight=0;+ bool sourceHdr=false;double sourceDisplayAspect=0.0;int sourceRotationDegrees=0;// Poster frame for the minimal-mode bar, as a small RGBA8 image. Empty whendiff --git a/include/veyra/engine/EnhancementSettings.h b/include/veyra/engine/EnhancementSettings.hindex 32ea881e..d4a7a94e 100644--- a/include/veyra/engine/EnhancementSettings.h+++ b/include/veyra/engine/EnhancementSettings.h@@ -200,6 +200,14 @@ struct EnhancementSettings {for(uint32_t i=0;i<nrLayerCount&&i<nrLayers.size();++i)if(nrLayers[i].enabled)++count;return count;}+ uint32_t activeAutoNrLayerCount() const {+ if(!nr)return 0;+ if(!nrLayerCount)return nrPolicy==pipeline::NrSizePolicy::Auto?1:0;+ uint32_t count=0;+ for(uint32_t i=0;i<nrLayerCount&&i<nrLayers.size();++i)+ count+=nrLayers[i].enabled&&nrLayers[i].sizePolicy==pipeline::NrSizePolicy::Auto;+ return count;+ }bool sameNrTopology(const EnhancementSettings& other) const {if(nrLayerCount!=other.nrLayerCount)return false;for(uint32_t i=0;i<nrLayerCount&&i<nrLayers.size();++i){diff --git a/include/veyra/pipeline/EnhanceGraph.h b/include/veyra/pipeline/EnhanceGraph.hindex 9b1a59ab..ded91eb4 100644--- a/include/veyra/pipeline/EnhanceGraph.h+++ b/include/veyra/pipeline/EnhanceGraph.h@@ -389,8 +389,8 @@ struct EnhanceGraphDesc {ID3D12Resource* srMotionProbe = nullptr;// Same borrowed diagnostic contract as srMotionProbe, for FG only.ID3D12Resource* fgMotionProbe = nullptr;- // Isolated 3b experiment: one layer owns a bounded pool on this same- // snippet session. Not set by any product entry point until proven.+ // Optional preview-only, bounded actual-size pool on this same snippet+ // session. Admission stays at the normal-load configurations measured.std::optional<uint32_t> nrAutoPoolLayer;};@@ -480,6 +480,7 @@ public:bool selectAutoNrLevel(unsigned level);bool autoNrPoolReady()const{return nrAutoPoolReady_;}unsigned autoNrLevel()const{return nrAutoLevel_;}+ Extent autoNrExtent()const{return nrAutoPoolReady_&&desc_.nrAutoPoolLayer?desc_.nrLayersExtent[*desc_.nrAutoPoolLayer]:Extent{};}// s10 ownership-order teardown: NVOF fence drain must happen BEFORE this// call (it needs the ring and out-fence alive). Releases features, NVOFdiff --git a/include/veyra/pipeline/ResolutionPlan.h b/include/veyra/pipeline/ResolutionPlan.hindex 6e0dfdcb..c4fb3344 100644--- a/include/veyra/pipeline/ResolutionPlan.h+++ b/include/veyra/pipeline/ResolutionPlan.h@@ -9,10 +9,10 @@ struct Extent {// D3D12 texture extent, not a product aspect-ratio or video-format policy.bool valid() const {return width>=1&&height>=1&&width<=16384&&height<=16384;}};-enum class NrSizePolicy { Realtime, Native, P480, P720, P900, P1440 };-constexpr bool validNrSizePolicy(NrSizePolicy policy){return policy>=NrSizePolicy::Realtime&&policy<=NrSizePolicy::P1440;}+enum class NrSizePolicy { Realtime, Native, P480, P720, P900, P1440, Auto };+constexpr bool validNrSizePolicy(NrSizePolicy policy){return policy>=NrSizePolicy::Realtime&&policy<=NrSizePolicy::Auto;}constexpr unsigned nrHeightLimit(NrSizePolicy policy){- switch(policy){case NrSizePolicy::Realtime:return 1080;case NrSizePolicy::P480:return 480;case NrSizePolicy::P720:return 720;case NrSizePolicy::P900:return 900;case NrSizePolicy::P1440:return 1440;default:return 0;}+ switch(policy){case NrSizePolicy::Realtime:case NrSizePolicy::Auto:return 1080;case NrSizePolicy::P480:return 480;case NrSizePolicy::P720:return 720;case NrSizePolicy::P900:return 900;case NrSizePolicy::P1440:return 1440;default:return 0;}}// Preserve the existing 0/1/2 preset IDs. New choices are appended.enum class SrTarget : uint32_t { Qhd, Uhd4K, Uhd8K, Uhd5K, Uhd6K, Uhd7K };diff --git a/include/veyra/ui/EffectAvailability.h b/include/veyra/ui/EffectAvailability.hindex a0c2d982..c635fe14 100644--- a/include/veyra/ui/EffectAvailability.h+++ b/include/veyra/ui/EffectAvailability.h@@ -9,6 +9,7 @@ enum class HardwareEffect { Nvidia, NvidiaNr50, NvidiaNrSf, Vfg, AmdNr, Fsr4, Crstruct EffectGpu {uint32_t vendor = 0;bool rtx = false, blackwell = false, ada = false, rx9000 = false;+ uint32_t deviceId = 0;};constexpr bool hardwareSupports(HardwareEffect effect, EffectGpu gpu) {switch (effect) {diff --git a/include/veyra/ui/QmlPlayerBridge.h b/include/veyra/ui/QmlPlayerBridge.hindex 10c22b82..ee749f79 100644--- a/include/veyra/ui/QmlPlayerBridge.h+++ b/include/veyra/ui/QmlPlayerBridge.h@@ -248,6 +248,9 @@ class QmlPlayerBridge : public QObject {Q_PROPERTY(double lateP95Ms READ lateP95Ms NOTIFY snapshotChanged)Q_PROPERTY(QString metricsSummary READ metricsSummary NOTIFY snapshotChanged)Q_PROPERTY(bool nrActive READ nrActive NOTIFY snapshotChanged)+ Q_PROPERTY(bool nrAutoActive READ nrAutoActive NOTIFY snapshotChanged)+ Q_PROPERTY(int nrAutoPercent READ nrAutoPercent NOTIFY snapshotChanged)+ Q_PROPERTY(QString nrAutoStatus READ nrAutoStatus NOTIFY snapshotChanged)Q_PROPERTY(bool srActive READ srActive NOTIFY snapshotChanged)Q_PROPERTY(bool fgActive READ fgActive NOTIFY snapshotChanged)Q_PROPERTY(bool captureRecovering READ captureRecovering NOTIFY snapshotChanged)@@ -687,6 +690,9 @@ public:double lateP95Ms() const;QString metricsSummary() const;bool nrActive() const;+ bool nrAutoActive() const;+ int nrAutoPercent() const;+ QString nrAutoStatus() const;bool srActive() const;bool fgActive() const;bool captureRecovering() const;@@ -852,6 +858,7 @@ public:QVariantList nodeConnections() const;QVariantList nrLayers() const;Q_INVOKABLE bool setNrLayerParameter(int index, const QString& key, double value);+ Q_INVOKABLE QString nrAutoSelectionReason(int index) const;QVariantList effectCatalog() const;QString chainError() const;bool chainValid() const;diff --git a/qml/Veyra/NrLayerEditor.qml b/qml/Veyra/NrLayerEditor.qmlindex c0059f60..da22253d 100644--- a/qml/Veyra/NrLayerEditor.qml+++ b/qml/Veyra/NrLayerEditor.qml@@ -18,9 +18,21 @@ ColumnLayout {signal removeRequested(int nodeIndex)signal orderEdited(bool enabled)readonly property bool amdNr: layerData.runtime === 4+ property string autoReason: ""+ function updateAutoReason() { autoReason = veyra.nrAutoSelectionReason(layerData.index) }+ Component.onCompleted: updateAutoReason()+ onLayerDataChanged: updateAutoReason()+ Connections {+ target: veyra+ function onSettingsChanged() { editor.updateAutoReason() }+ function onChainChanged() { editor.updateAutoReason() }+ function onSnapshotChanged() { editor.updateAutoReason() }+ function onEffectCapabilitiesChanged() { editor.updateAutoReason() }+ }readonly property var sizeChoices: [{id:"2",label:"480p"}, {id:"3",label:"720p"}, {id:"4",label:"900p"},- {id:"0",label:qsTr("1080p · 默认")}, {id:"5",label:"1440p",disabled:amdNr,note:amdNr ? qsTr("AMD NR 最高 1080p 像素预算") : ""}, {id:"1",label:qsTr("原生"),disabled:amdNr,note:amdNr ? qsTr("AMD NR 最高 1080p 像素预算") : ""}+ {id:"0",label:qsTr("1080p · 默认")}, {id:"5",label:"1440p",disabled:amdNr,note:amdNr ? qsTr("AMD NR 最高 1080p 像素预算") : ""}, {id:"1",label:qsTr("原生"),disabled:amdNr,note:amdNr ? qsTr("AMD NR 最高 1080p 像素预算") : ""},+ {id:"6",label:qsTr("自动(按负载)"),disabled:autoReason.length>0,note:autoReason}]readonly property string sizeLabel: sizeChoices.find(o => Number(o.id) === layerData.sizePolicy)?.label ?? qsTr("未知")spacing: 6@@ -97,6 +109,14 @@ ColumnLayout {onPicked: id => editor.edited(editor.layerData.index, "sizePolicy", Number(id))}}+ Text {+ Layout.fillWidth: true+ visible: editor.layerData.sizePolicy === 6+ text: qsTr("自动档在预览中按增强耗时调整 100%–40%;预建实例约增加 1.7GB 显存及半秒启动时间。导出按原生尺寸处理。") ++ (veyra.nrAutoStatus.length > 0 ? "\n" + veyra.nrAutoStatus : "")+ color: Theme.t3; font.family: Theme.fontUi; font.pixelSize: 11+ wrapMode: Text.WordWrap+ }Text {Layout.fillWidth: truetext: editor.amdNr ? qsTr("预览可降采样到 1080p。AMD NR 图片/视频导出仅接受预算内原生尺寸,暂不支持 4K NR 导出。")diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cppindex f041ff3f..d521e9d0 100644--- a/src/engine/EngineController.cpp+++ b/src/engine/EngineController.cpp@@ -540,6 +540,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sreturn active;};pipeline::EnhanceGraphDesc gd;gd.sourceWidth=width;gd.sourceHeight=height;gd.hdrInput=!isImage&&activeSource->info().color.isHdrPath();+ {std::lock_guard lock(mutex_);snapshot_.sourceHdr=gd.hdrInput;}gd.highQualityPresentation=isRemote&&activeSource->info().color.reconstructChroma;gd.rgbInput=isImage||isScreen||(isCapture&&activeSource->info().color.pixelFormat==pipeline::SourcePixelFormat::Bgra8);gd.captureBitDepth=activeSource->info().color.pixelFormat==pipeline::SourcePixelFormat::P010?10:activeSource->info().color.pixelFormat==pipeline::SourcePixelFormat::P016?16:8;@@ -559,6 +560,8 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sgd.runtimeAbsPath=runtime::localRuntimeDirectory().wstring();gd.compatibilityPreflight=[this](const auto& desc,const auto& device){return checkFgCompatibility(desc,device,stop_);};std::wstring backendRecoveryWarning;+ bool nrAutoPoolUnavailable=false;+ std::wstring nrAutoStatus;auto initializePreview=[&](pipeline::EnhanceGraphDesc& desc,PlayerOptions& selected,bool preserveWorkingFg=false,bool preserveWorkingNr=false){backendRecoveryWarning.clear();auto supported=selected.snapshot();@@ -573,17 +576,26 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sfor(unsigned attempt=0;attempt<6;++attempt){desc.videoHdr=selected.settings.videoHdr;desc.hdrOutput=selected.settings.useHdrPreview(desc.hdrInput,displayHdrActive());- // Experimental normal-playback driver only. A cached/prewarmed- // graph has no pool; never adopt it for this request.+ // Auto is optional and preview-only; fixed/export policies+ // retain their existing contract. A prewarmed graph has no pool.desc.nrAutoPoolLayer.reset();- if(GetEnvironmentVariableW(L"VEYRA_TEST_NR_AUTO_POOL",nullptr,0)>0&&+ const auto automatic=std::find(desc.nrLayersSizePolicy.begin(),desc.nrLayersSizePolicy.end(),pipeline::NrSizePolicy::Auto);+ const bool autoRequested=selected.nr&&automatic!=desc.nrLayersSizePolicy.end();+ const bool tested=GetEnvironmentVariableW(L"VEYRA_TEST_NR_AUTO_POOL",nullptr,0)>0;+ const bool admitted=(tested||(autoRequested&&automatic==desc.nrLayersSizePolicy.begin()&&selected.settings.activeAutoNrLayerCount()==1))&&+ !nrAutoPoolUnavailable&&selected.settings.activeNrLayerCount()<=2&&!isCapture&&!isImage&&desc.enableNr&&!desc.enableSr&&!desc.enableFg&&- !desc.hdrWorking()&&!desc.runtimeNodeOrder&&desc.nrHoldStrength==0&&+ !desc.hdrWorking()&&!desc.videoHdr.enabled&&!desc.color.enabled&&!desc.additionalColorCount&&!desc.runtimeNodeOrder&&desc.nrHoldStrength==0&&desc.nrRuntime==NrRuntime::Original&&desc.opticalFlowBackend==OpticalFlowBackend::Nvidia&&+ desc.nrMotion==MotionSource::OpticalFlow&&nvidiaAdapter&&ctx.adapter().deviceId==0x2f04&&desc.workWidth==1920&&desc.workHeight==1080&&+ desc.sourceWidth==1920&&desc.sourceHeight==1080&&!desc.nrLayersExtent.empty()&&desc.nrLayersExtent[0]==pipeline::Extent{1920,1080}&&- std::none_of(desc.nrLayersTemporal.begin(),desc.nrLayersTemporal.end(),[](bool value){return value;}))- desc.nrAutoPoolLayer=0;+ std::none_of(desc.nrLayersTemporal.begin(),desc.nrLayersTemporal.end(),[](bool value){return value;});+ nrAutoStatus.clear();+ if(admitted)desc.nrAutoPoolLayer=0;+ else if(autoRequested)nrAutoStatus=nrAutoPoolUnavailable?+ L"自动NR实例池不可用,保留1080p NR":L"当前配置未启用自动NR,保留1080p NR";// The only graph allowed beside an inactive NR adapter is// effects-off. Evict before any other NGX initialization.if(recentGraphCache.hasCachedGraph()&&!RecentGraphCache::effectsOff(desc)){@@ -609,8 +621,15 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,suint64_t afterBudget=0,afterUsage=0;const auto newBytes=measuredBefore&&ctx.videoMemoryInfo(afterBudget,afterUsage)&&afterUsage>buildUsage?afterUsage-buildUsage:0;graphBytes=adopted?graphBytes+newBytes:newBytes;+ {std::lock_guard lock(mutex_);snapshot_.nrAutoStatus=nrAutoStatus;snapshot_.nrAutoActive=false;+ snapshot_.nrAutoPercent=snapshot_.nrAutoWidth=snapshot_.nrAutoHeight=0;}return true;}+ if(desc.nrAutoPoolLayer&&failure==FailedBackend::Nr&&SUCCEEDED(ctx.device()->GetDeviceRemovedReason())){+ nrAutoPoolUnavailable=true;graph->shutdown();+ veyra::log::warn("nr-auto","pool initialization unavailable; retrying the same NR settings at fixed 1080p");+ continue;+ }// A live backend/multiplier switch must not turn a working FG// session into effects-off playback when the new provider fails.if(preserveWorkingFg&&failure==FailedBackend::Fg)return false;@@ -1409,7 +1428,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sif(graph->autoNrPoolReady()&&frameFlow&&!transaction&&!paused_){const auto now=host100ns();if(autoNrRevision!=options.settings.revision||autoNrControl.level()!=graph->autoNrLevel()){- autoNrControl.reset(now);autoNrRevision=options.settings.revision;+ autoNrControl.reset(now,graph->autoNrLevel());autoNrRevision=options.settings.revision;}if(reset)autoNrControl.discardObservations(now);const auto timing=frameFlow->snapshot(now).enhancementProcessing;@@ -2244,6 +2263,10 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,ssnapshot_.fgBudgetLimited=measured.flow.lastFgRejected100ns>0&&host100ns()-measured.flow.lastFgRejected100ns<10000000;snapshot_.xessGenerationSuppressed=graph->xessEnabled()&&presenter.xessGenerationSuppressed();snapshot_.nrActive=graph->nrEnabled()&&graphStats.nrEvaluateCount>0;+ snapshot_.nrAutoActive=graph->autoNrPoolReady();+ snapshot_.nrAutoPercent=graph->autoNrPoolReady()?AutoNrController::percent(graph->autoNrLevel()):0;+ const auto autoExtent=graph->autoNrExtent();snapshot_.nrAutoWidth=autoExtent.width;snapshot_.nrAutoHeight=autoExtent.height;+ snapshot_.nrAutoStatus=nrAutoStatus;snapshot_.audioRebuffering=audioRebuffering;snapshot_.audioVideoWaits=audioPipe.videoWaitCount();snapshot_.srActive=gd.enableSr&&graphStats.srEvaluateCount>0;diff --git a/src/engine/PreviewGpuSession.cpp b/src/engine/PreviewGpuSession.cppindex 95190d37..50dd3ec1 100644--- a/src/engine/PreviewGpuSession.cpp+++ b/src/engine/PreviewGpuSession.cpp@@ -23,7 +23,7 @@ bool PreviewGpuSession::initialize(unsigned slots){}bool PreviewGpuSession::requestAllowed(const EnhancementSettings& settings){return settings.validate().empty()&&(settings.nr||settings.sr)&&settings.multiplier==1&&- settings.nrRuntime==NrRuntime::Original&&settings.activeNrLayerCount()<=1&&+ settings.nrRuntime==NrRuntime::Original&&settings.activeNrLayerCount()<=1&&!settings.activeAutoNrLayerCount()&&!settings.videoHdr.enabled&&!settings.color.enabled&&settings.additionalColorCount==0&&(settings.videoSrQuality==0||settings.videoSrQuality==4);}diff --git a/src/pipeline/EnhanceGraph.cpp b/src/pipeline/EnhanceGraph.cppindex 1f0b9c95..9f4c24a1 100644--- a/src/pipeline/EnhanceGraph.cpp+++ b/src/pipeline/EnhanceGraph.cpp@@ -1393,6 +1393,9 @@ bool EnhanceGraph::createNrFeature(NrInstance& layer) {}bool EnhanceGraph::createAutoNrPool() {+ if(GetEnvironmentVariableW(L"VEYRA_TEST_NR_AUTO_POOL_REFUSE",nullptr,0)>0){+ failedBackend_=engine::FailedBackend::Nr;log::warn("nr-auto-pool","test-only API refusal; no allocation or pressure injected");return false;+ }const auto index=*desc_.nrAutoPoolLayer;const bool admitted=nrEnabled_&&!srEnabled_&&!fgEnabled_&&!lmxxfNr_&&!desc_.hdrWorking()&&!desc_.stillImage&&!desc_.noFeatures&&!desc_.noNgx&&!desc_.runtimeNodeOrder&&!desc_.nrTemporal&&desc_.nrHoldStrength==0&&diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cppindex 41906934..55b1a7eb 100644--- a/src/ui/QmlPlayerBridge.cpp+++ b/src/ui/QmlPlayerBridge.cpp@@ -810,6 +810,7 @@ static ui::EffectGpu effectGpu() {FAILED(D3D12CreateDevice(adapter.Get(), D3D_FEATURE_LEVEL_12_0, __uuidof(ID3D12Device), nullptr))) continue;const auto name = QString::fromWCharArray(d.Description);result.vendor = d.VendorId;+ result.deviceId = d.DeviceId;result.rtx = name.contains("RTX", Qt::CaseInsensitive);result.blackwell = name.contains("RTX 50", Qt::CaseInsensitive) || name.contains("Blackwell", Qt::CaseInsensitive);result.ada = name.contains("RTX 40", Qt::CaseInsensitive) || name.contains("Ada", Qt::CaseInsensitive);@@ -835,6 +836,8 @@ static QVariantMap scanEffectCapabilities() {out[id] = QVariantMap{{"available", supported && files}, {"reason", !supported ? requirement : !files ? QObject::tr("当前包缺少此功能的运行组件") : QString{}}};};add("nr0", H::NvidiaNr50, exists(nr / "nvngx_dlssnr.dll"), QObject::tr("需要 NVIDIA RTX 50 / Blackwell"));+ out["nrAuto"]=QVariantMap{{"available",gpu.vendor==0x10DE&&gpu.deviceId==0x2f04&&out.value("nr0").toMap().value("available").toBool()},+ {"reason",gpu.deviceId!=0x2f04?QObject::tr("自动 NR 当前仅验证 RTX 5070"):!out.value("nr0").toMap().value("available").toBool()?QObject::tr("当前包缺少此功能的运行组件"):QString{}}};add("nr2", H::NvidiaNrSf, exists(nr / "nr-ampere/nvngx_dlssnr.dll"), QObject::tr("需要 NVIDIA RTX 显卡"));add("nr3", H::NvidiaNr50, exists(nr / "nr-original/nvngx_dlssnr.dll"), QObject::tr("需要 NVIDIA RTX 50 / Blackwell"));add("nr4", H::AmdNr, exists(nr / "../amd-nr/LmxxfNrRuntime.dll"), QObject::tr("需要 AMD RX 9000"));@@ -3757,6 +3760,15 @@ QString QmlPlayerBridge::metricsSummary() const {return tr("提交 %1").arg(*s.submissionFps, 0, 'f', 1);}bool QmlPlayerBridge::nrActive() const { return impl_->snapshot.nrActive; }+bool QmlPlayerBridge::nrAutoActive() const {return impl_->snapshot.nrAutoActive;}+int QmlPlayerBridge::nrAutoPercent() const {return int(impl_->snapshot.nrAutoPercent);}+QString QmlPlayerBridge::nrAutoStatus() const {+ const auto& s=impl_->snapshot;+ if(s.nrAutoActive)return tr("NR 自动 %1% · %2×%3").arg(s.nrAutoPercent).arg(s.nrAutoWidth).arg(s.nrAutoHeight);+ if(s.nrAutoStatus==L"自动NR实例池不可用,保留1080p NR")return tr("自动 NR 实例池不可用,保留固定 1080p 档");+ if(!s.nrAutoStatus.empty())return tr("当前配置未启用自动 NR,保留固定 1080p 档");+ return {};+}bool QmlPlayerBridge::srActive() const { return impl_->snapshot.srActive; }bool QmlPlayerBridge::fgActive() const { return impl_->snapshot.fgActive; }bool QmlPlayerBridge::captureRecovering() const { return impl_->snapshot.captureRecovering; }@@ -4094,6 +4106,26 @@ QVariantList QmlPlayerBridge::nrLayers() const {return out;}+QString QmlPlayerBridge::nrAutoSelectionReason(int index) const {+ const auto cap=effectCapabilities().value("nrAuto").toMap();+ if(!cap.value("available").toBool())return cap.value("reason").toString();+ const auto& s=settings();const auto& snapshot=impl_->snapshot;+ int first=-1;unsigned count=0;bool temporal=false,otherAuto=false;+ for(uint32_t i=0;i<impl_->chain.nodeCount;++i){const auto& node=impl_->chain.nodes[i];+ if(node.type!=engine::EffectType::NrEnhance)continue;+ if(first<0)first=int(i);+ ++count;temporal|=node.enabled&&node.nr.temporal;+ otherAuto|=int(i)!=index&&node.enabled&&node.nr.sizePolicy==pipeline::NrSizePolicy::Auto;+ }+ if(first!=index||count>2||otherAuto)return tr("自动 NR 仅支持一至两层列表的第一层");+ if(impl_->chain.mode!=engine::ChainMode::List||s.nrRuntime!=engine::NrRuntime::Original||s.sr||s.multiplier>1||temporal||+ s.nrHoldStrength>0||s.color.enabled||s.additionalColorCount||s.videoHdr.enabled||+ s.opticalFlowBackend!=engine::OpticalFlowBackend::Nvidia||s.nrMotion!=engine::MotionSource::OpticalFlow||snapshot.capture||snapshot.image||snapshot.sourceHdr||+ (snapshot.sourceWidth&& (snapshot.sourceWidth!=1920||snapshot.sourceHeight!=1080)))+ return tr("需 1080p SDR 文件、Lecram 和 NVIDIA 光流;关闭超分、补帧、抗闪烁、调色及 HDR");+ return {};+}+bool QmlPlayerBridge::setNrLayerParameter(int index,const QString& key,double value){if(index<0||uint32_t(index)>=impl_->chain.nodeCount||impl_->chain.nodes[index].type!=engine::EffectType::NrEnhance||!std::isfinite(value))return false;@@ -4120,8 +4152,11 @@ bool QmlPlayerBridge::setNrLayerParameter(int index,const QString& key,double vaelse if(key=="color")n.residual.color=float(value);else if(key=="luminance")n.residual.luminance=float(value);else {- if(value!=std::floor(value)||value<0||value>5)return false;- if(key=="sizePolicy")n.sizePolicy=static_cast<pipeline::NrSizePolicy>(int(value));+ if(value!=std::floor(value)||value<0||value>6)return false;+ if(key=="sizePolicy"){+ if(value==6){const auto reason=nrAutoSelectionReason(index);if(!reason.isEmpty()){emit notice(reason,true);return false;}}+ n.sizePolicy=static_cast<pipeline::NrSizePolicy>(int(value));+ }else if(key=="style"&&value<=2)n.model.style=int(value);else if(key=="autoMask"&&value<=1)n.model.autoMask=int(value);else if(key=="uiCorrection"&&value<=1)n.model.uiCorrection=int(value);@@ -5809,6 +5844,7 @@ void QmlPlayerBridge::updateRunStatus() {if (s.applied.multiplier > 1 && impl_->compareMode != 0) detail << tr("补帧暂停");else if (s.applied.multiplier > 1 && (s.fgBudgetLimited || s.xessGenerationSuppressed)) detail << tr("调度降档");if (s.nominalSourceFps > 0.01) detail << tr("源 %1 fps").arg(s.nominalSourceFps, 0, 'f', 2);+ const auto autoState=nrAutoStatus();if(!autoState.isEmpty())detail<<autoState;}// 1.4.4 DashboardHistory: target = source x multiplier (half-rate capture// halves it); actual = what reached present (XeSS: its SDK submit rate).diff --git a/tests/perf/AutoNrControllerTests.cpp b/tests/perf/AutoNrControllerTests.cppindex baa8b1be..a1af72fd 100644--- a/tests/perf/AutoNrControllerTests.cpp+++ b/tests/perf/AutoNrControllerTests.cpp@@ -21,6 +21,8 @@ int main() {c.observe(715000000,std::numeric_limits<double>::quiet_NaN(),30,10)||c.observe(720000000,20,30,0))return 1;if(c.observe(725000000,11,30,10)!=1)return 1;if(c.observe(755000000,7.5,30,10)||c.observe(785000000,7.5,30,10))return 1; // hysteresis band+ c.reset(800000000,2);+ if(c.level()!=2||c.observe(805000000,20,30,10)!=3)return 1; // a retained graph's current level survives parameter revisionstd::cout<<"AUTO_NR_CONTROLLER_PASS transportBudget=1 dwell=1 hysteresis=1 cap=1 floor=1 invalidTiming=1 reset=1"<<std::endl;return 0;}diff --git a/tests/perf/NrAutoPoolExperiment.cpp b/tests/perf/NrAutoPoolExperiment.cppindex 62668f29..7922180d 100644--- a/tests/perf/NrAutoPoolExperiment.cpp+++ b/tests/perf/NrAutoPoolExperiment.cpp@@ -12,7 +12,8 @@int wmain(int argc,wchar_t** argv) {using namespace veyra;if(argc!=5)return 2;- const bool pooled=std::wstring(argv[3])==L"pool";if(!pooled&&std::wstring(argv[3])!=L"reference")return 2;+ const bool pooled=std::wstring(argv[3])==L"pool",fixed=std::wstring(argv[3])==L"fixed";+ if(!pooled&&!fixed&&std::wstring(argv[3])!=L"reference")return 2;const unsigned count=_wtoi(argv[4]);if(count<1||count>2)return 2;const HRESULT com=CoInitializeEx(nullptr,COINIT_MULTITHREADED);if(FAILED(com))return 2;struct ComLifetime{~ComLifetime(){CoUninitialize();}} comLifetime;@@ -33,7 +34,7 @@ int wmain(int argc,wchar_t** argv) {constexpr unsigned levels[6]={0,1,2,3,4,0};std::ofstream frames(out/L"frames.csv");frames<<"frame,level,pts100ns,width,height,historyReset,sha256\n";bool pass=true;unsigned completed=0;- for(unsigned segment=0;segment<6&&pass;++segment){const auto level=levels[segment];+ for(unsigned segment=0;segment<6&&pass;++segment){const auto level=fixed?0:levels[segment];if(pooled)pass=session.graph->selectAutoNrLevel(level);else{session.graph->shutdown();pass=session.graph->initialize(makeDesc(level))&&session.graph->createViews();}for(unsigned j=0;j<15&&pass;++j){const unsigned frame=segment*15+j;diff --git a/tests/perf/NrExportPipelineExperiment.cpp b/tests/perf/NrExportPipelineExperiment.cppindex 114a0da9..07d10c18 100644--- a/tests/perf/NrExportPipelineExperiment.cpp+++ b/tests/perf/NrExportPipelineExperiment.cpp@@ -21,18 +21,19 @@ int wmain(int argc,wchar_t** argv){struct Apartment {~Apartment(){CoUninitialize();}} apartment;engine::EnhancementSettings settings;settings.exportBitrateMbps=30;settings.nrPolicy=pipeline::NrSizePolicy::Native;- if(group==L"nr"||group==L"nr2"||group==L"nrsr4k")settings.nr=true;+ if(group==L"nr"||group==L"nr2"||group==L"nr2-auto"||group==L"nrsr4k")settings.nr=true;if(group==L"sr4k"||group==L"sr8k"||group==L"nrsr4k"){settings.sr=true;settings.videoSrQuality=0;settings.srTarget=group==L"sr8k"?pipeline::SrTarget::Uhd8K:pipeline::SrTarget::Uhd4K;}- if(group==L"nr2"){+ if(group==L"nr2"||group==L"nr2-auto"){engine::EffectChain chain;chain.nodeCount=2;for(unsigned i=0;i<2;++i){chain.nodes[i].enabled=true;chain.nodes[i].type=engine::EffectType::NrEnhance;chain.nodes[i].nr.sizePolicy=pipeline::NrSizePolicy::Native;}+ if(group==L"nr2-auto")chain.nodes[0].nr.sizePolicy=pipeline::NrSizePolicy::Auto;engine::fromChain(chain,settings);}if(group==L"fg2")settings.multiplier=2;- if(group!=L"none"&&group!=L"nr"&&group!=L"nr2"&&group!=L"sr4k"&&group!=L"nrsr4k"&&group!=L"sr8k"&&group!=L"fg2")return 2;+ if(group!=L"none"&&group!=L"nr"&&group!=L"nr2"&&group!=L"nr2-auto"&&group!=L"sr4k"&&group!=L"nrsr4k"&&group!=L"sr8k"&&group!=L"fg2")return 2;settings.nrPolicy=pipeline::NrSizePolicy::Native;settings.exportBitrateMbps=30;auto options=engine::PlayerOptions::from(settings);options.exportRateControl=sink::ExportRateControl::Vbr;const bool cancelTest=argc==7&&std::wstring(argv[6])==L"--cancel";