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++
Add DLSS 4.5 SR model selection and preset persistence
Veyra Goal Agente8300d90c2a3
diff --git a/AGENTS.md b/AGENTS.mdindex 957b7ad0..64e0327f 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -1,5 +1,7 @@# Veyra 项目 Agent 执行规则+> **2026-10-11 DLSS 4.5 SR 接手授权**:用户要求接手 Claude 最新未完成的超分接入并启动软件供测试。按 docs/DLSS45_SR_PLAN_2026-10-11.md,在 codex/dlss45-sr-handoff-20261011 从049902b继承已封存的9文件patch,完成 K/M/L 模型选择的必要 settings/NGX/graph、预设/session、bridge/QML/翻译及定向构建验收接点;此范围覆盖历史冻结。原57工作树/504脏文件由独立start保护,Claude原树不改;不派Agent、不改运行库/模型/驱动/用户配置,不改变33ms UI统计/GPU优先级,不顺手合入VFG mixed。全产物E盘,每测试≤300秒、构建≤900秒;本轮不main合并/push/Release,画质由用户验收,不把Create成功当画质提升。+> **2026-10-11 Claude修复合并完成**:已验整合tip `9c14ee2` 通过本地main功能merge `3a08ce8` 合入,完整Git树相同,随后只补收尾文档。六Claude分支、UI29e33df和退出回调竞态修复在main;26项回归、滚动clip0、卡死诊断/恢复/有界退出及普通class2 NR性能核对通过。软件CPU首次+15.09%触发守卫,倒序复测及双顺序平均+6.52%通过同一阈值,完整失败/复测数据保留,不宣传普遍性能收益。保持33ms统计、负优化回退和未实卡边界;54旧工作树/496脏文件、七来源tip及原包1626文件保持,唯main按授权更新。没有push/新包/Release/关机;最终回执reports/merge-claude-fixes-20261011/final.json。> **2026-10-11 Claude 修复本地整合**:用户明确要求将目前 Claude 分支修复合入 main。按 docs/MERGE_CLAUDE_FIXES_PLAN_2026-10-11.md,在 codex/merge-claude-fixes-20261011 从 main5ba186a 整合六个已提交的 Claude 修复分支及已验 UI29e33df;保留分支内负优化回退,只做必要冲突/生命周期适配、构建与定向回归,覆盖这些接点的历史冻结及 no-merge。通过后允许本地 main 合并,不 push/Release/打包/关机。独立 start/bundle 保护54旧工作树/496脏文件,来源分支不改;不派Agent、不改运行库/驱动/模型/真实配置,保持33ms统计和普通GPU优先级。所有产物E盘;每测试≤300秒、构建≤900秒,现场未验边界如实记录,不把各分支历史通过冒充合并验证。diff --git a/docs/DLSS45_SR_PLAN_2026-10-11.md b/docs/DLSS45_SR_PLAN_2026-10-11.mdnew file mode 100644index 00000000..12bd48b3--- /dev/null+++ b/docs/DLSS45_SR_PLAN_2026-10-11.md@@ -0,0 +1,39 @@+# DLSS 4.5 超分接手方案(2026-10-11)++用户授权:读取本机 Claude 最新聊天,接手并完成新超分接入,构建后启动软件供用户判断实际画质。本轮不合并 main、不 push、不发布,不继续做无依据的画质优化。++## 接手基线++- Claude 会话:56393e4a-57bd-464c-a461-310bf74a3ad2,最后用户要求只做接入、画质由用户测试。+- 源工作树:E:/项目/Veyra/worktrees/dlss45-sr-20261011,claude/dlss45-sr-20261011,HEAD 049902b,9 份未提交文件。+- 新工作树:E:/项目/Veyra/worktrees/dlss45-sr-handoff-20261011,codex/dlss45-sr-handoff-20261011;从相同 HEAD 应用逐字节封存的 Claude patch,原树保留。+- 独立开工保护:E:/项目/Veyra/archives/dlss45-sr-handoff-20261011/start.json、claude-unfinished.patch、claude-files。记录57个原工作树、504份脏文件;复用并 verify Claude 原 source-before.bundle,避免重复完整备份。++## 实施边界++1. 保留旧 DLSS SR 的 K 默认,显式可选 DLSS 4.5 M、L。参数名称、类型、枚举来自本机 DLSS SDK 310.7 头文件;官方 M/L 说明仅作为模型身份依据,不作为视频画质通过证明。+2. 完成已有 settings/共享图/NGX 接点,模型变更按现有生命周期重建 SR;关闭 SR 或选择 RTX Video SR/FSR 时,修改该未使用字段不能重建图。+3. 补齐旧 preset store、列表预设、节点预设、独立模式 session 和节点 draft globals 的保存/恢复/重置。新模型仅在实际使用时升级文件格式;新格式库/session 用 .dlss-sr 旁文件,旧文件保留。拒绝无效值及截断文件,不能悄悄当成 K。+4. 列表/节点页增加相同模型选择,保留既有能力判定和多语言布局。只增加必要参数入口,不改 UI 绘制频率、Timer、GPU 优先级、其它 SR/NR/FG 算法。+5. 复用已批准的本地 DLSS/runtime/模型原件,不改字节、不下载新运行库,不进入源码 Git。VFG mixed 分支按 Claude 原状态保留,不在此任务顺手整合。++## 验证与交付++- 构建所改头文件的完整依赖闭包及 GUI/相关测试,保留已验 DeckLink 和 patched FFmpeg;构建每进程最多900秒、测试每进程最多300秒。+- 定向验证参数迁移、K/M/L 保存/恢复、List/Node 独立、节点草稿、预设应用、关闭项编辑不重建。+- 真实 RTX 5070 调用 K/M/L,各一次短测 1080p→4K,核对 Create/Evaluate/Release 返回值、非黑输出及切换恢复;不以像素变化或截图宣称画质提升,不做压力测试。+- 独立运行目录硬链接复用现有包依赖,写入新 EXE/QML 时先换新文件,禁止修改链接指向的原件。独立 --data-dir、TEMP/TMP/CUDA cache;不碰用户配置或已运行的用户程序。+- 验证后启动正式构建供用户测试,保留可点击 EXE 路径、日志、简短操作说明。每测试类型不无故重复;失败/修复如实留证。+- WORKLOG/报告记录实际命令、结果、产物、未验证边界;最终 protect.py verify 核对原57工作树及 Claude patch 没被改变。++## 公开依据++- https://developer.nvidia.com/blog/nvidia-dlss-4-5-delivers-super-resolution-upgrades-and-new-dynamic-multi-frame-generation/+- https://github.com/NVIDIA/DLSS/releases+- 本机 nvsdk_ngx_defs.h / nvsdk_ngx_helpers.h:K=11、L=12、M=13,unsigned render-preset hints。++实际画质和各型号性能待用户测试;创建成功只证明接口执行,运行库提供的是 preset hint,不假称能读取未公开的内部模型状态。++## 执行结果++接入、增量构建、配置回归、三模型实际GPU出图及生产列表/节点界面切换、重启恢复均已完成。详见 `docs/DLSS45_SR_REPORT_2026-10-11.md`;其中首次K冷编译触发看门狗提示后恢复,以及三项测试夹具错误均保留原日志。本轮继续只本地交付,画质由用户判断。diff --git a/docs/DLSS45_SR_REPORT_2026-10-11.md b/docs/DLSS45_SR_REPORT_2026-10-11.mdnew file mode 100644index 00000000..e4a9e77b--- /dev/null+++ b/docs/DLSS45_SR_REPORT_2026-10-11.md@@ -0,0 +1,44 @@+# DLSS 4.5 SR 接手结果(2026-10-11)++已完成 Claude 未完的 DLSS SR 模型选择接入。保留 K 默认,增加 M、L;列表和节点页都可选择,可随列表/节点预设、独立模式会话和节点草稿保存、恢复。使用当前已批准的 DLSS 310.7 原件,不下载或修改 DLL。实际画质由用户比较,本报告不宣称画质或性能提升。++## 基线与改动++- 本机 Claude 会话 `56393e4a-57bd-464c-a461-310bf74a3ad2` 最后用户要求只做新超分接入、实际画面由用户测试;Claude 留下9份未提交文件。原树 `E:/项目/Veyra/worktrees/dlss45-sr-20261011` 保持原样。+- 独立分支 `codex/dlss45-sr-handoff-20261011`,基线 main `049902bd941785d63199b025bb5b414da50bd53f`。原补丁、9份文件与57个旧工作树/504份脏文件身份封存于 `E:/项目/Veyra/archives/dlss45-sr-handoff-20261011`;复用并核验 Claude 已有 source-before.bundle,不复制完整工程。+- 共享 settings → chain globals → graph → NGX 传递模型。六个 unsigned render-preset hint 明确设置为 K=11 / M=13 / L=12,模型变更走原有图重建。关闭 SR 或使用 RTX Video SR/FSR 时,未生效的模型编辑不会要求重建。拒绝非法模型值。+- 完成旧 PresetStore v31、PresetLibrary v12、ChainSession v7 编解码;K 默认仍可使用旧格式。新模型库/session 写入 `.dlss-sr` 旁文件,保留旧文件;回到 K 后继续更新同一旁文件,防止下次错误恢复旧 M/L。+- 专业列表与节点页增加「DLSS 模型」选择。仅新增两条文案的简中/繁中/英文/日文翻译,不删除旧翻译。没有改 UI 绘制频率、Timer、GPU 优先级、NR、FG 或其它超分算法。独立 VFG mixed 分支未整合。++## 构建与验证证据++所有产物位于 `E:/项目/Veyra/{build,tests,logs,tmp,archives}/dlss45-sr-handoff-20261011`。++构建命令:`python -B -I E:/项目/Veyra/tmp/dlss45-sr-handoff-20261011/build.py`。按改动头文件重编完整依赖闭包34项,并链接GUI及相关测试9个EXE;保留 DeckLink SDK 与现有 PS5 slice / dav1d / subtitle FFmpeg。成功构建 `build-20261011-204653` 用时48.7秒;修正测试夹具后的最终构建 `build-20261011-205014` 用时19.4秒,产品源未再变化。这是复用已核验主线对象的增量构建,不冒称 clean 全量重编。++最终 GUI:`E:/项目/Veyra/tests/dlss45-sr-handoff-20261011/app/veyra_qml_ui.exe`;显示版本 `2.0.6-DLSS45-test-20261011`;SHA256 `b064968ae42b1bb21175b137c9d1ceebc4915fc34acfd6e3e492440ccd6afe43`。++| 验证 | 结果与证据 |+| --- | --- |+| 共享设置、激活/关闭模型编辑、图与导出参数合同 | `harness/regress.py chain contracts` 通过,日志 `dlss45/tests-20261011-204842` |+| 旧配置及 K/M/L 编解码 | 同轮 `presets` 通过;`library` 最终复测通过,日志 `dlss45/tests-20261011-205141`。包含列表/节点/草稿独立模型、预设应用、导入导出、旧文件保护和无效数据原子拒绝 |+| RTX 5070 实际 NGX | `regress.py models`,用户 GTA 原4K素材第12秒起降至1080p,1080p→4K,每模型32个连续移动帧。三次 Create、96次 Evaluate、三次 Release 均返回 `0x1 / Success`,SEH=0;三个模型各输出 f1/f8/f32 PNG |+| 输出完整性 | `verify-output.py` 检查9张 PNG 均3840×2160、非黑且非恒定;`models/output-integrity.json` 保存像素统计与SHA。人工查看 M-f32 仅确认有实际画面,不据此评价画质 |+| 正常 GUI 的列表/节点入口 | `ui-smoke.py` 在私有运行目录临时注入 QML 驱动实际生产 bridge;切 M→L、保存/恢复列表M、连接节点SR、切L→K并恢复节点L、回到列表M全部完成。`ui-20261011-205634/selection`,30.3秒,实际1080p→4K、SR active |+| 重启会话 | `ui-smoke.py restart`,`ui-20261011-205851`,5.2秒;恢复列表M及独立节点L、两个预设,并回到列表M。生产 Main.qml 字节已恢复,测试 Loader 已移除 |+| 原件与工作区保护 | 测试前后 donor 1626文件SHA全部不变;`protect.py verify` 逐项核对原57树/504脏文件、Claude patch和9文件原件通过。新增文件均为文本源码/文档,不含SDK、DLL、模型或媒体 |++当前 DLSS runtime:310.7.0.0,58,977,904字节,Authenticode Valid,SHA256 `BE6E434A94CA32499515EB62CA0E6C274526055D568D0426E4C652DCDFB6EE6E`。测试运行目录复用现有原件硬链接;EXE/QML/shader替换使用新文件原子置换,未向原件硬链接写入。++## 失败记录与限制++1. 第一次构建失败于新增测试误把返回 void 的 `PresetLibrary::apply` 当作带 accepted 字段的结果;已修正夹具、重建。第一次 library 回归误用默认禁止覆盖的 `put(entry)` 更新已有条目;改为明确 `put(entry,true)` 后复测通过。失败回执保留,原批次不标为全通过。+2. 初次 GUI restart 驱动等待 `applying=false`,但无片源时有待应用设置,所以停在驱动 state0;这不是模型丢失。驱动改为无片源时直接核对会话,独立重试通过,产品未因此修改。+3. GUI 首次切至 K 时,Create耗时8.84秒;8.14秒处现有看门狗报告无进展,栈位于 `nvptxJitCompiler64.dll` / NVIDIA object loader,随后 Create成功、画面恢复、后续L/M切换与退出正常。说明本次驱动冷编译可造成停顿及误导性的无响应提示;没有隐藏诊断或提高超时来制造通过,也不能据此保证所有冷启动快速。最终供用户测试以 M 启动。+4. 接口返回成功证明 preset hint 被接受并产出画面,无法读取未公开的运行库内部模型状态。其它显卡、真实采集卡、HDR、长时间显存稳定性及主观画质未在本轮验收;本轮未做性能对照,不报告提速百分比。++## 交付方式++正常启动私有 app,使用 `--data-dir E:/项目/Veyra/tests/dlss45-sr-handoff-20261011/profile --page pro` 和现有 `gta6-1080p30-60s.mp4`,当前列表 M、4K目标、光流运动输入,仅SR开启。配置与缓存独立,不更改用户原配置。启动及最终保护回执见本轮 `logs` 下的 `launch` / `final.json`。++没有合并 main、push、打包、发布或关机。后续如用户认可画质,再按用户授权整合。diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex 3d719128..0c2ac857 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -9087,3 +9087,17 @@ ui-software-damage-test.py performance-final四例顺序40秒有效播放、各52026-10-11 本地main整合收尾:实测tip 9c14ee28a9175aa326fb0aa09c15bfa5808e0f0e,main功能merge 3a08ce8cf28de6d0f83c7b025bd4a7f54fe37b27。`git merge --no-ff codex/merge-claude-fixes-20261011`无冲突,`git diff --exit-code codex/merge-claude-fixes-20261011 HEAD`通过,完整Git树相同;后续仅AGENTS/CURRENT_STATUS/本WORKLOG/MERGE_CLAUDE_FIXES_REPORT四份文档更新。六Claude来源和UItip全为main祖先,负优化revert保持。首轮软件CPU +15.09%超过15%守卫,保留失败后不改产品、不改数值阈值,以新→旧倒序追加两例;倒序CPU 0.238783→0.235530秒/秒,双顺序平均0.229344→0.244308(+6.52%),NR/UI守卫保持,故最终六例性能核对完成;不将单次差异当严格等价/普遍提升。finalize.py seal逐项复查595产品/测试输入、19EXE、证据SHA、原包1626文件、54旧树/496脏文件(main按授权例外)、七来源分支不变及仅文档差异,结果与最终提交/标签/增量bundle写入reports同名/final.json。所有新产物E盘,不清理其它任务文件/用户数据,没有push/打新包/发布/关机。++## 2026-10-11 接手 Claude DLSS 4.5 SR 接入++用户要求读取刚刚本机Claude聊天、完成新超分接入并启动测试。读取会话56393e4a-57bd-464c-a461-310bf74a3ad2,最后授权为只接入、用户判断画质;Claude留下9份未提交文件。不可变patch/9原文件/start.json保留于E:/项目/Veyra/archives/dlss45-sr-handoff-20261011;核验并复用其已有source-before.bundle,不重复备份整工程。main049902b与57个旧工作树/504脏文件保持。新树codex/dlss45-sr-handoff-20261011从相同基线应用原patch,无子Agent,不整合另一个VFG mixed分支。++完成K默认/M/L可选模型设置贯通共享chain globals、graph与NGX的六个unsigned preset hints(11/13/12),显式拒绝非法值;关闭SR或其它SR后端时编辑该模型不要求重建。补齐旧PresetStore31、Library12、Session7、节点草稿、列表/节点预设及重置;新模型通过.dlss-sr旁文件保留旧配置。两个生产界面新增相同入口及两条四语文案,目录中其它翻译原样保留。不改UI频率/Timer/优先级/NR/FG/其它SR算法,不下载/修改运行库。++命令`python -B -I E:/项目/Veyra/tmp/dlss45-sr-handoff-20261011/build.py`:依赖闭包34项/9EXE,成功构建204653为48.7秒;修正测试后的最终205014为19.4秒增量构建,不能冒称clean全量。保留已验DeckLink与patched FFmpeg。最终GUI SHA b064968ae42b1bb21175b137c9d1ceebc4915fc34acfd6e3e492440ccd6afe43,显示2.0.6-DLSS45-test-20261011,app在E:/项目/Veyra/tests/dlss45-sr-handoff-20261011/app。所有构建/日志/测试/缓存E盘同名任务目录,独立data-dir与TEMP/TMP/CUDA cache。++`harness/regress.py chain contracts library presets models`首轮204842中chain/contracts/presets/models通过,library因新增夹具put未明确replace失败;修正后library独立205141通过。最初构建204538另因夹具把void apply当.accepted而失败;均保留原回执,不将失败批次冒称通过。RTX5070实际GTA原4K第12秒起降到1080p→4K,每模型32帧移动输入,3Create/96Evaluate/3Release全Success、SEH0。verify-output.py核对9张4K PNG非黑且非恒定、保存SHA与统计,不以此宣称画质更好。运行库310.7/58977904字节/Valid/SHA BE6E434A94CA32499515EB62CA0E6C274526055D568D0426E4C652DCDFB6EE6E保持。++`harness/ui-smoke.py`实际生产列表/节点入口及bridge切换、保存/恢复M/L、K回退通过(ui-20261011-205634/selection,30.3秒)。无片源restart夹具错误地等待applying=false停在state0;仅修驱动后`ui-smoke.py restart`205851用5.2秒验证列表M/节点L独立恢复与预设持久化通过。生产Main.qml恢复为源码原字节,测试Loader移除。首次K Create8.84秒,在8.14秒触发既有无响应诊断,栈为NVIDIA JIT编译器,随后正常返回并恢复画面;不隐藏这项限制或靠提高看门狗阈值制造通过。最终以M、1080p GTA→4K、SR单独开启供用户测试。++regress每轮前后核验donor1626文件原件SHA;原子替换私有app的变更文件,不向硬链接原件写入。`protect.py verify`核对原57工作树/504脏文件、Claude封存patch与9原文件通过。详细结果/失败/冷编译边界见docs/DLSS45_SR_REPORT_2026-10-11.md;最终源码归档、保护与软件启动见本轮logs/final.json。其它显卡/实卡/HDR/长期显存及主观画质未验,本轮未做性能对照,不声称提速。未合并main、push、打包、发布或关机。diff --git a/i18n/catalog.json b/i18n/catalog.jsonindex fbbfe5ec..ae5f8cac 100644--- a/i18n/catalog.json+++ b/i18n/catalog.json@@ -15114,6 +15114,20 @@"zh-TW": "螢幕 %1 Hz 最多顯示約 %2X","en": "A %1 Hz display shows at most about %2X","ja": "%1 Hz の画面で表示できるのは最大約 %2X"+ },+ {+ "zh": "DLSS 模型",+ "src": "qml/NodePage.qml",+ "zh-TW": "DLSS 模型",+ "en": "DLSS model",+ "ja": "DLSS モデル"+ },+ {+ "zh": "K 保留原有模型;M、L 为 DLSS 4.5。L 针对较低输入分辨率,实际画质与耗时取决于片源。",+ "src": "qml/NodePage.qml",+ "zh-TW": "K 保留原有模型;M、L 為 DLSS 4.5。L 針對較低輸入解析度,實際畫質與耗時取決於片源。",+ "en": "K retains the original model; M and L use DLSS 4.5. L targets lower input resolutions. Quality and processing time depend on the source.",+ "ja": "K は従来モデル、M・L は DLSS 4.5 です。L は低い入力解像度向けです。画質と処理時間は映像により異なります。"}]}diff --git a/include/veyra/engine/EffectChain.h b/include/veyra/engine/EffectChain.hindex 9c100839..cc6ad1ba 100644--- a/include/veyra/engine/EffectChain.h+++ b/include/veyra/engine/EffectChain.h@@ -193,6 +193,7 @@ ChainValidation compileChainExecutionPlan(const EffectChain&, const ChainExecutistruct ChainGlobalSettings {pipeline::SrTarget srTarget = pipeline::SrTarget::Uhd4K;uint32_t videoSrQuality = 0;+ uint32_t dlssSrModel = 0; // EnhancementSettings::dlssSrModelFrameGenerationBackend fgBackend = FrameGenerationBackend::Dlss;uint32_t vfgQuality=1;FlowQuality flow = FlowQuality::Balanced;diff --git a/include/veyra/engine/EnhancementSettings.h b/include/veyra/engine/EnhancementSettings.hindex 7016e9ee..758beac2 100644--- a/include/veyra/engine/EnhancementSettings.h+++ b/include/veyra/engine/EnhancementSettings.h@@ -57,6 +57,11 @@ inline size_t exportBitrateIndex(uint32_t mbps){for(size_t i=0;i<kExportBitrateC// videoSrQuality values: 0 = DLSS SR, 1..4 = RTX video SR quality steps,// 5 = AMD FSR upscaling (vendor neutral; verified on an NVIDIA adapter).inline constexpr uint32_t kVideoSrFsr=5;+// DLSS SR model (videoSrQuality 0 only): 0 = DLSS 4 transformer (preset K,+// what DLSS SR always used here), 1 = DLSS 4.5 second-generation transformer+// (preset M), 2 = DLSS 4.5 Ultra Performance model (preset L). Both 4.5+// models ship in the DLSS 310.5+ runtime already packaged (310.7).+inline constexpr uint32_t kDlssSrModelCount=3;// Capture audio ingress policy. Automatic is what the pipeline did before the// manual selector existed; the other two exist because Dolby/DTS passthrough// negotiation depends on the device and the console, and users reported that@@ -301,6 +306,7 @@ struct EnhancementSettings {bool useHdrPreview(bool hdrInput,bool hdrDisplayActive)const{return (hdrInput||videoHdr.enabled)&&hdrDisplayActive&&!forceSdrPreview;}pipeline::SrTarget srTarget=pipeline::SrTarget::Uhd4K;uint32_t videoSrQuality=0; // 0 DLSS SR; 1–4 RTX Video SR+ uint32_t dlssSrModel=0; // DLSS SR only; see kDlssSrModelCountuint32_t multiplier=1;FrameGenerationBackend frameGenerationBackend=FrameGenerationBackend::Dlss;uint32_t vfgQuality=1; // NvVFX Mode: Low=0, Medium=1 (default), High=2@@ -354,6 +360,7 @@ struct EnhancementSettings {if(!nr||!sr)active.lowLatency=defaults.lowLatency;if(!nr||!protection.enabled)active.protection=defaults.protection;if(!sr){active.srTarget=defaults.srTarget;active.videoSrQuality=defaults.videoSrQuality;active.srMotion=defaults.srMotion;}+ if(!sr||videoSrQuality!=0)active.dlssSrModel=defaults.dlssSrModel;if(multiplier<=1){active.frameGenerationBackend=defaults.frameGenerationBackend;active.vfgQuality=defaults.vfgQuality;active.fgMotion=defaults.fgMotion;active.fgStrictAdmission=defaults.fgStrictAdmission;@@ -470,6 +477,7 @@ struct EnhancementSettings {// probe measured the same count for 2/3/4 requested frames.if(fsrFrameGeneration(frameGenerationBackend)&&multiplier>2)return "AMD FSR frame generation supports up to 2X";if(videoSrQuality>kVideoSrFsr)return "invalid video SR quality";+ if(dlssSrModel>=kDlssSrModelCount)return "invalid DLSS SR model";if(!pipeline::validSrTarget(srTarget))return "invalid SR target";if(opticalFlowBackend!=OpticalFlowBackend::Nvidia&&opticalFlowBackend!=OpticalFlowBackend::AmdFidelityFx&&opticalFlowBackend!=OpticalFlowBackend::GpuDis)return "invalid optical flow backend";if(multiplier<1||multiplier>(frameGenerationBackend==FrameGenerationBackend::Vfg?8u:6u))return "unsupported multiplier";diff --git a/include/veyra/engine/GraphDescription.h b/include/veyra/engine/GraphDescription.hindex de9c83bc..ea09f54b 100644--- a/include/veyra/engine/GraphDescription.h+++ b/include/veyra/engine/GraphDescription.h@@ -108,6 +108,7 @@ inline pipeline::ResolutionPlan describeStages(const StageRequest& request,const: request.nvidiaAdapter||crossVendorFrameGeneration(settings.frameGenerationBackend));desc.fgMultiplier=request.fgMultiplier;desc.videoSrQuality=settings.videoSrQuality;+ desc.dlssSrModel=settings.dlssSrModel;describeNrLayers(settings,desc);desc.frameGenerationBackend=settings.frameGenerationBackend;desc.vfgQuality=settings.vfgQuality;diff --git a/include/veyra/ngx/DlssSrBackend.h b/include/veyra/ngx/DlssSrBackend.hindex 89e17650..0b68d471 100644--- a/include/veyra/ngx/DlssSrBackend.h+++ b/include/veyra/ngx/DlssSrBackend.h@@ -31,6 +31,10 @@ public:uint32_t outputHeight;int perfQuality; // NVSDK_NGX_PerfQuality_Valuebool enableOutputSubrects;+ // engine::EnhancementSettings::dlssSrModel: 0 DLSS 4 transformer (preset K),+ // 1 DLSS 4.5 second-generation transformer (preset M), 2 DLSS 4.5 Ultra+ // Performance (preset L). Applied to every perf mode as a render preset hint.+ uint32_t model = 0;};struct EvalDesc {diff --git a/include/veyra/pipeline/EnhanceGraph.h b/include/veyra/pipeline/EnhanceGraph.hindex 39daa403..63e44a05 100644--- a/include/veyra/pipeline/EnhanceGraph.h+++ b/include/veyra/pipeline/EnhanceGraph.h@@ -83,6 +83,7 @@ struct EnhanceGraphDesc {uint32_t workWidth = 3840;uint32_t workHeight = 2160;uint32_t videoSrQuality=0;+ uint32_t dlssSrModel=0; // engine::EnhancementSettings::dlssSrModel (DLSS SR only)bool enableSr = false; // upscale source -> work extent (1:1 bypass otherwise)bool enableNr = true;bool nrBeforeSr = false;diff --git a/include/veyra/ui/QmlPlayerBridge.h b/include/veyra/ui/QmlPlayerBridge.hindex c69cea70..84dd25dd 100644--- a/include/veyra/ui/QmlPlayerBridge.h+++ b/include/veyra/ui/QmlPlayerBridge.h@@ -296,6 +296,8 @@ class QmlPlayerBridge : public QObject {Q_PROPERTY(bool nrAutoMask READ nrAutoMask WRITE setNrAutoMask NOTIFY settingsChanged)Q_PROPERTY(bool nrUiCorrection READ nrUiCorrection WRITE setNrUiCorrection NOTIFY settingsChanged)Q_PROPERTY(int videoSrQuality READ videoSrQuality WRITE setVideoSrQuality NOTIFY settingsChanged)+ Q_PROPERTY(int dlssSrModel READ dlssSrModel WRITE setDlssSrModel NOTIFY settingsChanged)+ Q_PROPERTY(QVariantList dlssSrModelChoices READ dlssSrModelChoices CONSTANT)Q_PROPERTY(bool protectionEnabled READ protectionEnabled WRITE setProtectionEnabled NOTIFY settingsChanged)Q_PROPERTY(QVariantMap protectionState READ protectionState NOTIFY chainChanged)Q_PROPERTY(bool colorEnabled READ colorEnabled WRITE setColorEnabled NOTIFY settingsChanged)@@ -797,6 +799,9 @@ public:void setNrUiCorrection(bool value);int videoSrQuality() const;void setVideoSrQuality(int value);+ int dlssSrModel() const;+ void setDlssSrModel(int value);+ QVariantList dlssSrModelChoices() const;bool protectionEnabled() const;void setProtectionEnabled(bool value);QVariantMap protectionState() const;diff --git a/qml/Veyra/NodePage.qml b/qml/Veyra/NodePage.qmlindex 1ccb02ea..9ef3572b 100644--- a/qml/Veyra/NodePage.qml+++ b/qml/Veyra/NodePage.qml@@ -1415,6 +1415,18 @@ VPage {onPicked: id => veyra.videoSrQuality = Number(id)}}+ VRow {+ label: qsTr("DLSS 模型")+ hint: qsTr("K 保留原有模型;M、L 为 DLSS 4.5。L 针对较低输入分辨率,实际画质与耗时取决于片源。")+ visible: veyra.videoSrQuality === 0+ enabled: Support.available(veyra, "sr0")+ VSelect {+ objectName: "node-dlss-sr-model"+ options: veyra.dlssSrModelChoices || []+ value: options.find(o => o.id === String(veyra.dlssSrModel))?.label || ""+ onPicked: id => veyra.dlssSrModel = Number(id)+ }+ }VRow {label: qsTr("目标尺寸")hint: veyra.videoSrQuality >= 1 && veyra.videoSrQuality <= 4diff --git a/qml/Veyra/ProPage.qml b/qml/Veyra/ProPage.qmlindex 2e2d31a1..abb0e915 100644--- a/qml/Veyra/ProPage.qml+++ b/qml/Veyra/ProPage.qml@@ -1270,6 +1270,18 @@ VPage {onPicked: id => veyra.videoSrQuality = Number(id)}}+ VRow {+ label: qsTr("DLSS 模型")+ hint: qsTr("K 保留原有模型;M、L 为 DLSS 4.5。L 针对较低输入分辨率,实际画质与耗时取决于片源。")+ visible: veyra.videoSrQuality === 0+ enabled: Support.available(veyra, "sr0")+ VSelect {+ objectName: "list-dlss-sr-model"+ options: veyra.dlssSrModelChoices || []+ value: options.find(o => o.id === String(veyra.dlssSrModel))?.label || ""+ onPicked: id => veyra.dlssSrModel = Number(id)+ }+ }VRow {label: qsTr("目标尺寸")hint: veyra.videoSrQuality >= 1 && veyra.videoSrQuality <= 4diff --git a/src/engine/EffectChain.cpp b/src/engine/EffectChain.cppindex 76cdd2cb..7ae32c1d 100644--- a/src/engine/EffectChain.cpp+++ b/src/engine/EffectChain.cpp@@ -508,7 +508,7 @@ ChainValidation compileChainExecutionPlan(const EffectChain& chain, const ChainEChainGlobalSettings ChainGlobalSettings::capture(const EnhancementSettings& s) {ChainGlobalSettings c;- c.srTarget = s.srTarget; c.videoSrQuality = s.videoSrQuality;+ c.srTarget = s.srTarget; c.videoSrQuality = s.videoSrQuality; c.dlssSrModel = s.dlssSrModel;c.fgBackend = s.frameGenerationBackend; c.flow = s.flow;c.vfgQuality=s.vfgQuality;c.opticalFlowBackend = s.opticalFlowBackend; c.amdFlowHalfResolution = s.amdFlowHalfResolution;@@ -522,7 +522,7 @@ void ChainGlobalSettings::apply(EnhancementSettings& s) const {s.nrPolicy = nrPolicy;s.hdrOutputMode=hdrOutputMode;s.fgMotion=fgMotion;s.srMotion=srMotion;s.nrMotion=nrMotion;s.hdrCurve=hdrCurve;s.hdrMetadata=hdrMetadata;- s.srTarget = srTarget; s.videoSrQuality = videoSrQuality;+ s.srTarget = srTarget; s.videoSrQuality = videoSrQuality; s.dlssSrModel = dlssSrModel;s.frameGenerationBackend = fgBackend; s.flow = flow;s.vfgQuality=vfgQuality;s.opticalFlowBackend = opticalFlowBackend; s.amdFlowHalfResolution = amdFlowHalfResolution;@@ -542,7 +542,7 @@ void ChainConfiguration::apply(EnhancementSettings& s) const {}bool ChainConfiguration::operator==(const ChainConfiguration& other) const {- return chain == other.chain && srTarget == other.srTarget && videoSrQuality == other.videoSrQuality &&+ return chain == other.chain && srTarget == other.srTarget && videoSrQuality == other.videoSrQuality && dlssSrModel == other.dlssSrModel &&fgBackend == other.fgBackend && vfgQuality == other.vfgQuality && flow == other.flow && opticalFlowBackend == other.opticalFlowBackend &&amdFlowHalfResolution == other.amdFlowHalfResolution && nrPolicy == other.nrPolicy &&// The author's own rendering globals had the same blind spot: a change to@@ -641,6 +641,8 @@ bool requiresGraphRebuild(const EnhancementSettings& savedPrevious, const Enhancif ((previous.nrHoldStrength > 0.0f) != (next.nrHoldStrength > 0.0f)) return true;if (previous.nrPolicy != next.nrPolicy) return true;if (previous.srTarget != next.srTarget) return true;+ // A different DLSS SR model (render preset) needs a new SR feature.+ if (previous.dlssSrModel != next.dlssSrModel) return true;if (previous.frameGenerationBackend != next.frameGenerationBackend) return true;if (previous.vfgQuality != next.vfgQuality) return true;if (previous.opticalFlowBackend != next.opticalFlowBackend) return true;diff --git a/src/engine/PresetLibrary.cpp b/src/engine/PresetLibrary.cppindex 37b71aaa..8a4fccd7 100644--- a/src/engine/PresetLibrary.cpp+++ b/src/engine/PresetLibrary.cpp@@ -14,15 +14,16 @@ namespace {// Six full grades per entry (plus the legacy first-grade field), up to 64// entries. Never remove the file-size guard as LUT names are external input.constexpr size_t kMaxPresetBytes = 2u * 1024u * 1024u;-void writeRendering(std::ostream& out,const ChainGlobalSettings& g,bool vfg=false,bool tuning=false){out<<' '<<int(g.hdrOutputMode)<<' '<<int(g.fgMotion)<<' '<<int(g.srMotion)<<' '<<int(g.nrMotion);if(vfg)out<<' '<<g.vfgQuality;+void writeRendering(std::ostream& out,const ChainGlobalSettings& g,bool vfg=false,bool tuning=false,bool dlss=false){out<<' '<<int(g.hdrOutputMode)<<' '<<int(g.fgMotion)<<' '<<int(g.srMotion)<<' '<<int(g.nrMotion);if(vfg)out<<' '<<g.vfgQuality;// Static HDR output tuning: library v11 / session v6.// Older mainline versions keep their original NR/Flow layout.if(tuning)out<<' '<<g.hdrCurve.shadowLiftEv100<<' '<<g.hdrCurve.shadowRangeNits<<' '<<g.hdrCurve.midGrayNits<<' '<<g.hdrCurve.highlightStartNits<<' '<<g.hdrCurve.rollOffPercent<<' '<<g.hdrCurve.peakCapNits<<' '<<g.hdrCurve.enabled<<' '<<(g.hdrMetadata.enabled?1:0)<<' '<<g.hdrMetadata.masteringPeakNits<<' '<<g.hdrMetadata.maxCllNits<<' '<<g.hdrMetadata.maxFallNits<<' '<<g.hdrMetadata.masteringMinNitsX10000- <<' '<<g.hdrCurve.strengthPercent<<' '<<g.hdrCurve.displayPeakNits;}-bool readRendering(std::istream& in,ChainGlobalSettings& g,bool vfg=false,bool tuning=false){+ <<' '<<g.hdrCurve.strengthPercent<<' '<<g.hdrCurve.displayPeakNits;+ if(dlss)out<<' '<<g.dlssSrModel;}+bool readRendering(std::istream& in,ChainGlobalSettings& g,bool vfg=false,bool tuning=false,bool dlss=false){int hdr,fg,sr,nr;if(!(in>>hdr>>fg>>sr>>nr))return false;g.hdrOutputMode=HdrOutputMode(hdr);g.fgMotion=MotionSource(fg);g.srMotion=MotionSource(sr);g.nrMotion=MotionSource(nr);@@ -36,6 +37,7 @@ bool readRendering(std::istream& in,ChainGlobalSettings& g,bool vfg=false,bool tg.hdrMetadata={metaOn!=0,unsigned(mpeak),unsigned(mcll),unsigned(mfall),unsigned(mmin)};if(!g.hdrCurve.valid()||!g.hdrMetadata.valid())return false;}+ if(dlss&&(!(in>>g.dlssSrModel)||g.dlssSrModel>=kDlssSrModelCount))return false;EnhancementSettings s;g.apply(s);return s.validate().empty();}void applyRenderingPreset(const PresetEntry& e,EnhancementSettings& s){@@ -91,6 +93,7 @@ void PresetLibrary::addBuiltins() {bool PresetLibrary::load() {error_.clear();addBuiltins();+ 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");const auto rootVfg=std::filesystem::path(path_).concat(L".vfg");@@ -114,6 +117,9 @@ bool PresetLibrary::load() {const auto hdrPath=std::filesystem::path(path_).concat(L".hdr-output");if(std::filesystem::exists(directHdr))path_=directHdr;else if(std::filesystem::exists(hdrPath))path_=hdrPath;+ 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;if (!std::filesystem::exists(path_)) return true;std::error_code ec;const auto size = std::filesystem::file_size(path_, ec);@@ -207,6 +213,9 @@ bool PresetLibrary::save() {std::wstring checkedDefault;// 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 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");if(!path_.wstring().ends_with(L".hdr-output")){if(data.starts_with("VEYRA_PRESET_LIBRARY 10")&&!path_.wstring().ends_with(L".flow"))path_=std::filesystem::path(path_).concat(L".flow");@@ -222,6 +231,7 @@ bool PresetLibrary::save() {path_ = std::filesystem::path(path_).concat(L".p3-globals");}}+ }std::error_code ec;std::filesystem::create_directories(path_.parent_path(), ec);const auto temporary = std::filesystem::path(path_).concat(L".tmp");@@ -642,7 +652,13 @@ std::string PresetLibrary::encodeEntries(const std::vector<PresetEntry>& entriesreturn g.hdrCurve!=HdrCurveSettings{}||g.hdrMetadata!=HdrMetadataSettings{};}return false;};const bool tuning=std::any_of(entries_.begin(),entries_.end(),tuningOf);- const int version=std::max(minimumVersion, tuning?11:flow?10:correctionExtended?9:correction?8:vfg?7:rendering?6:globals?5:editor?4:layerSizes?3:multi?2:1);+ const bool dlss=std::any_of(entries_.begin(),entries_.end(),[](const auto& e){+ if(e.globals&&e.globals->dlssSrModel!=0)return true;+ if(!e.nodeConfiguration)return false;+ 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);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)) << ' '@@ -686,7 +702,7 @@ std::string PresetLibrary::encodeEntries(const std::vector<PresetEntry>& entries}if(version>=6){o<<' '<<e.globals.has_value();- if(e.globals){const auto& g=*e.globals;o<<' '<<int(g.srTarget)<<' '<<g.videoSrQuality<<' '<<int(g.fgBackend)<<' '<<int(g.flow)<<' '<<int(g.opticalFlowBackend)<<' '<<g.amdFlowHalfResolution<<' '<<int(g.nrPolicy);writeRendering(o,g,version>=7,version>=11);}+ if(e.globals){const auto& g=*e.globals;o<<' '<<int(g.srTarget)<<' '<<g.videoSrQuality<<' '<<int(g.fgBackend)<<' '<<int(g.flow)<<' '<<int(g.opticalFlowBackend)<<' '<<g.amdFlowHalfResolution<<' '<<int(g.nrPolicy);writeRendering(o,g,version>=7,version>=11,version>=12);}}if(version>=10){o<<' '<<e.flow.has_value();@@ -706,7 +722,7 @@ bool PresetLibrary::parse(const std::string& data, std::vector<PresetEntry>& outstd::string magic, quoted;int version = 0;size_t count = 0;- const int allowedVersion=maxVersion>0?std::min(maxVersion,11):11;+ const int allowedVersion=maxVersion>0?std::min(maxVersion,12):12;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);@@ -807,7 +823,7 @@ bool PresetLibrary::parse(const std::string& data, std::vector<PresetEntry>& outif(present){ChainGlobalSettings g;int target,backend,flow,optical,half,policy;if(!(in>>target>>g.videoSrQuality>>backend>>flow>>optical>>half>>policy)||half<0||half>1)return false;g.srTarget=pipeline::SrTarget(target);g.fgBackend=FrameGenerationBackend(backend);g.flow=FlowQuality(flow);g.opticalFlowBackend=OpticalFlowBackend(optical);g.amdFlowHalfResolution=half!=0;g.nrPolicy=pipeline::NrSizePolicy(policy);- if(!readRendering(in,g,version>=7,version>=11))return false;e.globals=g;+ if(!readRendering(in,g,version>=7,version>=11,version>=12))return false;e.globals=g;}}if(version>=10){@@ -842,7 +858,10 @@ std::string ChainSessionStore::encode(const ChainSession& session) {return c.hdrCurve!=HdrCurveSettings{} || c.hdrMetadata!=HdrMetadataSettings{} ||(c.editor&&c.editor->globals&&(c.editor->globals->hdrCurve!=HdrCurveSettings{}||c.editor->globals->hdrMetadata!=HdrMetadataSettings{}));};const bool tuning=std::any_of(session.configurations.begin(),session.configurations.end(),tuningCustom);- const int version = tuning?6:vfg?5:rendering?4:editor ? (editor->globals ? 3 : 2) : 1;+ 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;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;@@ -851,7 +870,7 @@ std::string ChainSessionStore::encode(const ChainSession& session) {out << int(c.srTarget) << ' ' << c.videoSrQuality << ' ' << int(c.fgBackend) << ' '<< int(c.flow) << ' ' << int(c.opticalFlowBackend) << ' ' << c.amdFlowHalfResolution << ' '<< int(c.nrPolicy) << ' ' << c.selectedNr << ' ' << c.selectedColour;- if(version>=4)writeRendering(out,c,version>=5,version>=6);out<<'\n';+ if(version>=4)writeRendering(out,c,version>=5,version>=6,version>=7);out<<'\n';PresetEntry entry;entry.name = i == 0 ? L"list" : L"node";entry.kind = ChainMode(i); entry.chain = c.chain;@@ -869,7 +888,7 @@ std::string ChainSessionStore::encode(const ChainSession& session) {const auto& g = *document.globals;out << int(g.srTarget) << ' ' << g.videoSrQuality << ' ' << int(g.fgBackend) << ' '<< int(g.flow) << ' ' << int(g.opticalFlowBackend) << ' ' << g.amdFlowHalfResolution << ' '- << int(g.nrPolicy);if(version>=4)writeRendering(out,g,version>=5,version>=6);out<<'\n';+ << int(g.nrPolicy);if(version>=4)writeRendering(out,g,version>=5,version>=6,version>=7);out<<'\n';}out << graph.nextId << ' ' << graph.inputNext << ' ' << document.nodes.nodeCount << '\n';// The ordinary preset codec validates a linear runtime chain. Use a@@ -896,7 +915,7 @@ bool ChainSessionStore::decode(const std::string& data, ChainSession& session, bstd::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 > 6) || active < 0 || active > 1 || list != 1 || node < 0 || node > 1) return false;+ (version < 1 || version > 7) || 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};@@ -907,7 +926,7 @@ bool ChainSessionStore::decode(const std::string& data, ChainSession& session, bc.srTarget = pipeline::SrTarget(target); c.fgBackend = FrameGenerationBackend(backend);c.flow = FlowQuality(flow); c.opticalFlowBackend = OpticalFlowBackend(optical);c.amdFlowHalfResolution = half != 0; c.nrPolicy = pipeline::NrSizePolicy(policy);- if(version>=4&&!readRendering(in,c,version>=5,version>=6))return false;+ if(version>=4&&!readRendering(in,c,version>=5,version>=6,version>=7))return false;}if (!(in >> std::quoted(body))) return false;std::vector<PresetEntry> entries; std::wstring def, error;@@ -932,7 +951,7 @@ bool ChainSessionStore::decode(const std::string& data, ChainSession& session, bg.srTarget = pipeline::SrTarget(target); g.fgBackend = FrameGenerationBackend(backend);g.flow = FlowQuality(flow); g.opticalFlowBackend = OpticalFlowBackend(optical);g.amdFlowHalfResolution = half != 0; g.nrPolicy = pipeline::NrSizePolicy(policy);- if(version>=4&&!readRendering(in,g,version>=5,version>=6))return false;+ if(version>=4&&!readRendering(in,g,version>=5,version>=6,version>=7))return false;editor->globals = g;}uint32_t count = 0;@@ -962,6 +981,7 @@ bool ChainSessionStore::decode(const std::string& data, ChainSession& session, b}bool ChainSessionStore::load(ChainSession& session) {+ const auto directDlss=std::filesystem::path(path_).concat(L".dlss-sr");error_.clear();std::error_code ec;const auto directHdr=std::filesystem::path(path_).concat(L".hdr-output");@@ -983,6 +1003,9 @@ bool ChainSessionStore::load(ChainSession& session) {const auto hdrPath=std::filesystem::path(path_).concat(L".hdr-output");if(std::filesystem::exists(directHdr,ec))path_=directHdr;else if(std::filesystem::exists(hdrPath,ec))path_=hdrPath;+ 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 bool exists = std::filesystem::exists(path_, ec);if (!exists && !ec) return true;const auto size = std::filesystem::file_size(path_, ec);@@ -1012,6 +1035,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 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");if(!path_.wstring().ends_with(L".hdr-output")){if(data.starts_with("VEYRA_CHAIN_SESSION 5")&&!path_.wstring().ends_with(L".vfg"))path_=std::filesystem::path(path_).concat(L".vfg");@@ -1027,6 +1052,7 @@ bool ChainSessionStore::save(const ChainSession& session) {path_ = std::filesystem::path(path_).concat(L".p3-globals");}}+ }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.cppindex 66bf7899..8efca3b6 100644--- a/src/engine/PresetStore.cpp+++ b/src/engine/PresetStore.cpp@@ -40,13 +40,16 @@ std::string PresetStore::serialize()const{if(p.settings.residual.extendedSchema())return true;for(unsigned i=0;i<p.settings.nrLayerCount;++i)if(p.settings.nrLayers[i].residual.extendedSchema())return true;return false;});- const bool fullSchema=fsr4||higher||rendering||vfg||correction;- const bool correctionExtended=std::any_of(entries_.begin(),entries_.end(),[](const auto& p){+ // 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){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 "<<(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 "<<(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){@@ -65,18 +68,19 @@ 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)o<<' '<<int(s.hdrOutputMode)<<' '<<int(s.fgMotion)<<' '<<int(s.srMotion)<<' '<<int(s.nrMotion);- if(vfg||correction)o<<' '<<s.vfgQuality;- if(correction){+ 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){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;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>30)||!(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>31)||!(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;@@ -142,6 +146,7 @@ bool PresetStore::parse(const std::string& data,std::vector<UserPreset>& out,stdif(!readNrCorrection(in,s.residual.correction,version>=30))return false;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;}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/ngx/DlssSrBackend.cpp b/src/ngx/DlssSrBackend.cppindex 97f9b528..289765bb 100644--- a/src/ngx/DlssSrBackend.cpp+++ b/src/ngx/DlssSrBackend.cpp@@ -78,6 +78,11 @@ bool DlssSrBackend::create(NgxCoreHost& coreHost,Status& status){(void)coreHost; // NGX core already initialized; SR creates through the core API+ if (desc.model >= 3) {+ log::error("ngx", std::format("sr-backend: invalid model={}", desc.model));+ status = Status::InvalidArgument;+ return false;+ }if (handle_ != nullptr) {release();}@@ -107,6 +112,19 @@ bool DlssSrBackend::create(NgxCoreHost& coreHost,createParams.InEnableOutputSubrects = desc.enableOutputSubrects ? 1 : 0;log::info("ngx",std::format("sr-backend: linearInput=true flags=0x{:X} exposure=auto mvUnits=output-pixels jitter=source-sampling",createParams.InFeatureCreateFlags));+ // DLSS SR model. The runtime picks a preset per perf mode (310.7: K for+ // DLAA/Quality/Balanced, M for Performance, L for Ultra Performance), so pin+ // every mode to the chosen one. M and L are the DLSS 4.5 second-generation+ // transformer (DLSS SDK 310.5+); K is the DLSS 4 model used until now.+ static constexpr NVSDK_NGX_DLSS_Hint_Render_Preset kModelPresets[]={+ NVSDK_NGX_DLSS_Hint_Render_Preset_K,NVSDK_NGX_DLSS_Hint_Render_Preset_M,NVSDK_NGX_DLSS_Hint_Render_Preset_L};+ static constexpr const char* kModelNames[]={"DLSS 4 (preset K)","DLSS 4.5 (preset M)","DLSS 4.5 Ultra Performance (preset L)"};+ const uint32_t model=desc.model;+ for(const char* mode:{NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_DLAA,NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Quality,+ NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Balanced,NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_Performance,+ NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_UltraPerformance,NVSDK_NGX_Parameter_DLSS_Hint_Render_Preset_UltraQuality})+ NVSDK_NGX_Parameter_SetUI(params,mode,unsigned(kModelPresets[model]));+ log::info("ngx",std::format("sr-backend: model={} renderPreset={} (all perf modes)",kModelNames[model],unsigned(kModelPresets[model])));uint32_t sehCode = 0;const NVSDK_NGX_Result result = CallCreateDlss(cmdList, 1, 1, &handle_,params, &createParams, sehCode);diff --git a/src/pipeline/EnhanceGraph.cpp b/src/pipeline/EnhanceGraph.cppindex 7778161f..a68dab54 100644--- a/src/pipeline/EnhanceGraph.cpp+++ b/src/pipeline/EnhanceGraph.cpp@@ -1298,7 +1298,7 @@ bool EnhanceGraph::initNgxFeatures()ngx::DlssSrBackend::CreateDesc sd{};sd.inputWidth = srcW_; sd.inputHeight = srcH_;sd.outputWidth = workW_; sd.outputHeight = workH_;- sd.perfQuality = 1; sd.enableOutputSubrects = false;+ sd.perfQuality = 1; sd.enableOutputSubrects = false; sd.model = desc_.dlssSrModel;ID3D12GraphicsCommandList* list = ring_.acquire(0, st);if (list == nullptr) { failedBackend_=engine::FailedBackend::Infrastructure; return false; }failedBackend_=engine::FailedBackend::Sr;@@ -3104,7 +3104,7 @@ bool EnhanceGraph::applySettings(const engine::EnhancementSettings& s){if((desc_.enableNr&&s.nrRuntime!=desc_.nrRuntime)||(desc_.enableFg&&(std::max(2u,s.multiplier)!=desc_.fgMultiplier||s.frameGenerationBackend!=desc_.frameGenerationBackend||(desc_.frameGenerationBackend==engine::FrameGenerationBackend::Vfg&&s.vfgQuality!=desc_.vfgQuality)))||- (desc_.enableSr&&s.videoSrQuality!=desc_.videoSrQuality)||+ (desc_.enableSr&&(s.videoSrQuality!=desc_.videoSrQuality||(desc_.videoSrQuality==0&&s.dlssSrModel!=desc_.dlssSrModel)))||(s.multiplier>1&&s.frameGenerationBackend==engine::FrameGenerationBackend::Dlss&&(!fgCapsAvailable_||s.multiplier-1>uint32_t(fgMultiFrameMax_))))return false;// The colour master switch changes the graph shape (tables + shader branch)// and must rebuild; every other colour field is a live uniform update.diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cppindex 495e210d..a4b5aec4 100644--- a/src/ui/QmlPlayerBridge.cpp+++ b/src/ui/QmlPlayerBridge.cpp@@ -709,6 +709,7 @@ struct QmlPlayerBridge::Impl {// A detached singleton owns editable values, not live resources.if (!projected->firstOf(engine::EffectType::SuperResolution)) {s.srTarget = previous.srTarget; s.videoSrQuality = previous.videoSrQuality;+ s.dlssSrModel = previous.dlssSrModel;}if (!projected->firstOf(engine::EffectType::FrameGeneration)){s.frameGenerationBackend = previous.frameGenerationBackend;@@ -3997,6 +3998,21 @@ QString QmlPlayerBridge::backendWarning() const { return uiText(impl_->snapshot.}int QmlPlayerBridge::videoSrQuality() const { return int(settings().videoSrQuality); }+int QmlPlayerBridge::dlssSrModel() const { return int(settings().dlssSrModel); }+QVariantList QmlPlayerBridge::dlssSrModelChoices() const {+ return {QVariantMap{{"id", "0"}, {"label", "DLSS 4 · K"}},+ QVariantMap{{"id", "1"}, {"label", "DLSS 4.5 · M"}},+ QVariantMap{{"id", "2"}, {"label", "DLSS 4.5 · L"}}};+}+void QmlPlayerBridge::setDlssSrModel(int value) {+ if (value < 0 || unsigned(value) >= engine::kDlssSrModelCount) return;+ const auto cap = effectCapabilities().value("sr0").toMap();+ if (!cap.value("available").toBool()) { emit notice(cap.value("reason").toString(), true); return; }+ auto s = settings();+ if (s.dlssSrModel == unsigned(value)) return;+ s.dlssSrModel = unsigned(value);+ if (impl_->commit(s)) emit settingsChanged();+}void QmlPlayerBridge::setVideoSrQuality(int value) {if (value < 0 || value > 5) return;const auto cap = effectCapabilities().value("sr" + QString::number(value)).toMap();@@ -5743,6 +5759,7 @@ bool QmlPlayerBridge::resetNode(uint id) {const engine::EnhancementSettings defaults;impl_->draftGlobals.srTarget = defaults.srTarget;impl_->draftGlobals.videoSrQuality = defaults.videoSrQuality;+ impl_->draftGlobals.dlssSrModel = defaults.dlssSrModel;}if (!impl_->revalidate(true, &previous)) {const auto error = impl_->validation.message; node = before;diff --git a/tests/integration/SrQualityTests.cpp b/tests/integration/SrQualityTests.cppindex 02bd240e..cfcec8f4 100644--- a/tests/integration/SrQualityTests.cpp+++ b/tests/integration/SrQualityTests.cpp@@ -11,6 +11,7 @@#include <fstream>#include <memory>#include <array>+#include <vector>extern "C" {#include <libavutil/frame.h>#include <libavutil/pixfmt.h>@@ -19,15 +20,18 @@ extern "C" {// Matched deterministic frames, actual SDK evaluation and output pixels.// Readbacks are restricted to this test; these are not playback timings.-static int referenceTest(const std::filesystem::path& directory,const std::wstring& path,int seconds,bool moving,bool zeroMotion,int inputHeight,int outputHeight){+static int referenceTest(const std::filesystem::path& directory,const std::wstring& path,int seconds,bool moving,bool zeroMotion,int inputHeight,int outputHeight,bool models=false){using namespace veyra;std::filesystem::create_directories(directory);Logger::instance().openFile((directory/L"engine.log").wstring());gfx::D3D12DeviceContext ctx;gfx::CommandSlotRing ring;Status status;if(!ctx.initialize({},status)||!ring.initialize(ctx.device(),ctx.directQueue(),ctx.fence(),ctx.fenceEvent(),4,status))return 2;- struct Case{const char* name;unsigned quality;bool reference,enabled;};+ struct Case{const char* name;unsigned quality;bool reference,enabled;unsigned model=0;};bool ok=true;- for(const auto test:std::array<Case,6>{{{"reference",4,true,false},{"bilinear",4,false,false},- {"vsr1",1,false,true},{"vsr4",4,false,true},{"dlss",0,false,true},{"fsr",5,false,true}}}){+ const std::vector<Case> cases=models+ ?std::vector<Case>{{"dlss-K",0,false,true,0},{"dlss-M",0,false,true,1},{"dlss-L",0,false,true,2}}+ :std::vector<Case>{{"reference",4,true,false},{"bilinear",4,false,false},+ {"vsr1",1,false,true},{"vsr4",4,false,true},{"dlss",0,false,true},{"fsr",5,false,true}};+ for(const auto test:cases){source::MediaFileSource media;source::SourceOpenDesc open;open.path=path;open.preferHardwareDecode=false;if(!media.open(open)||!media.seek({seconds,1}))return 2;pipeline::FramePacket packet;const AVFrame* natural=nullptr;@@ -36,7 +40,7 @@ static int referenceTest(const std::filesystem::path& directory,const std::wstri}while(packet.pts.toDouble()+1e-6<seconds);const double startPts=packet.pts.toDouble();engine::EnhancementSettings settings;settings.nr=false;settings.sr=!test.reference;settings.multiplier=1;- settings.videoSrQuality=test.quality;settings.srTarget=outputHeight==1440?pipeline::SrTarget::Qhd:pipeline::SrTarget::Uhd4K;+ settings.videoSrQuality=test.quality;settings.dlssSrModel=test.model;settings.srTarget=outputHeight==1440?pipeline::SrTarget::Qhd:pipeline::SrTarget::Uhd4K;settings.nrPolicy=pipeline::NrSizePolicy::Native;settings.srMotion=zeroMotion?engine::MotionSource::Zero:engine::MotionSource::OpticalFlow;engine::StageRequest request;request.height=test.reference?outputHeight:inputHeight;request.width=request.height*16/9;request.sr=settings.sr;pipeline::EnhanceGraphDesc desc;engine::describeStages(request,settings,desc);@@ -89,11 +93,11 @@ int wmain(int argc,wchar_t** argv){if(argc<2)return 2;const HRESULT com=CoInitializeEx(nullptr,COINIT_MULTITHREADED);if(FAILED(com))return 2;- if(argc>5&&std::wstring_view(argv[2])==L"reference"){+ if(argc>5&&(std::wstring_view(argv[2])==L"reference"||std::wstring_view(argv[2])==L"models")){const std::wstring_view mode=argv[5];if(mode.starts_with(L"legacy-"))return 2; // withdrawn experiment; no production toggle remainsconst int result=referenceTest(argv[1],argv[3],std::stoi(argv[4]),mode.ends_with(L"moving"),mode.starts_with(L"zero-"),- mode.find(L"p720")!=std::wstring_view::npos?720:1080,mode.find(L"qhd")!=std::wstring_view::npos?1440:2160);+ mode.find(L"p720")!=std::wstring_view::npos?720:1080,mode.find(L"qhd")!=std::wstring_view::npos?1440:2160,std::wstring_view(argv[2])==L"models");CoUninitialize();return result;}const bool baseline=argc>2&&std::wstring_view(argv[2])==L"baseline";diff --git a/tests/unit/EffectChainTests.cpp b/tests/unit/EffectChainTests.cppindex edfbbea0..546fb5f0 100644--- a/tests/unit/EffectChainTests.cpp+++ b/tests/unit/EffectChainTests.cpp@@ -1033,6 +1033,32 @@ __declspec(noinline) void testInactiveEffectEdits(){check(resolved.maxCllNits==600&&!metadata.sameActiveVideoParameters(next),"display peak remains active for enabled metadata even with the pixel curve off");}int main() {+ {+ using namespace veyra;using namespace veyra::engine;+ EnhancementSettings original;original.nr=false;original.sr=true;original.videoSrQuality=0;+ check(original.dlssSrModel==0,"DLSS SR: original model remains the default");+ for(unsigned model=1;model<kDlssSrModelCount;++model){+ auto next=original;next.dlssSrModel=model;+ check(next.validate().empty()&&requiresGraphRebuild(original,next),"DLSS SR: active model switch rebuilds the feature");+ EnhancementSettings restored;ChainGlobalSettings::capture(next).apply(restored);+ check(restored.dlssSrModel==model,"DLSS SR: chain globals retain the selected model");+ StageRequest request;request.width=1920;request.height=1080;request.sr=true;request.nvidiaAdapter=true;+ pipeline::EnhanceGraphDesc desc;describeStages(request,next,desc);+ check(desc.enableSr&&desc.dlssSrModel==model&&desc.workWidth==3840&&desc.workHeight==2160,+ "DLSS SR: preview graph gets the model at actual upscale dimensions");+ request.exportJob=true;describeStages(request,next,desc);+ check(desc.dlssSrModel==model,"DLSS SR: export uses the same model contract");+ for(unsigned backend:{0u,1u,kVideoSrFsr}){+ auto before=original;before.videoSrQuality=backend;before.sr=false;+ auto after=before;after.dlssSrModel=model;+ check(!requiresGraphRebuild(before,after),"DLSS SR: disabled model edits do not rebuild the graph");+ if(backend!=0){before.sr=after.sr=true;+ check(!requiresGraphRebuild(before,after),"DLSS SR: RTX Video SR and FSR ignore inactive model edits");}+ }+ }+ auto invalid=original;invalid.dlssSrModel=kDlssSrModelCount;+ check(!invalid.validate().empty(),"DLSS SR: invalid model is rejected");+ }testInactiveEffectEdits();{using namespace veyra;using namespace veyra::engine;diff --git a/tests/unit/PresetLibraryTests.cpp b/tests/unit/PresetLibraryTests.cppindex cb3e64dc..c77824e7 100644--- a/tests/unit/PresetLibraryTests.cpp+++ b/tests/unit/PresetLibraryTests.cpp@@ -1039,7 +1039,67 @@ __declspec(noinline) void testFlowApplication() {check(legacy.flow==source.flow&&legacy.opticalFlowBackend==source.opticalFlowBackend&&legacy.content==ContentRate::Transport,"flow apply: v1-v9 chain globals retain existing behavior");}+__declspec(noinline) void testDlssSrModels() {+ EnhancementSettings source;source.nr=false;source.sr=true;+ const auto libraryPath=scratch(L"dlss-model-library.v1");+ const auto legacyLibrary=std::filesystem::path(libraryPath).concat(L".field-render");+ PresetLibrary writer(libraryPath);writer.setIncludeBuiltins(false);+ PresetEntry entry;entry.name=L"SR models";entry.kind=ChainMode::List;+ entry.contents=presetContentMask(PresetContent::Chain);entry.chain=toChain(source);+ entry.globals=ChainGlobalSettings::capture(source);+ check(writer.load()&&writer.put(entry),"DLSS presets: save original K library");+ const auto rollback=readBytes(legacyLibrary);+ check(!rollback.empty()&&rollback.starts_with("VEYRA_PRESET_LIBRARY 6"),"DLSS presets: K keeps the old format");+ for(unsigned model=1;model<kDlssSrModelCount;++model){+ entry.globals->dlssSrModel=model;+ check(writer.put(entry,true),"DLSS presets: save M/L model");+ check(readBytes(legacyLibrary)==rollback,"DLSS presets: original library is retained for rollback");+ PresetLibrary reader(libraryPath);reader.setIncludeBuiltins(false);+ check(reader.load()&&reader.entries().size()==1&&reader.entries()[0].globals->dlssSrModel==model,+ "DLSS presets: fresh reader finds the model sidecar");+ auto applied=source;+ PresetLibrary::apply(reader.entries()[0],applied);+ check(applied.dlssSrModel==model,+ "DLSS presets: applying the chain restores its model");+ auto colourOnly=reader.entries()[0];colourOnly.contents=presetContentMask(PresetContent::Color);+ applied.dlssSrModel=0;+ PresetLibrary::apply(colourOnly,applied);+ check(applied.dlssSrModel==0,+ "DLSS presets: colour-only application leaves the SR model alone");+ }+ const auto exported=scratch(L"dlss-model-export.v12");+ check(writer.exportEntry(0,exported),"DLSS presets: export selected model");+ const auto encoded=readBytes(exported);check(encoded.starts_with("VEYRA_PRESET_LIBRARY 12"),"DLSS presets: new model declares v12");+ PresetLibrary imported(scratch(L"dlss-model-import.v1"));imported.setIncludeBuiltins(false);std::wstring name;+ check(imported.load()&&imported.importFile(exported,name)&&imported.entries()[0].globals->dlssSrModel==2,+ "DLSS presets: import preserves the selected model");+ // Invalid model at the end of the rendering block must not corrupt a good library.+ entry.name=L"invalid model";entry.globals->dlssSrModel=kDlssSrModelCount;+ check(!writer.put(entry),"DLSS presets: invalid model is rejected atomically");++ const auto sessionPath=scratch(L"dlss-model-session.v1");+ auto session=std::make_unique<ChainSession>(ChainSession::initial(source));+ check(session->select(ChainMode::Node),"DLSS session: initialize independent node configuration");+ ChainSessionStore sessions(sessionPath);+ check(sessions.save(*session),"DLSS session: save K rollback file");+ const auto sessionRollback=readBytes(sessionPath);+ session->configurations[0].dlssSrModel=1;+ session->configurations[1].dlssSrModel=2;+ auto document=std::make_shared<NodeEditorDocument>();document->nodes=session->configurations[1].chain;+ check(document->layout.initialize(document->nodes).accepted,"DLSS session: create node editor document");+ document->globals=static_cast<const ChainGlobalSettings&>(session->configurations[1]);+ document->globals->dlssSrModel=1;session->configurations[1].editor=document;+ check(sessions.save(*session)&&readBytes(sessionPath)==sessionRollback,"DLSS session: save new format beside original");+ auto restored=std::make_unique<ChainSession>();ChainSessionStore reopened(sessionPath);+ check(reopened.load(*restored)&&*restored==*session,"DLSS session: List, Node and editor draft round-trip independently");+ // Opting back into K keeps using the sidecar, avoiding stale-model resurrection.+ session->configurations[0].dlssSrModel=session->configurations[1].dlssSrModel=document->globals->dlssSrModel=0;+ check(sessions.save(*session),"DLSS session: return to K");+ ChainSessionStore finalReader(sessionPath);+ check(finalReader.load(*restored)&&*restored==*session,"DLSS session: saved K wins over old M/L choices");+}int main() {+ testDlssSrModels();testFlowStorage();testFlowApplication();testNrCorrectionStorage();diff --git a/tests/unit/RepairPresetTests.cpp b/tests/unit/RepairPresetTests.cppindex b1243207..14b83b5d 100644--- a/tests/unit/RepairPresetTests.cpp+++ b/tests/unit/RepairPresetTests.cpp@@ -317,4 +317,13 @@ ok=ok&&b.entries().size()==1&&b.defaultSettings()==s;std::ifstream header(path);std::string magic;unsigned version=0;roundtrip=roundtrip&&bool(header>>magic>>version)&&version==(extended?30:29);ok&=roundtrip;std::cout<<"strength five correction mode "<<mode<<" schema="<<version<<" roundtrip="<<roundtrip<<'\n';}+ for(unsigned model=0;model<kDlssSrModelCount;++model){+ EnhancementSettings dlss;dlss.nr=false;dlss.sr=true;dlss.dlssSrModel=model;+ auto path=p;path+=L"-dlss-model-"+std::to_wstring(model);+ std::error_code ec;std::filesystem::remove(path,ec);+ PresetStore writer(path);bool roundtrip=writer.load()&&writer.put(L"DLSS model",dlss);+ PresetStore reader(path);roundtrip=roundtrip&&reader.load()&&reader.entries().size()==1&&reader.entries()[0].settings==dlss;+ std::ifstream header(path);std::string magic;unsigned version=0;roundtrip=roundtrip&&bool(header>>magic>>version)&&version==(model?31:21);+ ok&=roundtrip;std::cout<<"DLSS model="<<model<<" schema="<<version<<" roundtrip="<<roundtrip<<'\n';+ }std::cout<<"preset roundtrip, all fields, duplicate, rename-default, delete, validation, unknown schema, corrupt-preservation="<<ok<<'\n';return ok?0:1;}