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

Default NVIDIA NR to SF 310.9.16 and persist per-layer performance model selection

Veyra Goal Agent60205f40c4f1
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 604e4cd4..7a76e7ca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,10 @@
cmake_minimum_required(VERSION 3.24)
-project(veyra VERSION 2.0.8 LANGUAGES C CXX RC)
+project(veyra VERSION 2.0.9 LANGUAGES C CXX RC)
# Moonlight/Xbox have C sources independently of the optional PS5 backend.
# Shown in the EXE's version resource and in the package name. CMake versions
# must be numeric, so the beta marker lives here instead.
-set(VEYRA_DISPLAY_VERSION "2.0.8" CACHE STRING "Human-readable version string")
+set(VEYRA_DISPLAY_VERSION "2.0.9" CACHE STRING "Human-readable version string")
# The cache keeps the first value it ever saw, so a release that bumps
# project(VERSION) used to ship an EXE still stamped with the previous display
# string. Re-align it whenever the cached label does not start with the project
@@ -772,6 +772,11 @@ if(VEYRA_FFMPEG_ROOT AND EXISTS "${VEYRA_FFMPEG_ROOT}/include/libavformat/avform
add_executable(veyra_nr_runtime_switch_tests tests/integration/NrRuntimeSwitchTests.cpp)
target_compile_features(veyra_nr_runtime_switch_tests PRIVATE cxx_std_20)
target_link_libraries(veyra_nr_runtime_switch_tests PRIVATE veyra_engine)
+
+ add_executable(veyra_nr_model_settings_tests tests/unit/NrModelSettingsTests.cpp)
+ target_compile_features(veyra_nr_model_settings_tests PRIVATE cxx_std_20)
+ target_compile_options(veyra_nr_model_settings_tests PRIVATE /utf-8)
+ target_link_libraries(veyra_nr_model_settings_tests PRIVATE veyra_engine)
add_executable(veyra_audio_timeline_tests tests/integration/AudioTimelineTests.cpp)
target_compile_features(veyra_audio_timeline_tests PRIVATE cxx_std_20)
target_link_libraries(veyra_audio_timeline_tests PRIVATE veyra_sinks)
diff --git a/i18n/catalog.json b/i18n/catalog.json
index b378559c..9dae2452 100644
--- a/i18n/catalog.json
+++ b/i18n/catalog.json
@@ -448,6 +448,13 @@
"en": "%1 · currently about %2 fps",
"ja": "%1 · 現在約 %2 fps"
},
+ {
+ "zh": "%1 关闭",
+ "src": "qml/NodePage.qml",
+ "zh-TW": "%1 關閉",
+ "en": "%1 to close",
+ "ja": "%1 で閉じる"
+ },
{
"zh": "%1 已用于其他操作",
"src": "src/ui/QmlPlayerBridge.cpp",
@@ -875,13 +882,6 @@
"en": "CQ keeps quality constant; file size follows how complex the picture is.",
"ja": "CQ は画質を一定に保ちます。ファイルサイズは映像の複雑さによって変わります。"
},
- {
- "zh": "Ctrl+Alt+Home 已被其它软件占用,游戏模式不能穿透操作;关闭占用它的软件后重新全屏",
- "src": "src/ui/QmlPlayerBridge.cpp",
- "zh-TW": "Ctrl+Alt+Home 已被其他軟體佔用,遊戲模式不能穿透操作;關閉佔用它的軟體後重新全螢幕",
- "en": "Another program has taken Ctrl+Alt+Home, so game mode cannot pass input through; close that program and go fullscreen again",
- "ja": "Ctrl+Alt+Home が他のソフトに使われているため、ゲームモードで操作を通せません。そのソフトを閉じてから全画面にし直してください"
- },
{
"zh": "Ctrl+Alt+Shift+S 隐藏",
"src": "qml/StreamHud.qml",
@@ -1232,20 +1232,6 @@
"en": "HDR (10-bit) export needs NVIDIA NVENC; this GPU only has an 8-bit system encoder. Turn HDR off or export on an NVIDIA GPU",
"ja": "HDR(10bit)の書き出しには NVIDIA NVENC が必要です。この GPU には 8bit のシステムエンコーダーしかありません。HDR をオフにするか、NVIDIA GPU で書き出してください"
},
- {
- "zh": "Home 关闭",
- "src": "qml/NodePage.qml",
- "zh-TW": "Home 關閉",
- "en": "Home to close",
- "ja": "Home で閉じる"
- },
- {
- "zh": "Home 已被其它软件占用:游戏模式里不能用 Home 呼出调整面板,按 Ctrl+Alt+Home 退出后再调整",
- "src": "src/ui/QmlPlayerBridge.cpp",
- "zh-TW": "Home 已被其他軟體佔用:遊戲模式裡不能用 Home 叫出調整面板,按 Ctrl+Alt+Home 退出後再調整",
- "en": "Another program has taken Home: in game mode Home cannot open the adjust panel; press Ctrl+Alt+Home to leave, then adjust",
- "ja": "Home が他のソフトに使われています。ゲームモード中は Home で調整パネルを開けません。Ctrl+Alt+Home で終了してから調整してください"
- },
{
"zh": "IP 或主机名,端口不是 47989 时写成 192.168.1.20:47989",
"src": "qml/DialogHost.qml",
@@ -3101,6 +3087,13 @@
"en": "Balanced brightness",
"ja": "バランスのよい輝度分布"
},
+ {
+ "zh": "仅在游戏模式中接管按键;支持 Ctrl、Alt、Shift 组合",
+ "src": "qml/SettingsPage.qml",
+ "zh-TW": "僅在遊戲模式中接管按鍵;支援 Ctrl、Alt、Shift 組合",
+ "en": "Keys are captured only in game mode; Ctrl, Alt and Shift combinations are supported",
+ "ja": "ゲームモード中のみキーを使用します。Ctrl、Alt、Shift の組み合わせに対応"
+ },
{
"zh": "仅清空列表,不删除硬盘文件",
"src": "qml/PlaylistWindow.qml",
@@ -3571,11 +3564,11 @@
"ja": "全画面表示(映像をダブルクリック / F11)"
},
{
- "zh": "全屏(双击画面 / F11)· 全屏后按 Home 打开快速调节",
+ "zh": "全屏(双击画面 / F11)· 全屏后按 %1 打开快速调节",
"src": "qml/ProPage.qml",
- "zh-TW": "全螢幕(雙擊畫面 / F11)· 全螢幕後按 Home 開啟快速調節",
- "en": "Fullscreen (double-click the picture / F11) · press Home in fullscreen for quick settings",
- "ja": "全画面(映像をダブルクリック / F11)· 全画面中に Home でクイック設定"
+ "zh-TW": "全螢幕(雙擊畫面 / F11)· 全螢幕後按 %1 開啟快速調整",
+ "en": "Fullscreen (double-click / F11) · Press %1 for quick adjustments",
+ "ja": "全画面(ダブルクリック / F11)· %1 でクイック調整"
},
{
"zh": "全部显卡",
@@ -3718,13 +3711,6 @@
"en": "In compatible mode, turn off the mouse pointer or use Windows capture",
"ja": "互換モードではマウスポインターをオフにするか、Windows キャプチャーを使ってください"
},
- {
- "zh": "内容亮度远超显示设备能力",
- "src": "qml/ProPage.qml",
- "zh-TW": "內容亮度遠超顯示裝置能力",
- "en": "Content brightness far exceeds the display capability",
- "ja": "コンテンツの輝度がディスプレイの能力を大幅に上回ります"
- },
{
"zh": "兼容软解",
"src": "src/engine/EngineController.cpp",
@@ -3732,6 +3718,13 @@
"en": "software compatibility",
"ja": "互換ソフトウェア"
},
+ {
+ "zh": "内容亮度远超显示设备能力",
+ "src": "qml/ProPage.qml",
+ "zh-TW": "內容亮度遠超顯示裝置能力",
+ "en": "Content brightness far exceeds the display capability",
+ "ja": "コンテンツの輝度がディスプレイの能力を大幅に上回ります"
+ },
{
"zh": "内容节奏",
"src": "qml/NodePage.qml",
@@ -4992,6 +4985,20 @@
"en": "Could not save the startup default preset",
"ja": "起動時の既定プリセットを保存できませんでした"
},
+ {
+ "zh": "启用失败",
+ "src": "qml/NodePage.qml",
+ "zh-TW": "啟用失敗",
+ "en": "Failed to enable",
+ "ja": "有効化に失敗"
+ },
+ {
+ "zh": "启用性能优化版",
+ "src": "qml/NrLayerEditor.qml",
+ "zh-TW": "啟用效能最佳化版",
+ "en": "Use performance model",
+ "ja": "性能最適化モデルを使う"
+ },
{
"zh": "启用的 NR 层必须使用同一运行时和 NR/SR 顺序",
"src": "src/engine/EffectChain.cpp",
@@ -7288,6 +7295,13 @@
"en": "Switches, progress, selected state",
"ja": "スイッチ、進行状況、選択状態"
},
+ {
+ "zh": "开启使用新版模型 B;关闭使用旧版模型 A。切换会重建 NR,画面可能有所不同。",
+ "src": "qml/NrLayerEditor.qml",
+ "zh-TW": "開啟使用新版模型 B;關閉使用舊版模型 A。切換會重建 NR,畫面可能有所不同。",
+ "en": "On: new model B. Off: legacy model A. Switching rebuilds NR and may change the picture.",
+ "ja": "オンは新モデル B、オフは旧モデル A。切り替えると NR を再作成し、映像が変わる場合があります。"
+ },
{
"zh": "开启调控",
"src": "qml/NrLayerEditor.qml",
@@ -7317,18 +7331,11 @@
"ja": "書き込み開始後、書き込み量から推定"
},
{
- "zh": "开始后 Veyra 在游戏所在的屏幕上全屏盖住游戏,键鼠和手柄照常操作游戏;Home 调整画面,Ctrl+Alt+Home 退出。游戏请设为无边框全屏",
- "src": "qml/DialogHost.qml",
- "zh-TW": "開始後 Veyra 在遊戲所在的螢幕上全螢幕蓋住遊戲,鍵鼠和手把照常操作遊戲;Home 調整畫面,Ctrl+Alt+Home 退出。遊戲請設為無邊框全螢幕",
- "en": "Veyra goes fullscreen over the game on its screen; keyboard, mouse and gamepad still play the game. Home adjusts the picture, Ctrl+Alt+Home leaves. Set the game to borderless fullscreen",
- "ja": "開始すると Veyra がゲームのある画面で全画面になってゲームを覆い、キーボード・マウス・ゲームパッドはそのままゲームを操作します。Home で映像を調整、Ctrl+Alt+Home で終了。ゲームはボーダーレス全画面にしてください"
- },
- {
- "zh": "开始后 Veyra 在这块屏幕上全屏,键鼠和手柄直接操作屏幕上的任何程序,就像直接用电脑;Home 调整画面,Ctrl+Alt+Home 退出",
+ "zh": "开始后 Veyra 在这块屏幕上全屏,键鼠和手柄直接操作屏幕上的程序;%1 调整画面,%2 退出",
"src": "qml/DialogHost.qml",
- "zh-TW": "開始後 Veyra 在這塊螢幕上全螢幕,鍵鼠和手把直接操作螢幕上的任何程式,就像直接用電腦;Home 調整畫面,Ctrl+Alt+Home 退出",
- "en": "Veyra goes fullscreen on this screen; keyboard, mouse and gamepad work every program on it as if you used the computer directly. Home adjusts the picture, Ctrl+Alt+Home leaves",
- "ja": "開始すると Veyra がこの画面で全画面になり、キーボード・マウス・ゲームパッドで画面上のどのソフトもそのまま操作できます。Home で映像を調整、Ctrl+Alt+Home で終了"
+ "zh-TW": "開始後 Veyra 在此螢幕全螢幕顯示,鍵鼠與手把直接操作螢幕上的程式;%1 調整畫面,%2 退出",
+ "en": "Veyra opens fullscreen on this display. Keyboard, mouse and controller operate its programs; %1 adjusts the picture and %2 exits.",
+ "ja": "この画面で全画面表示し、キーボード・マウス・コントローラーで背後のアプリを操作します。%1 で画面調整、%2 で解除。"
},
{
"zh": "开始后键鼠交给主机;Ctrl+Alt+Shift+Z 释放,+Q 断开,+S 统计",
@@ -11084,18 +11091,25 @@
"ja": "ゲームモードでは実際のポインターを使い、映像には描きません"
},
{
- "zh": "游戏模式:调整画面 / 退出",
+ "zh": "游戏模式键盘监听启动失败,未开启鼠标穿透;请退出全屏后重试",
+ "src": "src/ui/QmlPlayerBridge.cpp",
+ "zh-TW": "遊戲模式鍵盤監聽啟動失敗,未開啟滑鼠穿透;請退出全螢幕後重試",
+ "en": "Game mode keyboard listener could not start. Mouse passthrough is off; leave fullscreen and try again.",
+ "ja": "ゲームモードのキー監視を開始できません。マウス透過はオフです。全画面を解除して再試行してください。"
+ },
+ {
+ "zh": "游戏模式:调整画面",
"src": "qml/SettingsPage.qml",
- "zh-TW": "遊戲模式:調整畫面 / 退出",
- "en": "Game mode: adjust picture / leave",
- "ja": "ゲームモード:映像を調整 / 終了"
+ "zh-TW": "遊戲模式:調整畫面",
+ "en": "Game mode: adjust picture",
+ "ja": "ゲームモード:画面調整"
},
{
- "zh": "游戏窗口没有铺满屏幕:画面会放大显示,鼠标点到的位置可能和看到的不一致;建议把游戏设为无边框全屏",
- "src": "src/ui/QmlPlayerBridge.cpp",
- "zh-TW": "遊戲視窗沒有鋪滿螢幕:畫面會放大顯示,滑鼠點到的位置可能和看到的不一致;建議把遊戲設為無邊框全螢幕",
- "en": "The game window does not fill the screen: the picture is enlarged, so clicks may not land where you see them. Set the game to borderless fullscreen",
- "ja": "ゲームのウィンドウが画面全体を覆っていません。映像が拡大されるため、クリック位置が見た位置とずれることがあります。ゲームをボーダーレス全画面にしてください"
+ "zh": "游戏模式:退出鼠标穿透",
+ "src": "qml/SettingsPage.qml",
+ "zh-TW": "遊戲模式:退出滑鼠穿透",
+ "en": "Game mode: exit mouse passthrough",
+ "ja": "ゲームモード:マウス透過を解除"
},
{
"zh": "游戏锁 30/40 帧、采集卡输出 60 帧时选“自动识别内容节奏”:只去掉与上一张完全相同的画面,补帧时间均匀;“采集 60→30”固定每两帧取一帧,稳定 30 帧",
@@ -11468,6 +11482,13 @@
"en": "Image correction controls temporal stability; this setting returns when correction is off",
"ja": "画質調整が時間方向の安定化を制御中。オフにするとこの設定に戻ります。"
},
+ {
+ "zh": "画面贴合游戏窗口的位置,键鼠和手柄照常操作游戏;%1 调整画面,%2 退出。独占全屏请改为无边框窗口",
+ "src": "qml/DialogHost.qml",
+ "zh-TW": "畫面貼合遊戲視窗位置,鍵鼠與手把照常操作遊戲;%1 調整畫面,%2 退出。獨佔全螢幕請改為無邊框視窗",
+ "en": "The picture follows the game window position. Use the keyboard, mouse and controller normally; %1 adjusts the picture and %2 exits. Use borderless mode instead of exclusive fullscreen.",
+ "ja": "ゲームウィンドウの位置に画面を合わせます。通常どおり操作し、%1 で画面調整、%2 で解除。排他全画面ではなくボーダーレスにしてください。"
+ },
{
"zh": "界面卡住超过 3 秒,已退出游戏模式",
"src": "src/ui/QmlPlayerBridge.cpp",
@@ -14849,6 +14870,13 @@
"en": "Quit",
"ja": "終了"
},
+ {
+ "zh": "退出全屏,恢复普通窗口操作",
+ "src": "qml/SettingsPage.qml",
+ "zh-TW": "退出全螢幕,恢復一般視窗操作",
+ "en": "Leave fullscreen and restore normal window controls",
+ "ja": "全画面を解除して通常のウィンドウ操作に戻る"
+ },
{
"zh": "退出游戏",
"src": "qml/DialogHost.qml",
@@ -15557,11 +15585,11 @@
"ja": "ゼロモーションは時間方向の再構成を制限します。RTX ビデオ超解像はこの入力を使いません"
},
{
- "zh": "需 1080p SDR 文件、Lecram 和 NVIDIA 光流;关闭超分、补帧、抗闪烁、调色及 HDR",
+ "zh": "需 1080p SDR 文件、SF 和 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-TW": "需 1080p SDR 檔案、SF 與 NVIDIA 光流;關閉超解析度、補幀、抗閃爍、調色及 HDR",
+ "en": "Requires a 1080p SDR file, SF and NVIDIA optical flow; turn off upscaling, frame generation, anti-flicker, grading and HDR",
+ "ja": "1080p SDR ファイル、SF、NVIDIA 光フローが必要です。超解像、フレーム生成、ちらつき抑制、色調整、HDR をオフにしてください"
},
{
"zh": "需系统解码/转换",
@@ -16109,6 +16137,13 @@
"en": "Preset library: invalid NR resolution",
"ja": "プリセットライブラリの NR 解像度が不正です"
},
+ {
+ "zh": "预设库 NR 模型字段损坏",
+ "src": "src/engine/PresetLibrary.cpp",
+ "zh-TW": "預設庫 NR 模型欄位損壞",
+ "en": "Corrupt NR model field in preset library",
+ "ja": "プリセットライブラリの NR モデル項目が破損しています"
+ },
{
"zh": "预设库 NR 调控参数损坏",
"src": "src/engine/PresetLibrary.cpp",
@@ -16934,76 +16969,6 @@
"zh-TW": ";預設“即時”,同時執行遊戲或其他重負載程式變慢時可改為“高”或“普通”",
"en": "; Realtime by default. If a game or other heavy program running alongside slows down, choose High or Normal",
"ja": ";既定は「リアルタイム」。同時に動かすゲームや重い処理が遅くなる場合は「高」か「通常」に変更してください"
- },
- {
- "zh": "启用失败",
- "src": "qml/NodePage.qml; qml/ProPage.qml",
- "zh-TW": "啟用失敗",
- "en": "Failed to enable",
- "ja": "有効化に失敗"
- },
- {
- "zh": "游戏模式键盘监听启动失败,未开启鼠标穿透;请退出全屏后重试",
- "src": "fan-subtitle-passthrough-20261016",
- "zh-TW": "遊戲模式鍵盤監聽啟動失敗,未開啟滑鼠穿透;請退出全螢幕後重試",
- "en": "Game mode keyboard listener could not start. Mouse passthrough is off; leave fullscreen and try again.",
- "ja": "ゲームモードのキー監視を開始できません。マウス透過はオフです。全画面を解除して再試行してください。"
- },
- {
- "zh": "游戏模式:调整画面",
- "src": "fan-subtitle-passthrough-20261016",
- "zh-TW": "遊戲模式:調整畫面",
- "en": "Game mode: adjust picture",
- "ja": "ゲームモード:画面調整"
- },
- {
- "zh": "仅在游戏模式中接管按键;支持 Ctrl、Alt、Shift 组合",
- "src": "fan-subtitle-passthrough-20261016",
- "zh-TW": "僅在遊戲模式中接管按鍵;支援 Ctrl、Alt、Shift 組合",
- "en": "Keys are captured only in game mode; Ctrl, Alt and Shift combinations are supported",
- "ja": "ゲームモード中のみキーを使用します。Ctrl、Alt、Shift の組み合わせに対応"
- },
- {
- "zh": "游戏模式:退出鼠标穿透",
- "src": "fan-subtitle-passthrough-20261016",
- "zh-TW": "遊戲模式:退出滑鼠穿透",
- "en": "Game mode: exit mouse passthrough",
- "ja": "ゲームモード:マウス透過を解除"
- },
- {
- "zh": "退出全屏,恢复普通窗口操作",
- "src": "fan-subtitle-passthrough-20261016",
- "zh-TW": "退出全螢幕,恢復一般視窗操作",
- "en": "Leave fullscreen and restore normal window controls",
- "ja": "全画面を解除して通常のウィンドウ操作に戻る"
- },
- {
- "zh": "开始后 Veyra 在这块屏幕上全屏,键鼠和手柄直接操作屏幕上的程序;%1 调整画面,%2 退出",
- "src": "fan-subtitle-passthrough-20261016",
- "zh-TW": "開始後 Veyra 在此螢幕全螢幕顯示,鍵鼠與手把直接操作螢幕上的程式;%1 調整畫面,%2 退出",
- "en": "Veyra opens fullscreen on this display. Keyboard, mouse and controller operate its programs; %1 adjusts the picture and %2 exits.",
- "ja": "この画面で全画面表示し、キーボード・マウス・コントローラーで背後のアプリを操作します。%1 で画面調整、%2 で解除。"
- },
- {
- "zh": "画面贴合游戏窗口的位置,键鼠和手柄照常操作游戏;%1 调整画面,%2 退出。独占全屏请改为无边框窗口",
- "src": "fan-subtitle-passthrough-20261016",
- "zh-TW": "畫面貼合遊戲視窗位置,鍵鼠與手把照常操作遊戲;%1 調整畫面,%2 退出。獨佔全螢幕請改為無邊框視窗",
- "en": "The picture follows the game window position. Use the keyboard, mouse and controller normally; %1 adjusts the picture and %2 exits. Use borderless mode instead of exclusive fullscreen.",
- "ja": "ゲームウィンドウの位置に画面を合わせます。通常どおり操作し、%1 で画面調整、%2 で解除。排他全画面ではなくボーダーレスにしてください。"
- },
- {
- "zh": "全屏(双击画面 / F11)· 全屏后按 %1 打开快速调节",
- "src": "fan-subtitle-passthrough-20261016",
- "zh-TW": "全螢幕(雙擊畫面 / F11)· 全螢幕後按 %1 開啟快速調整",
- "en": "Fullscreen (double-click / F11) · Press %1 for quick adjustments",
- "ja": "全画面(ダブルクリック / F11)· %1 でクイック調整"
- },
- {
- "zh": "%1 关闭",
- "src": "fan-subtitle-passthrough-20261016",
- "zh-TW": "%1 關閉",
- "en": "%1 to close",
- "ja": "%1 で閉じる"
}
]
}
diff --git a/include/veyra/engine/EffectChain.h b/include/veyra/engine/EffectChain.h
index cc6ad1ba..2b64cb8f 100644
--- a/include/veyra/engine/EffectChain.h
+++ b/include/veyra/engine/EffectChain.h
@@ -49,7 +49,7 @@ constexpr std::string_view effectTypeName(EffectType type) {
struct ChainNrParams {
NrSettings model{};
ResidualSettings residual{};
- NrRuntime runtime = NrRuntime::Original;
+ NrRuntime runtime = NrRuntime::Ampere;
bool temporal = false; // motion-reprojected residual stabilization
bool lowLatencyPairing = false; // this layer may run before SR (preview only)
// Anti-flicker tier, only meaningful when `temporal` is set. Flow is the
diff --git a/include/veyra/engine/EnhancementSettings.h b/include/veyra/engine/EnhancementSettings.h
index f1f77e0b..d5a5807a 100644
--- a/include/veyra/engine/EnhancementSettings.h
+++ b/include/veyra/engine/EnhancementSettings.h
@@ -88,17 +88,17 @@ constexpr std::wstring_view captureAudioIngressName(CaptureAudioIngress mode) {
}
return L"自动(优先 PCM,必要时位流解码)";
}
-// The original slot (0) became Lecram in 2.0.0. Give the restored NVIDIA
-// binary a new value so existing presets keep selecting the same DLL.
+// Keep retired 0/1 IDs decodable; new builds migrate them to the SF slot.
+// 3 remains the explicitly selected NVIDIA original, 4 the AMD backend.
enum class NrRuntime { Original = 0, Community = 1, Ampere = 2, NvidiaOriginal = 3, LmxxfAmd = 4 };
constexpr bool validNrRuntime(NrRuntime runtime) {
return runtime == NrRuntime::Original || runtime == NrRuntime::Community ||
runtime == NrRuntime::Ampere || runtime == NrRuntime::NvidiaOriginal || runtime == NrRuntime::LmxxfAmd;
}
-// Persisted value 1 selected the retired RTX40 DLL. Never load that DLL in
-// current builds; preserve 0 (Lecram) and 2 (SF compatible) as explicit user choices.
+// Lecram and the older RTX40 community DLL are no longer packaged. Explicit
+// NVIDIA-original and AMD choices survive migration; no DLL hash loading lock.
constexpr NrRuntime currentNrRuntime(NrRuntime runtime) {
- return runtime == NrRuntime::Community ? NrRuntime::Ampere : runtime;
+ return runtime == NrRuntime::Original || runtime == NrRuntime::Community ? NrRuntime::Ampere : runtime;
}
constexpr std::string_view nrRuntimeName(NrRuntime runtime) {
switch(runtime) {
@@ -141,8 +141,14 @@ constexpr std::string_view opticalFlowBackendName(OpticalFlowBackend backend) {
struct NrSettings {
float intensity=1,tone=1,structure=1,skin=-1;
int32_t style=0,autoMask=0,uiCorrection=0;
+ bool performance=true; // SF 310.9.16: preset B; false selects legacy A.
bool operator==(const NrSettings&) const = default;
};
+// Create-time I32 contract, verified against both embedded models in the
+// user-provided 310.9.16 runtime. Original/AMD keep their previous parameters.
+constexpr int32_t nrRenderPreset(NrRuntime runtime,const NrSettings& model) {
+ return currentNrRuntime(runtime)==NrRuntime::Ampere ? (model.performance?2:1) : 0;
+}
struct NrCorrectionSettings {
bool enabled=false,automatic=true;
// Manual values survive switching automatic control on and off.
@@ -189,7 +195,7 @@ struct ResidualSettings {
struct NrLayerSettings {
NrSettings model{};
ResidualSettings residual{};
- NrRuntime runtime=NrRuntime::Original;
+ NrRuntime runtime=NrRuntime::Ampere;
bool temporal=false,lowLatencyPairing=false,enabled=false;
// The tier only applies when `temporal` is set; `temporal=false` forces Off.
// Kept as a separate field so an older preset that only knew the boolean
@@ -236,7 +242,7 @@ struct EnhancementSettings {
ProtectionSettings protection;
bool nr=false,sr=false;
bool lowLatency=false; // preview only: NR before SR, opt-in
- NrRuntime nrRuntime=NrRuntime::Original;
+ NrRuntime nrRuntime=NrRuntime::Ampere;
bool nrTemporal=false; // optional motion-reprojected residual stabilization
// Which anti-flicker tier the temporal pass runs, for the flat (non-list)
// path. Ignored when nrTemporal is false.
@@ -273,12 +279,14 @@ struct EnhancementSettings {
}
bool sameNrTopology(const EnhancementSettings& other) const {
if(nrLayerCount!=other.nrLayerCount)return false;
+ if(nrRenderPreset(nrRuntime,model)!=nrRenderPreset(other.nrRuntime,other.model))return false;
if(residual.correction.enabled!=other.residual.correction.enabled||usesNrTemporal()!=other.usesNrTemporal())return false;
for(uint32_t i=0;i<nrLayerCount&&i<nrLayers.size();++i){
const auto& a=nrLayers[i]; const auto& b=other.nrLayers[i];
if(a.enabled!=b.enabled||a.temporal!=b.temporal||a.usesTemporal()!=b.usesTemporal()||
a.residual.correction.enabled!=b.residual.correction.enabled||a.runtime!=b.runtime||
- a.lowLatencyPairing!=b.lowLatencyPairing||a.sizePolicy!=b.sizePolicy)return false;
+ a.lowLatencyPairing!=b.lowLatencyPairing||a.sizePolicy!=b.sizePolicy||
+ nrRenderPreset(a.runtime,a.model)!=nrRenderPreset(b.runtime,b.model))return false;
}
return true;
}
@@ -368,11 +376,15 @@ struct EnhancementSettings {
active.nrAntiFlicker=defaults.nrAntiFlicker;active.nrPolicy=defaults.nrPolicy;
active.nrMotion=defaults.nrMotion;active.nrLayers=defaults.nrLayers;
}else{
+ active.nrRuntime=currentNrRuntime(active.nrRuntime);
+ if(active.nrRuntime!=NrRuntime::Ampere)active.model.performance=defaults.model.performance;
if(!active.residual.correction.enabled)active.residual.correction={};
if(!active.nrTemporal)active.nrAntiFlicker=defaults.nrAntiFlicker;
for(size_t i=0;i<active.nrLayers.size();++i){
auto& layer=active.nrLayers[i];
if(i>=nrLayerCount||!layer.enabled){layer={};continue;}
+ layer.runtime=currentNrRuntime(layer.runtime);
+ if(layer.runtime!=NrRuntime::Ampere)layer.model.performance=defaults.model.performance;
if(!layer.residual.correction.enabled)layer.residual.correction={};
if(!layer.temporal)layer.antiFlicker=NrAntiFlicker::Flow;
}
diff --git a/include/veyra/engine/RecentGraphCache.h b/include/veyra/engine/RecentGraphCache.h
index 0d15a6ef..df3a2bd8 100644
--- a/include/veyra/engine/RecentGraphCache.h
+++ b/include/veyra/engine/RecentGraphCache.h
@@ -32,7 +32,10 @@ public:
settings.revision=0;
Key result{std::move(settings),std::move(order),desc.sourceWidth,desc.sourceHeight,desc.workWidth,desc.workHeight,
desc.nrWidth,desc.nrHeight,desc.hdrInput,desc.hdrOutput,desc.rgbInput,desc.captureBitDepth,desc.packedInput,desc.yuy2Input,desc.runtimeAbsPath};
- std::error_code error;const auto module=std::filesystem::path(desc.runtimeAbsPath)/L"nvngx_dlssnr.dll";
+ auto module=std::filesystem::path(desc.runtimeAbsPath);
+ if(currentNrRuntime(desc.nrRuntime)==NrRuntime::Ampere)module/=L"nr-ampere";
+ else if(currentNrRuntime(desc.nrRuntime)==NrRuntime::NvidiaOriginal)module/=L"nr-original";
+ module/=L"nvngx_dlssnr.dll";std::error_code error;
result.nrFileBytes=std::filesystem::file_size(module,error);
if(error)result.nrFileBytes=0;
const auto time=std::filesystem::last_write_time(module,error);
@@ -42,7 +45,7 @@ public:
static bool eligible(const pipeline::EnhanceGraphDesc& desc){
return desc.enableNr&&!desc.enableSr&&!desc.enableFg&&!desc.hdrInput&&!desc.hdrOutput&&!desc.videoHdr.enabled&&!desc.color.enabled&&desc.additionalColorCount==0&&
desc.nrHoldStrength==0&&!desc.noFeatures&&!desc.noNgx&&!desc.stillImage&&!desc.nrAutoPoolLayer&&
- desc.nrRuntime==NrRuntime::Original&&!desc.nrTemporal&&desc.nrLayersModel.size()<=1&&
+ currentNrRuntime(desc.nrRuntime)==NrRuntime::Ampere&&!desc.nrTemporal&&desc.nrLayersModel.size()<=1&&
std::none_of(desc.nrLayersTemporal.begin(),desc.nrLayersTemporal.end(),[](bool value){return value;})&&
!desc.runtimeNodeOrder&&(!desc.fixedExecutionPlan||(
desc.fixedExecutionPlan->stepCount==1&&desc.fixedExecutionPlan->steps[0].type==EffectType::NrEnhance));
diff --git a/include/veyra/ngx/NrArchitecturePolicy.h b/include/veyra/ngx/NrArchitecturePolicy.h
index b728ad44..7bfb3ff7 100644
--- a/include/veyra/ngx/NrArchitecturePolicy.h
+++ b/include/veyra/ngx/NrArchitecturePolicy.h
@@ -6,7 +6,8 @@ namespace veyra::ngx {
// session win. Unknown/professional adapters are not guessed from a PCI range.
constexpr bool preferSfNr(uint32_t vendorId, std::wstring_view description) {
return vendorId == 0x10DE && (description.find(L"RTX 20") != description.npos ||
- description.find(L"RTX 30") != description.npos || description.find(L"RTX 40") != description.npos);
+ description.find(L"RTX 30") != description.npos || description.find(L"RTX 40") != description.npos ||
+ description.find(L"RTX 50") != description.npos);
}
// The experimental profile only changes a successful query for the exact
// selected Ampere adapter. Other GPUs and driver failures retain their result.
diff --git a/include/veyra/pipeline/EnhanceGraph.h b/include/veyra/pipeline/EnhanceGraph.h
index e1d6d16c..b81fed80 100644
--- a/include/veyra/pipeline/EnhanceGraph.h
+++ b/include/veyra/pipeline/EnhanceGraph.h
@@ -87,7 +87,7 @@ struct EnhanceGraphDesc {
bool enableSr = false; // upscale source -> work extent (1:1 bypass otherwise)
bool enableNr = true;
bool nrBeforeSr = false;
- engine::NrRuntime nrRuntime=engine::NrRuntime::Original;
+ engine::NrRuntime nrRuntime=engine::NrRuntime::Ampere;
bool nrTemporal=false;
engine::NrAntiFlicker nrAntiFlicker=engine::NrAntiFlicker::Flow;
bool enableFg = true;
diff --git a/include/veyra/ui/PlayerUiFacade.h b/include/veyra/ui/PlayerUiFacade.h
index 5997b9b3..5f1dcdfc 100644
--- a/include/veyra/ui/PlayerUiFacade.h
+++ b/include/veyra/ui/PlayerUiFacade.h
@@ -119,7 +119,7 @@ private:
veyra::engine::EnhancementSettings pending_{};
uint64_t pendingFgRevision_=0;
uint64_t pendingNrRevision_=0;
- veyra::engine::NrRuntime requestedNrRuntime_=veyra::engine::NrRuntime::Original;
+ veyra::engine::NrRuntime requestedNrRuntime_=veyra::engine::NrRuntime::Ampere;
veyra::engine::FrameGenerationBackend requestedFgBackend_=veyra::engine::FrameGenerationBackend::Dlss;
uint32_t requestedFgMultiplier_=1;
uint32_t requestedVfgQuality_=1;
diff --git a/qml/Veyra/NrLayerEditor.qml b/qml/Veyra/NrLayerEditor.qml
index d3f671eb..5548e38a 100644
--- a/qml/Veyra/NrLayerEditor.qml
+++ b/qml/Veyra/NrLayerEditor.qml
@@ -85,11 +85,24 @@ ColumnLayout {
objectName: "nr-runtime"
value: editor.layerData.runtime === 4 ? qsTr("RX 9000 · lmxxf(实验)")
: editor.layerData.runtime === 3 ? qsTr("RTX 50 · NVIDIA 原版")
- : editor.layerData.runtime === 2 ? "RTX 20–50 · SF-v2" : "RTX 50 · Lecram"
- options: veyra.nrRuntimeChoices || [{id:"0",label:"RTX 50 · Lecram"},{id:"2",label:"RTX 20–50 · SF-v2"},{id:"3",label:qsTr("RTX 50 · NVIDIA 原版")},{id:"4",label:qsTr("RX 9000 · lmxxf(实验)")}]
+ : "RTX 20–50 · SF 310.9.16"
+ options: veyra.nrRuntimeChoices || [{id:"2",label:"RTX 20–50 · SF 310.9.16"},{id:"3",label:qsTr("RTX 50 · NVIDIA 原版")},{id:"4",label:qsTr("RX 9000 · lmxxf(实验)")}]
onPicked: id => editor.edited(editor.layerData.index, "runtime", Number(id))
}
}
+ VRow {
+ objectName: "nr-performance-row"
+ visible: !editor.amdNr
+ label: qsTr("启用性能优化版")
+ hint: qsTr("开启使用新版模型 B;关闭使用旧版模型 A。切换会重建 NR,画面可能有所不同。")
+ enabled: editor.layerData.runtime === 2 && Support.available(veyra, "nr2")
+ opacity: enabled ? 1 : 0.4
+ VSwitch {
+ objectName: "nr-performance"
+ checked: editor.layerData.performance ?? true
+ onToggled: checked => editor.edited(editor.layerData.index, "performance", checked ? 1 : 0)
+ }
+ }
VRow {
label: qsTr("NR 运动来源")
enabled: Support.available(veyra, "nr" + editor.layerData.runtime)
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index 76235290..82b994d5 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -759,7 +759,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
!nrAutoPoolUnavailable&&selected.settings.activeNrLayerCount()<=2&&
!isCapture&&!isImage&&desc.enableNr&&!desc.enableSr&&!desc.enableFg&&
!desc.hdrWorking()&&!desc.videoHdr.enabled&&!desc.color.enabled&&!desc.additionalColorCount&&!desc.runtimeNodeOrder&&desc.nrHoldStrength==0&&
- desc.nrRuntime==NrRuntime::Original&&desc.opticalFlowBackend==OpticalFlowBackend::Nvidia&&
+ currentNrRuntime(desc.nrRuntime)==NrRuntime::Ampere&&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&&
diff --git a/src/engine/ExportJobManager.cpp b/src/engine/ExportJobManager.cpp
index 1b3e6dee..344a8319 100644
--- a/src/engine/ExportJobManager.cpp
+++ b/src/engine/ExportJobManager.cpp
@@ -30,7 +30,7 @@ struct Shared {
// chain is fixed-capacity and trivially copyable, so it can cross the
// process boundary; a worker that sees another version refuses the job
// instead of reading a mismatched layout.
- DWORD signature=magic,version=8,bytes=sizeof(Shared); // 8: VFG quality in the immutable settings snapshot
+ DWORD signature=magic,version=9,bytes=sizeof(Shared); // 9: per-NR performance model in the immutable snapshot
EnhancementSettings settings;
EffectChain chain;
wchar_t input[32768]{},output[32768]{},temporary[32768]{};
@@ -254,7 +254,7 @@ int runExportWorker(HANDLE mapping){
if(!s){log::error("export-worker",std::format("mapping failed win32={}",GetLastError()));CloseHandle(mapping);return 1;}
auto reject=[&](const wchar_t* reason){
log::error("export-worker",utf8(reason));
- if(s->signature==magic&&s->version==8&&s->bytes==sizeof(Shared)){
+ if(s->signature==magic&&s->version==9&&s->bytes==sizeof(Shared)){
if(InterlockedCompareExchange(&s->messageLock,1,0)==0){
wcsncpy_s(s->message,reason,_TRUNCATE);
InterlockedExchange(&s->messageLock,0);
@@ -263,7 +263,7 @@ int runExportWorker(HANDLE mapping){
}
UnmapViewOfFile(s);CloseHandle(mapping);return 1;
};
- if(s->signature!=magic||s->version!=8||s->bytes!=sizeof(Shared))return reject(L"导出任务通信协议不匹配");
+ if(s->signature!=magic||s->version!=9||s->bytes!=sizeof(Shared))return reject(L"导出任务通信协议不匹配");
if(const auto error=s->settings.validate();!error.empty()){
log::error("export-worker",std::format("invalid frozen settings: {}",error));
return reject(L"导出任务的增强参数无效,请查看任务日志中的具体参数错误");
diff --git a/src/engine/PresetLibrary.cpp b/src/engine/PresetLibrary.cpp
index 8a4fccd7..f6df79c7 100644
--- a/src/engine/PresetLibrary.cpp
+++ b/src/engine/PresetLibrary.cpp
@@ -93,6 +93,7 @@ void PresetLibrary::addBuiltins() {
bool PresetLibrary::load() {
error_.clear();
addBuiltins();
+ const auto directNr=std::filesystem::path(path_).concat(L".nr-model");
const auto directDlss=std::filesystem::path(path_).concat(L".dlss-sr");
const auto directHdr=std::filesystem::path(path_).concat(L".hdr-output");
const auto directFlow=std::filesystem::path(path_).concat(L".flow");
@@ -120,6 +121,9 @@ bool PresetLibrary::load() {
const auto dlssPath=std::filesystem::path(path_).concat(L".dlss-sr");
if(std::filesystem::exists(directDlss))path_=directDlss;
else if(std::filesystem::exists(dlssPath))path_=dlssPath;
+ const auto nrPath=std::filesystem::path(path_).concat(L".nr-model");
+ if(std::filesystem::exists(directNr))path_=directNr;
+ else if(std::filesystem::exists(nrPath))path_=nrPath;
if (!std::filesystem::exists(path_)) return true;
std::error_code ec;
const auto size = std::filesystem::file_size(path_, ec);
@@ -214,6 +218,8 @@ bool PresetLibrary::save() {
// Match PresetStore: never replace a valid file with one our reader rejects.
if (!parse(data, checked, checkedDefault, error_)) return false;
// Opting into a new model must leave the older build's library intact.
+ if(data.starts_with("VEYRA_PRESET_LIBRARY 13")&&!path_.wstring().ends_with(L".nr-model"))path_=std::filesystem::path(path_).concat(L".nr-model");
+ if(!path_.wstring().ends_with(L".nr-model")){
if(data.starts_with("VEYRA_PRESET_LIBRARY 12")&&!path_.wstring().ends_with(L".dlss-sr"))path_=std::filesystem::path(path_).concat(L".dlss-sr");
if(!path_.wstring().ends_with(L".dlss-sr")){
if(data.starts_with("VEYRA_PRESET_LIBRARY 11")&&!path_.wstring().ends_with(L".hdr-output"))path_=std::filesystem::path(path_).concat(L".hdr-output");
@@ -232,6 +238,7 @@ bool PresetLibrary::save() {
}
}
}
+ }
std::error_code ec;
std::filesystem::create_directories(path_.parent_path(), ec);
const auto temporary = std::filesystem::path(path_).concat(L".tmp");
@@ -658,7 +665,13 @@ std::string PresetLibrary::encodeEntries(const std::vector<PresetEntry>& entries
const auto& c=*e.nodeConfiguration;
return c.dlssSrModel!=0||(c.editor&&c.editor->globals&&c.editor->globals->dlssSrModel!=0);
});
- const int version=std::max(minimumVersion, dlss?12:tuning?11:flow?10:correctionExtended?9:correction?8:vfg?7:rendering?6:globals?5:editor?4:layerSizes?3:multi?2:1);
+ const auto oldModel=[](const EffectChain& chain){
+ return std::any_of(chain.nodes.begin(),chain.nodes.begin()+chain.nodeCount,[](const auto& n){
+ return n.type==EffectType::NrEnhance&&!n.nr.model.performance;});};
+ const bool nrModel=std::any_of(entries_.begin(),entries_.end(),[&](const auto& e){
+ return oldModel(e.chain)||(e.nodeConfiguration&&(oldModel(e.nodeConfiguration->chain)||
+ (e.nodeConfiguration->editor&&oldModel(e.nodeConfiguration->editor->nodes))));});
+ const int version=std::max(minimumVersion, nrModel?13:dlss?12:tuning?11:flow?10:correctionExtended?9:correction?8:vfg?7:rendering?6:globals?5:editor?4:layerSizes?3:multi?2:1);
o << "VEYRA_PRESET_LIBRARY " << version << '\n' << std::quoted(utf8(defaultName_)) << ' ' << entries_.size() << '\n';
for (const auto& e : entries_) {
o << std::quoted(utf8(e.name)) << ' ' << std::quoted(utf8(e.note)) << ' '
@@ -684,6 +697,7 @@ std::string PresetLibrary::encodeEntries(const std::vector<PresetEntry>& entries
<< n.videoHdr.middleGray << ' ' << n.videoHdr.peakNits << ' ';
if(version>=3)o<<int(n.nr.sizePolicy)<<' ';
if(version>=8){writeNrCorrection(o,n.nr.residual.correction,version>=9);o<<' ';}
+ if(version>=13)o<<n.nr.model.performance<<' ';
if (version>=2 && n.type == EffectType::Color) {
writeColorSettings(o, n.color, utf8(n.color.lutNameString()));
o << ' ';
@@ -722,7 +736,7 @@ bool PresetLibrary::parse(const std::string& data, std::vector<PresetEntry>& out
std::string magic, quoted;
int version = 0;
size_t count = 0;
- const int allowedVersion=maxVersion>0?std::min(maxVersion,12):12;
+ const int allowedVersion=maxVersion>0?std::min(maxVersion,13):13;
if (!(in >> magic >> version) || magic != "VEYRA_PRESET_LIBRARY" || version < 1 || version > allowedVersion) { error = L"预设库格式或版本不支持"; return false; }
if (!(in >> std::quoted(quoted) >> count) || count > 64) { error = L"预设库条目数非法"; return false; }
def = wide(quoted);
@@ -781,6 +795,9 @@ bool PresetLibrary::parse(const std::string& data, std::vector<PresetEntry>& out
node.nr.sizePolicy=static_cast<pipeline::NrSizePolicy>(size);
}
if(version>=8&&!readNrCorrection(in,node.nr.residual.correction,version>=9)){error=L"预设库 NR 调控参数损坏";return false;}
+ if(version>=13){int performance=0;
+ if(!(in>>performance)||performance<0||performance>1){error=L"预设库 NR 模型字段损坏";return false;}
+ node.nr.model.performance=performance!=0;}
if (version >= 2 && node.type == EffectType::Color) {
std::string lut;
if (!readColorSettings(in, node.color, lut, 19) ||
@@ -861,7 +878,12 @@ std::string ChainSessionStore::encode(const ChainSession& session) {
const bool dlss=std::any_of(session.configurations.begin(),session.configurations.end(),[](const auto& c){
return c.dlssSrModel!=0||(c.editor&&c.editor->globals&&c.editor->globals->dlssSrModel!=0);
});
- const int version = dlss?7:tuning?6:vfg?5:rendering?4:editor ? (editor->globals ? 3 : 2) : 1;
+ const auto oldModel=[](const EffectChain& chain){
+ return std::any_of(chain.nodes.begin(),chain.nodes.begin()+chain.nodeCount,[](const auto& n){
+ return n.type==EffectType::NrEnhance&&!n.nr.model.performance;});};
+ const bool nrModel=std::any_of(session.configurations.begin(),session.configurations.end(),[&](const auto& c){
+ return oldModel(c.chain)||(c.editor&&oldModel(c.editor->nodes));});
+ const int version = nrModel?8:dlss?7:tuning?6:vfg?5:rendering?4:editor ? (editor->globals ? 3 : 2) : 1;
out << "VEYRA_CHAIN_SESSION " << version << '\n' << int(session.active) << ' ' << session.initialized[0] << ' ' << session.initialized[1];
if(version>=4)out<<' '<<bool(editor);out<<'\n';
std::vector<PresetEntry> entries;
@@ -915,7 +937,7 @@ bool ChainSessionStore::decode(const std::string& data, ChainSession& session, b
std::istringstream in(data); in.imbue(std::locale::classic());
std::string magic, body; int version = 0, active = 0, list = 0, node = 0;
if (!(in >> magic >> version >> active >> list >> node) || magic != "VEYRA_CHAIN_SESSION" ||
- (version < 1 || version > 7) || active < 0 || active > 1 || list != 1 || node < 0 || node > 1) return false;
+ (version < 1 || version > 8) || active < 0 || active > 1 || list != 1 || node < 0 || node > 1) return false;
int hasEditor=version>=2?1:0;
if(version>=4&&(!(in>>hasEditor)||hasEditor<0||hasEditor>1))return false;
ChainSession parsed; parsed.active = ChainMode(active); parsed.initialized = {true, node != 0};
@@ -930,7 +952,7 @@ bool ChainSessionStore::decode(const std::string& data, ChainSession& session, b
}
if (!(in >> std::quoted(body))) return false;
std::vector<PresetEntry> entries; std::wstring def, error;
- if (!PresetLibrary::parse(body, entries, def, error, nullptr, true, 11) || entries.size() != 2 || !def.empty()) return false;
+ if (!PresetLibrary::parse(body, entries, def, error, nullptr, true, version>=8?13:11) || entries.size() != 2 || !def.empty()) return false;
for (size_t i = 0; i < entries.size(); ++i) {
if (entries[i].kind != ChainMode(i)) return false;
parsed.configurations[i].chain = entries[i].chain;
@@ -964,7 +986,7 @@ bool ChainSessionStore::decode(const std::string& data, ChainSession& session, b
}
if (!(in >> std::quoted(body))) return false;
entries.clear(); def.clear(); error.clear();
- if (!PresetLibrary::parse(body, entries, def, error, nullptr, true, 11) || entries.size() != 1 ||
+ if (!PresetLibrary::parse(body, entries, def, error, nullptr, true, version>=8?13:11) || entries.size() != 1 ||
!def.empty() || entries[0].kind != ChainMode::Node || entries[0].chain.nodeCount != count) return false;
editor->nodes = std::move(entries[0].chain);
for (uint32_t i = 0; i < count; ++i) {
@@ -981,6 +1003,7 @@ bool ChainSessionStore::decode(const std::string& data, ChainSession& session, b
}
bool ChainSessionStore::load(ChainSession& session) {
+ const auto directNr=std::filesystem::path(path_).concat(L".nr-model");
const auto directDlss=std::filesystem::path(path_).concat(L".dlss-sr");
error_.clear();
std::error_code ec;
@@ -1006,6 +1029,9 @@ bool ChainSessionStore::load(ChainSession& session) {
const auto dlssPath=std::filesystem::path(path_).concat(L".dlss-sr");
if(std::filesystem::exists(directDlss,ec))path_=directDlss;
else if(std::filesystem::exists(dlssPath,ec))path_=dlssPath;
+ const auto nrPath=std::filesystem::path(path_).concat(L".nr-model");
+ if(std::filesystem::exists(directNr,ec))path_=directNr;
+ else if(std::filesystem::exists(nrPath,ec))path_=nrPath;
const bool exists = std::filesystem::exists(path_, ec);
if (!exists && !ec) return true;
const auto size = std::filesystem::file_size(path_, ec);
@@ -1035,6 +1061,8 @@ bool ChainSessionStore::save(const ChainSession& session) {
const auto data = encode(session);
ChainSession checked;
if (!decode(data, checked)) { error_ = L"模式会话编码校验失败,未保存"; return false; }
+ if(data.starts_with("VEYRA_CHAIN_SESSION 8")&&!path_.wstring().ends_with(L".nr-model"))path_=std::filesystem::path(path_).concat(L".nr-model");
+ if(!path_.wstring().ends_with(L".nr-model")){
if(data.starts_with("VEYRA_CHAIN_SESSION 7")&&!path_.wstring().ends_with(L".dlss-sr"))path_=std::filesystem::path(path_).concat(L".dlss-sr");
if(!path_.wstring().ends_with(L".dlss-sr")){
if(data.starts_with("VEYRA_CHAIN_SESSION 6")&&!path_.wstring().ends_with(L".hdr-output"))path_=std::filesystem::path(path_).concat(L".hdr-output");
@@ -1053,6 +1081,7 @@ bool ChainSessionStore::save(const ChainSession& session) {
}
}
}
+ }
std::error_code ec;
if (!path_.parent_path().empty()) std::filesystem::create_directories(path_.parent_path(), ec);
if (ec) { error_ = L"模式会话目录无法创建"; return false; }
diff --git a/src/engine/PresetStore.cpp b/src/engine/PresetStore.cpp
index 8efca3b6..6e683457 100644
--- a/src/engine/PresetStore.cpp
+++ b/src/engine/PresetStore.cpp
@@ -43,13 +43,17 @@ std::string PresetStore::serialize()const{
// v31 appends the DLSS SR model (DLSS 4.5 presets). Written only when an
// entry uses a 4.5 model, and then every older optional block is written too.
const bool dlss=std::any_of(entries_.begin(),entries_.end(),[](const auto& p){return p.settings.dlssSrModel!=0;});
- const bool fullSchema=fsr4||higher||rendering||vfg||correction||dlss;
- const bool correctionExtended=dlss||std::any_of(entries_.begin(),entries_.end(),[](const auto& p){
+ const bool nrModel=std::any_of(entries_.begin(),entries_.end(),[](const auto& p){
+ if(!p.settings.model.performance)return true;
+ for(unsigned i=0;i<p.settings.nrLayerCount;++i)if(!p.settings.nrLayers[i].model.performance)return true;
+ return false;});
+ const bool fullSchema=fsr4||higher||rendering||vfg||correction||dlss||nrModel;
+ const bool correctionExtended=nrModel||dlss||std::any_of(entries_.begin(),entries_.end(),[](const auto& p){
if(p.settings.residual.correction.extendedControls())return true;
for(unsigned i=0;i<p.settings.nrLayerCount;++i)if(p.settings.nrLayers[i].residual.correction.extendedControls())return true;
return false;});
// v26 introduces appended resolution IDs; old readers reject this schema.
- std::ostringstream o;o.imbue(std::locale::classic());o<<std::setprecision(std::numeric_limits<float>::max_digits10)<<"VEYRA_PRESETS "<<(dlss?31:correctionExtended?30:correction?29:vfg?28:rendering?27:higher?26:fsr4?25:hold?24:stack?23:multi?22:21)<<'\n'<<std::quoted(utf8(default_))<<' '<<entries_.size()<<'\n';
+ std::ostringstream o;o.imbue(std::locale::classic());o<<std::setprecision(std::numeric_limits<float>::max_digits10)<<"VEYRA_PRESETS "<<(nrModel?32:dlss?31:correctionExtended?30:correction?29:vfg?28:rendering?27:higher?26:fsr4?25:hold?24:stack?23:multi?22:21)<<'\n'<<std::quoted(utf8(default_))<<' '<<entries_.size()<<'\n';
for(auto& p:entries_){const auto& s=p.settings;const auto& m=s.model;const auto& r=s.residual;o<<std::quoted(utf8(p.name))<<' '<<m.intensity<<' '<<m.tone<<' '<<m.structure<<' '<<m.skin<<' '<<m.style<<' '<<m.autoMask<<' '<<m.uiCorrection<<' '<<r.total<<' '<<r.darken<<' '<<r.brighten<<' '<<r.color<<' '<<r.luminance<<' '<<s.nr<<' '<<s.sr<<' '<<s.multiplier<<' '<<int(s.nrPolicy)<<' '<<int(s.flow)<<' '<<int(s.content)<<' '<<s.protection.enabled<<' '<<s.protection.featherPixels;for(auto q:s.protection.regions)o<<' '<<q.left<<' '<<q.top<<' '<<q.right<<' '<<q.bottom;o<<' '<<s.videoSrQuality<<' '<<int(s.frameGenerationBackend)<<' '<<int(s.srTarget)<<' '<<int(s.opticalFlowBackend)<<' '<<s.amdFlowHalfResolution<<' '<<int(s.audioSync)<<' '<<s.audioOffsetMs<<' '<<int(s.nrRuntime)<<' '<<s.captureCompatible<<' '<<s.lowLatency<<' '<<s.forceSdrPreview<<' '<<int(s.captureAudio)<<' '<<s.exportBitrateMbps<<' '<<s.captureFlipVertical<<' '<<int(s.captureBuffer)<<' ';writeColorSettings(o,s.color,utf8(s.color.lutNameString()));o<<' '<<s.videoHdr.enabled<<' '<<s.videoHdr.contrast<<' '<<s.videoHdr.saturation<<' '<<s.videoHdr.middleGray<<' '<<s.videoHdr.peakNits<<' '<<s.nrTemporal;
if(multi||fullSchema){o<<' '<<s.additionalColorCount;for(unsigned i=0;i<s.additionalColorCount;++i){o<<' ';writeColorSettings(o,s.additionalColors[i],utf8(s.additionalColors[i].lutNameString()));}}
if(stack||fullSchema){
@@ -68,19 +72,21 @@ std::string PresetStore::serialize()const{
// any entry needs it. Otherwise entries in the same file would parse
// differently.
if(hold||fullSchema)o<<' '<<s.nrHoldStrength<<' '<<s.nrHoldTolerance;
- if(rendering||vfg||correction||dlss)o<<' '<<int(s.hdrOutputMode)<<' '<<int(s.fgMotion)<<' '<<int(s.srMotion)<<' '<<int(s.nrMotion);
- if(vfg||correction||dlss)o<<' '<<s.vfgQuality;
- if(correction||dlss){
+ if(rendering||vfg||correction||dlss||nrModel)o<<' '<<int(s.hdrOutputMode)<<' '<<int(s.fgMotion)<<' '<<int(s.srMotion)<<' '<<int(s.nrMotion);
+ if(vfg||correction||dlss||nrModel)o<<' '<<s.vfgQuality;
+ if(correction||dlss||nrModel){
o<<' ';writeNrCorrection(o,s.residual.correction,correctionExtended);
for(unsigned i=0;i<s.nrLayerCount;++i){o<<' ';writeNrCorrection(o,s.nrLayers[i].residual.correction,correctionExtended);}
}
- if(dlss)o<<' '<<s.dlssSrModel;
+ if(dlss||nrModel)o<<' '<<s.dlssSrModel;
+ if(nrModel){o<<' '<<s.model.performance;
+ for(unsigned i=0;i<s.nrLayerCount;++i)o<<' '<<s.nrLayers[i].model.performance;}
o<<'\n';
}return o.str();
}
bool PresetStore::parse(const std::string& data,std::vector<UserPreset>& out,std::wstring& def){
if(data.size()>kMaxPresetBytes)return false;std::istringstream in(data);in.imbue(std::locale::classic());std::string magic,d;int version=0;size_t count=0;
- if(!(in>>magic>>version)||magic!="VEYRA_PRESETS"||(version<1||version>31)||!(in>>std::quoted(d)>>count)||count>64)return false;def=wide(d);if(!d.empty()&&def.empty())return false;
+ if(!(in>>magic>>version)||magic!="VEYRA_PRESETS"||(version<1||version>32)||!(in>>std::quoted(d)>>count)||count>64)return false;def=wide(d);if(!d.empty()&&def.empty())return false;
for(size_t i=0;i<count;++i){UserPreset p;std::string n;int policy,flow,content,nr,sr;auto& s=p.settings;auto& m=s.model;auto& r=s.residual;
if(!(in>>std::quoted(n)>>m.intensity>>m.tone>>m.structure>>m.skin>>m.style>>m.autoMask>>m.uiCorrection>>r.total>>r.darken>>r.brighten>>r.color>>r.luminance>>nr>>sr>>s.multiplier>>policy>>flow>>content))return false;
if(version>=2){int enabled;if(!(in>>enabled>>s.protection.featherPixels)||enabled<0||enabled>1)return false;s.protection.enabled=enabled!=0;
@@ -147,6 +153,9 @@ bool PresetStore::parse(const std::string& data,std::vector<UserPreset>& out,std
for(unsigned j=0;j<s.nrLayerCount;++j)if(!readNrCorrection(in,s.nrLayers[j].residual.correction,version>=30))return false;
}
if(version>=31){unsigned model=0;if(!(in>>model)||model>=kDlssSrModelCount)return false;s.dlssSrModel=model;}
+ if(version>=32){int performance=0;
+ if(!(in>>performance)||performance<0||performance>1)return false;s.model.performance=performance!=0;
+ for(unsigned j=0;j<s.nrLayerCount;++j){if(!(in>>performance)||performance<0||performance>1)return false;s.nrLayers[j].model.performance=performance!=0;}}
p.name=wide(n);if(!nameOk(p.name)||std::any_of(out.begin(),out.end(),[&](auto& a){return a.name==p.name;})||nr<0||nr>1||sr<0||sr>1)return false;
s.nr=nr;s.sr=sr;s.nrPolicy=static_cast<pipeline::NrSizePolicy>(policy);s.flow=static_cast<FlowQuality>(flow);s.content=static_cast<ContentRate>(content);
if(!s.validate().empty())return false;out.push_back(std::move(p));
diff --git a/src/engine/PreviewGpuSession.cpp b/src/engine/PreviewGpuSession.cpp
index 50dd3ec1..ed4ec163 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.activeAutoNrLayerCount()&&
+ currentNrRuntime(settings.nrRuntime)==NrRuntime::Ampere&&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.cpp
index 89c26441..93555ca0 100644
--- a/src/pipeline/EnhanceGraph.cpp
+++ b/src/pipeline/EnhanceGraph.cpp
@@ -1441,7 +1441,11 @@ bool EnhanceGraph::createNrFeature(NrInstance& layer) {
pb.setU32(p::kOutputDotWidth,nrW);pb.setU32(p::kOutputDotHeight,nrH);
pb.setU32(p::kUpscaling,0);pb.setF32(p::kScale,1.0f);pb.setF32(p::kScalingRatio,1.0f);
pb.setVoid(p::kComputeScalingRatioCallback,reinterpret_cast<void*>(&ngx::DlssNrRuntimeAdapter::scalingRatioCallback));
- pb.setI32(p::kHintRenderPreset,0);pb.setU32(p::kStdWidth,nrW);pb.setU32(p::kStdHeight,nrH);
+ const auto preset=engine::nrRenderPreset(desc_.nrRuntime,layer.model);
+ pb.setI32(p::kHintRenderPreset,preset);pb.setU32(p::kStdWidth,nrW);pb.setU32(p::kStdHeight,nrH);
+ log::info("nr-model",std::format("runtime={} preset={} performance={} internal={}x{}",
+ engine::nrRuntimeName(engine::currentNrRuntime(desc_.nrRuntime)),preset,
+ engine::currentNrRuntime(desc_.nrRuntime)==engine::NrRuntime::Ampere&&layer.model.performance,nrW,nrH));
pb.setI32(p::kPerfQualityValue,1);pb.setU32(p::kCreationNodeMask,1);pb.setU32(p::kVisibilityNodeMask,1);
auto* list=ring_.acquire(0,st);
if(!list){failedBackend_=engine::FailedBackend::Infrastructure;return false;}
@@ -1463,7 +1467,7 @@ bool EnhanceGraph::createAutoNrPool() {
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&&
- desc_.nrRuntime==engine::NrRuntime::Original&&desc_.opticalFlowBackend==engine::OpticalFlowBackend::Nvidia&&
+ engine::currentNrRuntime(desc_.nrRuntime)==engine::NrRuntime::Ampere&&desc_.opticalFlowBackend==engine::OpticalFlowBackend::Nvidia&&
context_.adapter().deviceId==0x2f04&&context_.adapter().isNvidia&&index<nrInstances_.size()&&nrInstances_.size()+4<=8&&
workW_==1920&&workH_==1080&&desc_.nrLayersExtent[index]==Extent{1920,1080}&&
std::none_of(nrInstances_.begin(),nrInstances_.end(),[](const auto& layer){return layer->temporalEnabled;});
@@ -3214,6 +3218,9 @@ bool EnhanceGraph::applySettings(const engine::EnhancementSettings& s){
if(s.nr&&desc_.enableNr){
if(s.activeNrLayerCount()!=nrInstances_.size())return false;
for(size_t i=0;i<nrInstances_.size();++i){
+ const auto& model=i<nextNr.nrLayersModel.size()?nextNr.nrLayersModel[i]:nextNr.model;
+ if(!lmxxfNr_&&engine::nrRenderPreset(s.nrRuntime,model)!=
+ engine::nrRenderPreset(desc_.nrRuntime,nrInstances_[i]->model))return false;
const bool temporal=i<nextNr.nrLayersTemporal.size()?nextNr.nrLayersTemporal[i]:nextNr.nrTemporal;
if(temporal!=nrInstances_[i]->temporalEnabled)return false;
const auto tier=i<nextNr.nrLayersAntiFlicker.size()?nextNr.nrLayersAntiFlicker[i]:nextNr.nrAntiFlicker;
diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cpp
index d880651d..317bb5ea 100644
--- a/src/ui/QmlPlayerBridge.cpp
+++ b/src/ui/QmlPlayerBridge.cpp
@@ -650,7 +650,7 @@ struct QmlPlayerBridge::Impl {
DXGI_ADAPTER_DESC1 desc{};
if(FAILED(adapter->GetDesc1(&desc))||(desc.Flags&DXGI_ADAPTER_FLAG_SOFTWARE))continue;
auto initial=facade.pendingSettings();
- initial.nrRuntime=desc.VendorId==0x1002?engine::NrRuntime::LmxxfAmd:ngx::preferSfNr(desc.VendorId,desc.Description)?engine::NrRuntime::Ampere:engine::NrRuntime::Original;
+ initial.nrRuntime=desc.VendorId==0x1002?engine::NrRuntime::LmxxfAmd:engine::NrRuntime::Ampere;
if(desc.VendorId==0x1002||desc.VendorId==0x8086){
initial.opticalFlowBackend=engine::OpticalFlowBackend::AmdFidelityFx;
initial.videoSrQuality=engine::kVideoSrFsr;
@@ -1030,10 +1030,10 @@ static QVariantMap scanEffectCapabilities() {
const bool supported = ui::hardwareSupports(hardware, gpu);
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"));
+ add("nr2", H::NvidiaNrSf, exists(nr / "nr-ampere/nvngx_dlssnr.dll"), QObject::tr("需要 NVIDIA RTX 显卡"));
+ out["nr0"]=out["nr2"]; // Retired preset ID; no retired runtime is loaded.
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"));
wchar_t systemDir[MAX_PATH]{};
@@ -1154,7 +1154,7 @@ QVariantMap QmlPlayerBridge::effectAvailability(const QString& id) const {
QVariantList QmlPlayerBridge::nrRuntimeChoices() const {
QVariantList choices;
const auto caps = effectCapabilities();
- for (const auto& entry : std::initializer_list<std::pair<int, QString>>{{0, "RTX 50 · Lecram"}, {2, "RTX 20–50 · SF"}, {3, tr("RTX 50 · NVIDIA 原版")}, {4, tr("RX 9000 · lmxxf(实验)")}}) {
+ for (const auto& entry : std::initializer_list<std::pair<int, QString>>{{2, "RTX 20–50 · SF 310.9.16"}, {3, tr("RTX 50 · NVIDIA 原版")}, {4, tr("RX 9000 · lmxxf(实验)")}}) {
const auto cap = caps.value("nr" + QString::number(entry.first)).toMap();
choices << QVariantMap{{"id", QString::number(entry.first)}, {"label", entry.second}, {"disabled", !cap.value("available").toBool()}, {"note", cap.value("reason")}};
}
@@ -5499,7 +5499,7 @@ QVariantList QmlPlayerBridge::nrLayers() const {
out<<QVariantMap{{"index",int(i)},{"enabled",node.enabled},{"sizePolicy",int(n.sizePolicy)},{"runtime",int(engine::currentNrRuntime(n.runtime))},
{"intensity",n.model.intensity},{"tone",n.model.tone},{"structure",n.model.structure},
{"skin",n.model.skin},{"style",n.model.style},{"autoMask",bool(n.model.autoMask)},
- {"uiCorrection",bool(n.model.uiCorrection)},{"total",n.residual.total},
+ {"uiCorrection",bool(n.model.uiCorrection)},{"performance",n.model.performance},{"total",n.residual.total},
{"darken",n.residual.darken},{"brighten",n.residual.brighten},
{"color",n.residual.color},{"luminance",n.residual.luminance},{"temporal",n.temporal},
{"antiFlicker",int(n.antiFlicker)},
@@ -5527,11 +5527,11 @@ QString QmlPlayerBridge::nrAutoSelectionReason(int index) const {
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||
+ if(impl_->chain.mode!=engine::ChainMode::List||engine::currentNrRuntime(s.nrRuntime)!=engine::NrRuntime::Ampere||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 tr("需 1080p SDR 文件、SF 和 NVIDIA 光流;关闭超分、补帧、抗闪烁、调色及 HDR");
return {};
}
@@ -5539,7 +5539,8 @@ bool QmlPlayerBridge::setNrLayerParameter(int index,const QString& key,double va
if(index<0||uint32_t(index)>=impl_->chain.nodeCount||
impl_->chain.nodes[index].type!=engine::EffectType::NrEnhance||!std::isfinite(value))return false;
if(key=="runtime") {
- if(value!=0&&value!=2&&value!=3&&value!=4)return false;
+ if(value!=0&&value!=1&&value!=2&&value!=3&&value!=4)return false;
+ value=int(engine::currentNrRuntime(static_cast<engine::NrRuntime>(int(value))));
const auto cap = effectCapabilities().value("nr" + QString::number(int(value))).toMap();
if (!cap.value("available").toBool()) { emit notice(cap.value("reason").toString(), true); return false; }
const auto before=impl_->chain;
@@ -5579,6 +5580,7 @@ bool QmlPlayerBridge::setNrLayerParameter(int index,const QString& key,double va
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);
+ else if(key=="performance"&&value<=1&&engine::currentNrRuntime(n.runtime)==engine::NrRuntime::Ampere)n.model.performance=value!=0;
else if(key=="temporal"&&value<=1)n.temporal=value!=0;
else if(key=="correctionEnabled"&&value<=1)n.residual.correction.enabled=value!=0;
else if(key=="correctionAuto"&&value<=1)n.residual.correction.automatic=value!=0;
diff --git a/tests/integration/NrRuntimeSwitchTests.cpp b/tests/integration/NrRuntimeSwitchTests.cpp
index 04c5c914..7d80b44f 100644
--- a/tests/integration/NrRuntimeSwitchTests.cpp
+++ b/tests/integration/NrRuntimeSwitchTests.cpp
@@ -30,13 +30,19 @@ int wmain(int argc,wchar_t** argv) {
auto check=[&](bool ok,const char* text){std::cout<<(ok?"PASS ":"FAIL ")<<text<<std::endl;failures+=!ok;return ok;};
engine.open(window,argv[1],{});
check(wait([](const auto& s){return s.frames>30&&!s.nrActive&&!s.srActive&&!s.fgActive&&s.nrEvaluated==0&&s.generated==0;}),"fresh defaults play without enhancement");
+ // GTA's intro fades to black. Use a stable natural scene for every
+ // output check so a valid black source frame is not a regression.
+ engine.seek(20);
+ check(wait([](const auto& s){return s.position>=20&&s.frames>40;}),"seek to non-black comparison interval");
int cycle=0;
- for(const auto runtime:{veyra::engine::NrRuntime::Original,veyra::engine::NrRuntime::Ampere,veyra::engine::NrRuntime::NvidiaOriginal,veyra::engine::NrRuntime::Original}) {
+ for(const auto runtime:{veyra::engine::NrRuntime::Ampere,veyra::engine::NrRuntime::Ampere,veyra::engine::NrRuntime::NvidiaOriginal,veyra::engine::NrRuntime::Ampere}) {
if(failures)break;
auto settings=engine.snapshot().desired;settings.nr=true;settings.nrRuntime=runtime;
+ settings.model.performance=cycle!=1;
+ for(auto& layer:settings.nrLayers){layer.runtime=runtime;layer.model.performance=cycle!=1;}
if(!check(engine.requestSettings(settings),"request runtime switch"))break;
const auto revision=engine.snapshot().desired.revision;
- if(!check(wait([&](const auto& s){return !s.applying&&s.applied.revision==revision&&s.applied.nrRuntime==runtime&&s.nrActive&&s.nrEvaluated>10;},25),"selected runtime produces NR output"))break;
+ if(!check(wait([&](const auto& s){return !s.applying&&s.applied.revision==revision&&s.applied.nrRuntime==runtime&&s.applied.model.performance==settings.model.performance&&s.nrActive&&s.nrEvaluated>10;},25),"selected runtime and model produce NR output"))break;
const auto path=output/(L"runtime-"+std::to_wstring(cycle++)+L".png");
engine.saveFrame(path.wstring());
check(wait([&](const auto&){return std::filesystem::exists(path)&&std::filesystem::file_size(path)>1024;}),"actual processed output saved");
diff --git a/tests/qml/QuickSmokeTests.cpp b/tests/qml/QuickSmokeTests.cpp
index db013c32..8e8541aa 100644
--- a/tests/qml/QuickSmokeTests.cpp
+++ b/tests/qml/QuickSmokeTests.cpp
@@ -22,8 +22,8 @@ public slots:
QQmlComponent snapshot(engine);
snapshot.setData(R"qml(import QtQml
QtObject {
- property var effectCapabilities: ({nr0:{available:true}})
- property var nrRuntimeChoices: [{id:"0",label:"RTX 50 · Lecram"}]
+ property var effectCapabilities: ({nr2:{available:true},nr3:{available:true},nr4:{available:true}})
+ property var nrRuntimeChoices: [{id:"2",label:"RTX 20–50 · SF 310.9.16"},{id:"3",label:"RTX 50 · NVIDIA original"}]
property var nrLayers: [{index:1}]
property int nrMotionSource: 1
property string nrAutoStatus: ""
diff --git a/tests/qml/quick/tst_components.qml b/tests/qml/quick/tst_components.qml
index cd505f4b..67397a71 100644
--- a/tests/qml/quick/tst_components.qml
+++ b/tests/qml/quick/tst_components.qml
@@ -73,7 +73,7 @@ Item {
property int lastIndex: -1
property string lastKey: ""
property var rows: [0,1,2,3].map(i => ({
- index: 2*i+1, enabled: true, runtime: 0, sizePolicy: 0, intensity: 1,
+ index: 2*i+1, enabled: true, runtime: 2, sizePolicy: 0, intensity: 1, performance: true,
tone: 1, structure: 1, skin: -1, style: 0, autoMask: false,
uiCorrection: false, total: 1, darken: 1, brighten: 1,
color: 1, luminance: 1, temporal: false, antiFlicker: 2,
@@ -500,6 +500,26 @@ Item {
compare(fixture.rows[1].correctionEnabled,false)
}
+ function test_nr_performance_model_and_disabled_original() {
+ const fixture=createTemporaryObject(nrFixture,root)
+ verify(fixture)
+ const card=findChild(fixture,"nr-card-1")
+ verify(card)
+ const row=findChild(card,"nr-performance-row")
+ const control=findChild(card,"nr-performance")
+ verify(row.visible && row.enabled && control.checked)
+ mouseClick(control)
+ compare(fixture.lastKey,"performance")
+ compare(Boolean(fixture.rows[0].performance),false)
+ const changed=fixture.rows.map(r => Object.assign({},r))
+ changed[0].runtime=3
+ fixture.rows=changed
+ verify(row.visible && !row.enabled && !control.enabled)
+ compare(control.checked,false)
+ changed[0].runtime=4
+ fixture.rows=changed.map(r => Object.assign({},r))
+ verify(!row.visible)
+ }
function test_nr_complete_parameters_and_skin_range() {
const fixture=createTemporaryObject(nrFixture,root)
verify(waitForPolish(root.Window.window))
diff --git a/tests/unit/NrModelSettingsTests.cpp b/tests/unit/NrModelSettingsTests.cpp
new file mode 100644
index 00000000..87e4fd18
--- /dev/null
+++ b/tests/unit/NrModelSettingsTests.cpp
@@ -0,0 +1,76 @@
+#include "veyra/engine/EffectChain.h"
+#include "veyra/engine/GraphDescription.h"
+#include "veyra/engine/PresetLibrary.h"
+#include "veyra/engine/PresetStore.h"
+#include "veyra/engine/ExportFeaturePolicy.h"
+#include <filesystem>
+#include <fstream>
+#include <iostream>
+
+using namespace veyra;
+using namespace veyra::engine;
+namespace {
+int failures=0;
+void check(bool ok,const char* text){std::cout<<(ok?"PASS ":"FAIL ")<<text<<std::endl;failures+=!ok;}
+std::string bytes(const std::filesystem::path& p){std::ifstream f(p,std::ios::binary);return {std::istreambuf_iterator<char>(f),{}};}
+}
+int wmain(int argc,wchar_t** argv){
+ if(argc!=2)return 2;
+ const std::filesystem::path out=argv[1];std::filesystem::create_directories(out);
+ EnhancementSettings s;s.nr=true;
+ check(s.nrRuntime==NrRuntime::Ampere&&s.model.performance&&nrRenderPreset(s.nrRuntime,s.model)==2,"fresh NVIDIA settings select SF preset B");
+ auto a=s;a.model.performance=false;
+ check(nrRenderPreset(a.nrRuntime,a.model)==1&&requiresGraphRebuild(s,a),"active SF model change rebuilds NR");
+ for(auto runtime:{NrRuntime::NvidiaOriginal,NrRuntime::LmxxfAmd}){
+ auto original=s;original.nrRuntime=runtime;auto edited=original;edited.model.performance=false;
+ check(nrRenderPreset(runtime,edited.model)==0&&!requiresGraphRebuild(original,edited)&&
+ original.sameActiveVideoParameters(edited),"original and AMD ignore the inactive performance option");
+ }
+ auto off=s;off.nr=false;auto draft=off;draft.model.performance=false;
+ check(!requiresGraphRebuild(off,draft)&&off.sameActiveVideoParameters(draft),"disabled NR model edit does not disturb playback");
+ s.nrLayerCount=2;for(auto& n:s.nrLayers){n.enabled=true;n.runtime=s.nrRuntime;}
+ a=s;a.nrLayers[1].model.performance=false;
+ check(requiresGraphRebuild(s,a),"second active NR layer model change rebuilds");
+ s.nrLayers[1].enabled=a.nrLayers[1].enabled=false;
+ check(!requiresGraphRebuild(s,a)&&s.sameActiveVideoParameters(a),"bypassed layer model is saved without a rebuild");
+ s.nrLayers[1].enabled=a.nrLayers[1].enabled=true;
+ const auto frozen=freezeExportSettings(a);EnhancementSettings round=frozen;fromChain(toChain(frozen),round);
+ check(round==frozen&&!round.nrLayers[1].model.performance,"export snapshot retains each layer's model");
+ StageRequest request;request.width=1920;request.height=1080;request.nr=true;request.exportJob=true;
+ pipeline::EnhanceGraphDesc desc;describeStages(request,frozen,desc);
+ check(desc.nrLayersModel.size()==2&&desc.nrLayersModel[0].performance&&!desc.nrLayersModel[1].performance,"export graph receives both model choices");
+ const auto storePath=out/L"legacy-store.v1";PresetStore legacy(storePath);
+ check(legacy.load()&&legacy.put(L"mixed",a)&&legacy.setDefault(0),"legacy preset store accepts mixed models");
+ PresetStore legacyRead(storePath);
+ check(bytes(storePath).starts_with("VEYRA_PRESETS 32")&&legacyRead.load()&&legacyRead.defaultSettings()==a,"legacy schema 32 round-trips all layers");
+ for(auto old:{NrRuntime::Original,NrRuntime::Community,NrRuntime::Ampere,NrRuntime::NvidiaOriginal,NrRuntime::LmxxfAmd}){
+ EnhancementSettings oldSettings;oldSettings.nr=true;oldSettings.nrRuntime=old;
+ PresetEntry entry;entry.name=L"legacy runtime";entry.chain=toChain(oldSettings);
+ std::vector<PresetEntry> decoded;std::wstring def,error;
+ check(PresetLibrary::parse(PresetLibrary::encodeEntries({entry},{}),decoded,def,error)&&decoded.size()==1&&
+ decoded[0].chain.firstOf(EffectType::NrEnhance)->nr.runtime==currentNrRuntime(old)&&
+ decoded[0].chain.firstOf(EffectType::NrEnhance)->nr.model.performance,"old runtime selection migrates without losing original or AMD");
+ }
+ const auto libraryPath=out/L"library.v1";PresetLibrary library(libraryPath);library.setIncludeBuiltins(false);
+ PresetEntry entry;entry.name=L"NR models";entry.chain=toChain(s);
+ check(library.load()&&library.put(entry),"save default B library");const auto rollback=bytes(libraryPath);
+ entry.chain=toChain(a);
+ check(library.put(entry,true)&&bytes(libraryPath)==rollback,"old-model opt-in preserves the earlier library file");
+ PresetLibrary reloaded(libraryPath);reloaded.setIncludeBuiltins(false);
+ check(reloaded.load()&&reloaded.entries().size()==1&&reloaded.entries()[0]==entry,"library schema 13 restores mixed A/B models");
+ entry.chain=toChain(s);check(library.put(entry,true),"return to B in the selected sidecar");
+ PresetLibrary again(libraryPath);again.setIncludeBuiltins(false);
+ check(again.load()&&again.entries()[0]==entry,"return to B cannot resurrect a stale A choice");
+ const auto sessionPath=out/L"session.v1";auto session=std::make_unique<ChainSession>(ChainSession::initial(s));
+ check(session->select(ChainMode::Node),"initialize separate list and node configurations");ChainSessionStore sessions(sessionPath);
+ check(sessions.save(*session),"save B session");const auto sessionRollback=bytes(sessionPath);
+ auto& node=session->configurations[1];
+ auto document=std::make_shared<NodeEditorDocument>();document->nodes=node.chain;
+ check(document->layout.initialize(document->nodes).accepted,"initialize node editor layout");
+ document->nodes.firstOf(EffectType::NrEnhance)->nr.model.performance=false;
+ node.editor=document;
+ check(sessions.save(*session)&&bytes(sessionPath)==sessionRollback,"detached editor model opts into session 8 and preserves old file");
+ auto restored=std::make_unique<ChainSession>();ChainSessionStore reader(sessionPath);
+ check(reader.load(*restored)&&*restored==*session,"session restores list, node and editor model choices independently");
+ std::cout<<"NR model settings failures="<<failures<<std::endl;return failures?1:0;
+}
diff --git a/tests/unit/PresetLibraryTests.cpp b/tests/unit/PresetLibraryTests.cpp
index c77824e7..679067f9 100644
--- a/tests/unit/PresetLibraryTests.cpp
+++ b/tests/unit/PresetLibraryTests.cpp
@@ -890,12 +890,14 @@ void testNrVariants() {
entry.color=settings.color; // v1 stores the shared colour payload outside the chain.
entry.fg={settings.multiplier,settings.frameGenerationBackend};
check(writer.load()&&writer.put(entry), "NR variant: save preset");
+ for(unsigned i=0;i<entry.chain.nodeCount;++i)entry.chain.nodes[i].nr.runtime=currentNrRuntime(entry.chain.nodes[i].nr.runtime);
PresetLibrary reader(path); reader.setIncludeBuiltins(false);
check(reader.load()&&reader.entries().size()==1&&reader.entries()[0]==entry,
"NR variant: preset retains exact DLL selection");
const auto sessionPath=scratch((L"nr-session-"+std::to_wstring(int(runtime))+L".v1").c_str());
auto session=std::make_unique<ChainSession>(ChainSession::initial(settings));
check(session->select(ChainMode::Node), "NR variant: initialize node session");
+ for(auto& c:session->configurations)for(unsigned i=0;i<c.chain.nodeCount;++i)c.chain.nodes[i].nr.runtime=currentNrRuntime(c.chain.nodes[i].nr.runtime);
ChainSessionStore store(sessionPath);
auto restored=std::make_unique<ChainSession>(ChainSession::initial({}));
check(store.save(*session)&&store.load(*restored)&&*restored==*session,
diff --git a/tests/unit/RepairPresetTests.cpp b/tests/unit/RepairPresetTests.cpp
index 14b83b5d..740fa7f9 100644
--- a/tests/unit/RepairPresetTests.cpp
+++ b/tests/unit/RepairPresetTests.cpp
@@ -128,7 +128,7 @@ bool legacyBackends(const std::filesystem::path& path) {
const auto value=store.defaultSettings();
if(value.lowLatency||value.forceSdrPreview)return false;
if(value.captureCompatible!=(version>=10))return false;
- if(value.nrRuntime!=(version>=9?NrRuntime::Ampere:NrRuntime::Original))return false;
+ if(value.nrRuntime!=NrRuntime::Ampere)return false;
const auto expectedBackend=fsr?FrameGenerationBackend::Fsr:xess?FrameGenerationBackend::XeSS:FrameGenerationBackend::Dlss;
if(value.frameGenerationBackend!=expectedBackend||value.multiplier!=multiplier||value.videoSrQuality!=2)return false;
if(version>=7&&(value.audioSync!=AudioSyncMode::Manual||value.audioOffsetMs!=137))return false;
@@ -159,9 +159,9 @@ int main(int argc,char** argv){if(argc!=2)return 2;using namespace veyra::engine
&&veyra::ngx::nrRuntimeNeedsAmpereRewrite((311u<<16)|0u,0u);
s.srTarget=veyra::pipeline::SrTarget::Uhd8K;
ok=ok&&veyra::ngx::preferSfNr(0x10DE,L"NVIDIA GeForce RTX 2080 Ti")&&veyra::ngx::preferSfNr(0x10DE,L"NVIDIA GeForce RTX 3090")
- &&veyra::ngx::preferSfNr(0x10DE,L"NVIDIA GeForce RTX 4070 SUPER")&&!veyra::ngx::preferSfNr(0x10DE,L"NVIDIA GeForce RTX 5070")
+ &&veyra::ngx::preferSfNr(0x10DE,L"NVIDIA GeForce RTX 4070 SUPER")&&veyra::ngx::preferSfNr(0x10DE,L"NVIDIA GeForce RTX 5070")
&&!veyra::ngx::preferSfNr(0x1002,L"RTX 4070")&&!veyra::ngx::preferSfNr(0x10DE,L"Unknown")
- &&currentNrRuntime(NrRuntime::Community)==NrRuntime::Ampere&&currentNrRuntime(NrRuntime::Original)==NrRuntime::Original;
+ &&currentNrRuntime(NrRuntime::Community)==NrRuntime::Ampere&&currentNrRuntime(NrRuntime::Original)==NrRuntime::Ampere;
s.audioSync=AudioSyncMode::Manual;s.audioOffsetMs=137;
s.nrRuntime=NrRuntime::Ampere;s.captureCompatible=true;s.lowLatency=true;s.forceSdrPreview=true;
s.videoHdr={true,110,80,45,800};