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++
fix: implement true dual RTX super resolution and restore 8K
Veyra Goal Agente61e497ade9c
diff --git a/AGENTS.md b/AGENTS.mdindex ff7cac3b..0d9ecc76 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -1,5 +1,7 @@# Veyra Agent 工作规则+> **2026-10-28最新用户纠偏(覆盖下面同日早期两条)**:当前分支`codex/dual-sr-20261028`,实施真正的“基础SR→降低第一次AI结果→第二次SR”;双重开关位于基础超分下,展开独立第二设置,默认关闭。普通8K保持原规则,撤回强制4K参数修正/拦截;新双重图按WDDM预算拒绝不足的分配,不偷偷缩小尺寸。当前双重仅RTX视频超分,两次真实Evaluate;本机SDK共享Feature,不宣称两个独立SDK实例。实际验证与限制读`docs/DUAL_SR_PLAN_2026-10-28.md`及`reports/dual-sr-20261028/FINAL.json`。不重跑原8K最终输出+NR+VFG危险组合,根因未证实;不改真实配置、不合并main、不push/Release。+> 2026-10-28后续:用户报告接手测试版在1080p先降/8K最终输出时整机卡住重启。当前修复分支`codex/sr-stage-freeze-20261028`,依据`docs/SR_STAGE_FREEZE_2026-10-28.md`;原存档同时开NR与VFG 2X,不得再无防护重跑原组合。当前将三段式SR的NR/FG最终输出限制到4K,保留8K内部超分;这不是底层驱动挂死已根治的证明。真实用户会话仅只读及保全,不直接修改;私有副本验证。无合并main/push/Release授权。> 2026-10-28当前任务:用户授权接手Claude的单层RTX视频超分功能,继续使用`claude/sr-stage-20261028`与现有施工树。范围是先降/超分/再缩的单层链,按`docs/SR_STAGE_HANDOFF_2026-10-28.md`续接;不自动扩展多层,不合并main、不push、不Release。接手前未提交改动已归档,原生NR先行/较小输出边界与导出协议需以本轮回执为准。diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.mdindex 5bca91ad..478145d6 100644--- a/docs/CURRENT_STATUS.md+++ b/docs/CURRENT_STATUS.md@@ -10,9 +10,9 @@## 本轮整理结果与开发入口-**2026-10-28新增开发分支:**当前施工树在`claude/sr-stage-20261028`,用户要求接手Claude完成单层RTX视频超分的“先降到→超分到→再缩到”。已补NR先行/较小输出的尺寸校验及导出协议,定向验收与收尾见[接手记录](SR_STAGE_HANDOFF_2026-10-28.md)。尚未合入main或发布;正式版本仍2.1.1,不把本分支内容计入现有发布包。独立的`claude/capture-fps-audio-20261027`不属于本轮,未顺带合并。+**2026-10-28当前开发分支:**`codex/dual-sr-20261028`。按用户最新纠偏完成“基础超分→降低第一次AI结果→第二次超分”;基础下方开关展开第二次设置,列表/节点一致,当前双重支持RTX视频超分。普通8K保持原规则,撤回先前4K限制;新双重图按WDDM预算准入,不改用户请求尺寸。GPU实测每帧两次Evaluate、第二输入确来自第一次结果,普通8K和实际导出通过,保存/界面/翻译回归见[当前交付记录](DUAL_SR_PLAN_2026-10-28.md)。尚未合入main或发布,正式版仍2.1.1;独立`claude/capture-fps-audio-20261027`未混入。-**后续卡死防护:**当前施工树已转到`codex/sr-stage-freeze-20261028`。用户在1080p先降/8K最终输出+NR+VFG 2X组合遇到整机卡死重启,原接手版不再推荐。现保留8K内部SR,将新三段式链的NR/FG最终处理输出限制到4K,做原子参数修正、旧会话恢复和底层分配前拒绝;私有配置短时文件组合验证通过。具体GPU/驱动阻塞根因未证实,未重跑原危险组合,不宣称原组合稳定,详见[卡死后续记录](SR_STAGE_FREEZE_2026-10-28.md)。+此前单层接手和4K防护现为历史:[接手记录](SR_STAGE_HANDOFF_2026-10-28.md)、[原卡死诊断](SR_STAGE_FREEZE_2026-10-28.md)。原8K最终输出+NR+VFG整机卡死的具体根因未证明,本轮未重跑该危险组合;短测和预算准入不能冒充驱动挂死已根治。- 项目整理1–4由用户明确授权执行,起点main `7bf02d4`;结构整理提交`d4b1034`,构建与相关回归已通过。本轮以main作为后续开发入口,准确整合HEAD见执行任务FINAL回执。- 已清43退休产物目录、移除89干净旧工作树、归档122分支引用;工作树101→12,收尾施工分支移除后本地分支132→10。保留的旧分支是6脏树、2条Lecram暂停线和1条带独有忽略内容的旧诊断线,另加main。diff --git a/docs/DUAL_SR_PLAN_2026-10-28.md b/docs/DUAL_SR_PLAN_2026-10-28.mdnew file mode 100644index 00000000..3b121e61--- /dev/null+++ b/docs/DUAL_SR_PLAN_2026-10-28.md@@ -0,0 +1,62 @@+# 真正的双重超分:纠偏与交付(2026-10-28)++## 用户合同++用户明确纠正:普通8K超分继续可用;双重超分必须先完成基础超分,再降低其输出的分辨率,最后执行第二次超分。基础超分下方增加“ 双重超分 ”开关,开启才展开第二次设置。此指令覆盖此前单层“先降→超分→再缩”和最终4K限制;旧报告仅保留诊断与当时验证事实。++施工分支 `codex/dual-sr-20261028`,起点 `67d0294`,存档 `checkpoint/pre-dual-sr-20261028`。同一施工树、同一构建/运行目录;不合并main、不push、不Release。不改真实配置、SDK、模型、DLL、驱动或独立采集分支,Lecram继续暂停。++## 实际链路与界面++`源画面 → 基础RTX视频超分 → 基础AI输出 → 线性光面积降采样 → 第二次RTX视频超分 → 后续效果/输出`。++基础目标和质量保持原字段。新增独立开关、第二次目标、第二次质量;第二次降低尺寸提供720/900/1080/1440p,以及按第一次结果的50–90%手动比例。第二目标提供2K/4K/5K/6K/7K/8K。维持宽高比,不对已经更大的源强行缩小基础SR。第二输入必须小于第一次输出和第二次目标;无有效降低时保留基础处理并显示原因。++列表与节点共用SrStageEditor;基础目标、运动来源、质量下方放双重超分开关,第二次设置随开关展开/收起。关闭后不使用旧先降/再缩字段干预基础超分;不自动将8K改成4K。当前双重功能仅支持RTX视频超分,其他基础后端保留原单次路径,界面明确禁用原因。++ResolutionPlan、固定链计划、实际GPU纹理、状态尺寸、导出共享同一合同。第一AI结果有独立RGBA8/FP16纹理,面积降采样读取其FP16结果;第二次不重新读取原始源。HDR在第一次SR后先做现有代理恢复,再降采样、第二次SR与恢复;不宣称模型原生HDR推理。++## SDK实例与失败修正++首次真实GPU测试遇到NGX `0xBAD00003 / FeatureAlreadyExists`,失败证据保留在 `reports/dual-sr-20261028/gpu-create-key-before.json` 和对应日志。本机SDK即使传入不同创建尺寸仍复用创建键。现在优先创建两个实例;明确收到此返回码时,不取得或释放重复句柄,复用已有Feature,按GPU命令顺序执行两次Evaluate。两个输入/输出纹理及质量参数分别传入,两次都成功才累计两次计数。其他创建/评估错误仍失败,不用普通缩放伪装第二次AI。++本机是“一个SDK Feature、两次实际Evaluate”,不能写成两个独立SDK实例。API合同参考本地nvsdk_ngx.h及[NVIDIA NGX文档](https://docs.nvidia.com/ngx/latest/programming-guide/index.html),未下载或修改运行时。++## 显存与整机卡死的边界++撤回先前的4K强制修正、恢复时改参数和底层4K拦截。双重图在分配前读取WDDM预算,纹理估算包含第一次输出;额外预留RTX SR 256MiB、NR启用时1GiB、VFG启用时每工作像素128字节,再留可用预算20%余量。不足则拒绝事务,不改请求分辨率。该预留是保守估算,不是SDK显存峰值测量。普通单次路径保持原预算规则,未额外收紧普通8K准入。++原整机卡死转储的事实仍见[旧报告](SR_STAGE_FREEZE_2026-10-28.md):驱动/系统绘图路径阻塞的候选地址、异常重启,具体根因未证实。本轮未重跑8K最终输出+NR+VFG的原危险组合;预算防护与短测不能证明驱动挂死已根治。++## 保存与导出++- PresetStore v34、PresetLibrary v17、ChainSession v12保存独立第二次设置;旧格式继续读取,未使用新字段时保留旧编码。库/会话使用`.dual-sr`旁路文件,旧文件字节不变。+- 播放模式切换、节点脱离单例/恢复、页面重置均携带/重置第二设置;关闭第二次后的无效字段编辑不触发GPU重建。+- 导出worker共享参数布局新增字段,协议12→13,防止不匹配的进程解释新布局。导出使用同一处理图,不按预览策略丢源帧。++## 本轮验证与证据++构建:复用 `tmp/claude-sr-stage-20261028/build/build.py`,MSVC/Ninja并发2,每次≤900秒;产品和相关测试全部构建。测试每进程≤300秒,任务私有data-dir/log/TEMP,无真实采集卡占用。++| 验证 | 实际结果 |+|---|---|+| EffectChain、PresetLibrary、RepairPreset | 全部退出0;两次尺寸、8K不截断、关闭不重建、新旧格式往返及旧文件保护 |+| GPU双重处理 | 每帧两次Evaluate;第二输入对第一次FP16结果的面积平均,最大差1个8bit量化单位 |+| GPU尺寸 | 基础4K→1080p→第二4K、基础8K→1080p→第二4K、相同创建键均完成两次处理 |+| HDR | 第一次恢复后再缩小,第二次输出有限数值;非原生HDR模型质量认证 |+| 普通8K | 双重关闭,实际输出7680×4320,旧先降/再缩字段不改变结果 |+| 实际列表/节点UI | 开关默认收起、展开第二设置、独立目标/质量、关闭恢复基础;节点第二8K实际输出;无QML创建/绑定错误 |+| 实际导出 | 1080p→基础4K→1080p→第二2K;H.264/NVENC,4源帧全部编码,ffprobe为2560×1440/4帧 |+| QtQuick / 翻译 | 117通过、0失败、1既有跳过;2691条词条,缺失/占位符0 |++新增4K双重SR+NR+VFG 2X文件组合短测约12秒,三个效果实际激活,保持两次SR及请求的4K输出;末段本机读数显存4054MiB、WDDM预算11175MiB,累计处理275源帧。此为RTX5070/1080p30合成文件的软件读数,不是原危险8K组合或真实采集验收。++复验曾遇到旧测试断言仍要求已退休的`srOutput`触发重建,已改为检验其不干预处理;重复运行复用了上次故意损坏的预设/旁路文件,导致旧格式用例失败,runner改用每次唯一TEMP和fixture路径后全通过。失败JSON/日志保留为`cpu-recheck-before.*`,不掩盖失败。旧`sr-stage-ui.qml`/`sr-stage-safety-ui.*`和GPU `stage*`模式保留供历史追溯,当前双重验收使用`dual-sr-ui.qml`及GPU `dual`模式。++验收原始回执在 `E:/项目/Veyra/reports/dual-sr-20261028`,GUI回执在 `reports/codex-dual-sr-20261028`;日志对应 `logs/`。第一次SDK创建失败保留,未用后续成功覆盖。真实界面截图 `tests/codex-dual-sr-20261028/dual-controls.png`。++运行目录复用 `E:/项目/Veyra/tests/claude-sr-stage-20261028/app`。EXE/QML以新文件替换,禁止写穿正式供体硬链接;运行依赖逐SHA核验。此目录为本地测试构建,正式2.1.1发行资产未更新。最终二进制摘要、保护检查和测试回执统一见本任务FINAL.json。++交互测试入口在 `E:/项目/Veyra/tests/dual-sr-20261028/启动双重超分测试.cmd`,使用独立interactive-profile,关闭自动恢复/预热,不修改原配置。避免直接打开共享运行目录时自动恢复用户此前的高负载会话。++未做长时动态画质、所有显卡/驱动、实卡输入或原8K NR/VFG组合验收;不承诺双重超分必然提升画质或没有任何缺陷。diff --git a/docs/README.md b/docs/README.mdindex a14de26d..b553b573 100644--- a/docs/README.md+++ b/docs/README.md@@ -9,5 +9,6 @@5. [分支与工作树归档](BRANCH_ARCHIVE.md):保留项、已退休分支tip与恢复方法。6. [2.1.1用户更新说明](RELEASE_NOTES_2.1.1.md) 与 [对应源码/构建](BUILD_2.1.1.md)。7. [界面代码与职责边界](ARCHITECTURE.md):桥接模块与QML组件从哪里找。+8. [当前双重超分施工](DUAL_SR_PLAN_2026-10-28.md):基础SR→降低AI结果→第二次SR;覆盖同日早期单层方案与4K限制。历史方案、排查和发行过程集中在[历史索引](history/INDEX.md)。旧路径对照[PATH_MAP.json](history/PATH_MAP.json);这些历史文件中的“当前/未合并/未发布”按原日期解释。diff --git a/docs/SR_STAGE_FREEZE_2026-10-28.md b/docs/SR_STAGE_FREEZE_2026-10-28.mdindex ff16f533..6fdba513 100644--- a/docs/SR_STAGE_FREEZE_2026-10-28.md+++ b/docs/SR_STAGE_FREEZE_2026-10-28.md@@ -1,5 +1,7 @@# 三段式超分整机卡死:证据与防护(2026-10-28)+> **已被同日用户纠偏取代**:以下4K强制限制已撤回,当前分支为`codex/dual-sr-20261028`,普通8K与真正双重SR见[当前方案](DUAL_SR_PLAN_2026-10-28.md)。本报告保留原卡死证据和当时防护测试事实,不作为当前产品规则或原故障已修复证明。+用户在接手版`cf84762`选择“先降1080p→超分8K”后整机卡住并重启。此前短时SR测试不能证明这个完整组合稳定;该接手版不再作为推荐测试构建。当前修复分支`codex/sr-stage-freeze-20261028`,不合并main、不push、不Release。## 已确认的事实diff --git a/docs/SR_STAGE_HANDOFF_2026-10-28.md b/docs/SR_STAGE_HANDOFF_2026-10-28.mdindex a8244f4d..ea38296b 100644--- a/docs/SR_STAGE_HANDOFF_2026-10-28.md+++ b/docs/SR_STAGE_HANDOFF_2026-10-28.md@@ -1,5 +1,7 @@# 单层三段式超分接手记录(2026-10-28)+> **同日后续纠偏**:本文单层“先降→超分→再缩”现为历史。当前实现是基础SR→降低第一次AI结果→第二次SR,普通8K不做4K限制,见[真正双重SR](DUAL_SR_PLAN_2026-10-28.md)。旧验证只证明当时实现,不代表当前链已验。+> 后续用户在8K最终输出+NR+VFG组合遇到整机卡死;本记录仅保留当时短测事实,不能作为该组合稳定的依据。当前测试目录已更新为防护版,证据、限制与验证见[整机卡死后续记录](SR_STAGE_FREEZE_2026-10-28.md)。用户要求接手 Claude 未完成的超分功能。已阅读其对话与现场改动,按最后确认的范围完成:**单层、RTX 视频超分,先降到 → 超分到 → 再缩到**。没有把本轮扩成多层、多次 AI 推理、DLSS/FSR 三段式或细节混合。分支 `claude/sr-stage-20261028`,基线 `7b0b64b`;本轮不合并 main、不推送、不发布。diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex a0753c70..561cd9e5 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -57,3 +57,23 @@ GPU首次runner的stdout路径重名,前组stdout被覆盖;各组exit/末尾复用既有MSVC/Ninja构建并发2,修复后产品和相关测试52.3秒构建通过。checks.py四组通过;EffectChain新增7项防护检查,QtQuick117/0/1跳过,i18n缺失/占位符0。sr-stage-safety-ui.py复制用户三个会话文件到私有profile,禁止自动恢复/预热,只开本地4K文件;7项断言通过,原会话SHA不变,NR/SR/VFG真实全开、内部8K/最终4K,日志无8K工作图,出帧约12秒后正常退出。未占用采集卡,也未复测原8K NR/VFG危险组合或声称长时稳定/底层驱动问题根治。当前EXE在tests/claude-sr-stage-20261028/app原位置已更新;测试注入Main.qml恢复,97个运行依赖与正式供体逐SHA一致。诊断、离线工具和最终回执在reports/sr-stage-freeze-20261028,测试日志在logs同名目录;源文档docs/SR_STAGE_FREEZE_2026-10-28.md。无main合并、push、Release,不改SDK/驱动/模型/真实用户配置。++## 2026-10-28 真正双重超分纠偏++用户纠正了前述实现:要基础SR完成后降低其AI结果,再执行第二次SR;普通8K必须可用,第二设置放基础超分下的展开开关。新分支codex/dual-sr-20261028从67d0294开始,checkpoint/pre-dual-sr-20261028;本段覆盖上段单层语义和4K强制规则,保留旧故障证据。++实现独立第一输出RGBA8/FP16→线性面积降采样→第二RTX SR,两次Evaluate与质量参数独立;列表/节点共用开关及第二降低尺寸、50–90%比例、2K–8K目标、质量。默认关闭,旧先降/再缩字段不再改变基础SR,撤回4K限制与恢复时改参数。仅新双重图采用WDDM预算+SDK估算预留+20%余量准入,不静默缩小尺寸;普通单次沿用原预算规则。预设34/库17/会话12、独立.dual-sr旁路文件、导出worker协议13同步。++实际GPU首次双实例创建遇到FeatureAlreadyExists(0xBAD00003),已保留gpu-create-key-before证据。按SDK返回码复用已有Feature,不取得/释放重复句柄;同一命令序列两次实际Evaluate、不同输入输出纹理,其他错误失败。本机一个SDK Feature执行两次,不宣称两个独立实例。补无效第二目标的计划拒绝,按创建逆序释放资源。++构建命令:python -X utf8 -B E:/项目/Veyra/tmp/claude-sr-stage-20261028/build/build.py 后跟产品/相关测试目标,MSVC/Ninja并发2;完整核心209.6秒,后续增量111.8/95.2/23.3秒及小目标均退出0。日志在logs/claude-sr-stage-20261028/build-*。stage_app.py以新文件替换EXE/QML,不写穿正式供体链接。++验证:reports/dual-sr-20261028/checks.py cpu/gpu、finish_checks.py qml/export,以及scripts/acceptance/sr-stage-ui.py 本地1080p30文件 --task codex-dual-sr-20261028 --fixture dual-sr-ui.qml。三组CPU全部通过;GPU每帧2次、第二输入对第一次AI结果面积平均最大差1LSB、基础8K→1080p→第二4K、相同创建键、HDR恢复、关闭双重后的真正8K均通过。实际worker/NVENC H.264导出4源帧/4编码帧,ffprobe2560×1440/4帧。QtQuick117通过/0失败/1既有跳过;翻译2691条缺失/占位符0,diff检查通过。++UI真实运行核对列表与节点的展开/关闭、两次参数独立、第二8K不改基础4K、普通8K实际输出;最后4K双重+NR+VFG2X组合约12秒短测激活三效果、末段累计275源帧、显存4054MiB/WDDM预算11175MiB,正常退出,无QML错误。截图tests/codex-dual-sr-20261028/dual-controls.png,非截图模拟控件。++复验失败保留cpu-recheck-before.json及三个原日志:旧断言仍要求退休的srOutput触发重建,已按新产品合同改成不重建;测试runner重复用了旧故意损坏文件/旁路,改成每次唯一TEMP/fixture后全部通过。旧stage*诊断模式仅作历史,当前验收用dual模式。++交付沿用tests/claude-sr-stage-20261028/app;独立interactive-profile入口tests/dual-sr-20261028/启动双重超分测试.cmd,禁自动恢复/预热,不改原设置。AGENTS(活动树与E盘共享)、CURRENT_STATUS、文档索引及旧报告已标记最新纠偏。详细合同、命令与边界见docs/DUAL_SR_PLAN_2026-10-28.md,最终摘要/保护检查在reports/dual-sr-20261028/FINAL.json。++未复测原8K最终输出+NR+VFG危险组合,不宣称整机卡死具体根因已证实或驱动挂死根治。当前双重仅RTX视频超分,未扩为所有显卡/模型/实卡/长时画质验收。不复制新完整运行包,仅复用现有运行目录;新增小型测试、日志和证据实际逻辑字节见FINAL,未测本轮净物理占用/回收。正式2.1.1资产、SDK/模型/DLL/驱动不改,不合并main、不push/Release,Lecram暂停。diff --git a/i18n/catalog.json b/i18n/catalog.jsonindex a41d8227..896a3a38 100644--- a/i18n/catalog.json+++ b/i18n/catalog.json@@ -1470,13 +1470,6 @@"en": "NR layer ","ja": "NR 層 "},- {- "zh": "NR 或补帧开启时,三段式超分的最终处理尺寸最高 4K;选择更高超分目标会同时设为再缩到 4K。",- "src": "qml/SrStageEditor.qml",- "zh-TW": "NR 或補幀開啟時,三段式超分的最終處理尺寸最高 4K;選擇更高超分目標會同時設為再縮到 4K。",- "en": "With NR or frame generation enabled, three-step SR is limited to a 4K final processing size. Higher SR targets also select a 4K output fit.",- "ja": "NR またはフレーム生成が有効な場合、3段階超解像の最終処理解像度は最大4Kです。それ以上の超解像目標を選ぶと、出力は同時に4Kへ縮小されます。"- },{"zh": "NR 求值 %1 / NVOF %2","src": "src/ui/bridge/Export.cpp",@@ -1968,11 +1961,11 @@"ja": "RTX ビデオ超解像"},{- "zh": "RTX 视频超分档位",- "src": "qml/NodePage.qml",- "zh-TW": "RTX 影片超解析檔位",- "en": "RTX Video Super Resolution level",- "ja": "RTX ビデオ超解像のレベル"+ "zh": "RTX 视频超分,独立于基础超分质量",+ "src": "qml/SrStageEditor.qml",+ "zh-TW": "RTX 視訊超分,獨立於基礎超分品質",+ "en": "RTX Video SR, independent of the base SR quality",+ "ja": "RTX Video SR。基本超解像とは独立した品質設定"},{"zh": "RX 9000 · lmxxf(实验)",@@ -2751,13 +2744,6 @@"en": "Don't wait","ja": "待たない"},- {- "zh": "不缩",- "src": "qml/SrStageEditor.qml",- "zh-TW": "不縮",- "en": "No downscale",- "ja": "縮小しない"- },{"zh": "不补偿","src": "qml/ProDisplayPanel.qml",@@ -3255,6 +3241,13 @@"en": "The host was not ready to stream for a long time. Make sure it is on and the network works.","ja": "ホストが長時間ストリーミングの準備ができていません。電源とネットワークを確認してください。"},+ {+ "zh": "二次处理比例",+ "src": "qml/SrStageEditor.qml",+ "zh-TW": "二次處理比例",+ "en": "Second-pass scale",+ "ja": "2回目の処理倍率"+ },{"zh": "交流群","src": "qml/SettingsPage.qml",@@ -3780,6 +3773,13 @@"en": "Allow tearing","ja": "ティアリングを許可"},+ {+ "zh": "先完成基础超分,再将结果降低分辨率并执行第二次超分;两次执行独立,会增加耗时和显存。",+ "src": "qml/SrStageEditor.qml",+ "zh-TW": "先完成基礎超分,再將結果降低解析度並執行第二次超分;兩次執行獨立,會增加耗時和顯存。",+ "en": "Finish base SR, reduce its result, then run SR again. The two evaluations increase GPU time and memory.",+ "ja": "基本超解像の結果を縮小し、2回目の超解像を実行します。GPU時間とメモリ使用量が増加します。"+ },{"zh": "先整理文件,再按顺序导出","src": "qml/ExportPage.qml",@@ -3808,13 +3808,6 @@"en": "Choose a resolution first, then a frame rate and pixel format supported at that resolution.","ja": "先に解像度を選択し、その解像度で対応するフレームレートとピクセル形式を選択してください。"},- {- "zh": "先降到",- "src": "qml/SrStageEditor.qml",- "zh-TW": "先降到",- "en": "Shrink first to",- "ja": "先に縮小"- },{"zh": "先降到 / 再缩到目前仅 RTX 视频超分支持","src": "src/ui/bridge/Enhancement.cpp",@@ -3822,20 +3815,6 @@"en": "Shrink first / Fit after are available with RTX Video Super Resolution only for now","ja": "先に縮小 / 後で縮小は現在 RTX ビデオ超解像のみ対応しています"},- {- "zh": "先降到未生效:片源不大于所选尺寸,或先降后已不能再放大",- "src": "src/ui/bridge/Status.cpp",- "zh-TW": "先降到未生效:片源不大於所選尺寸,或先降後已不能再放大",- "en": "Shrink first not applied: the source is not larger than the chosen size, or nothing would be left to enlarge after shrinking",- "ja": "先に縮小は適用されていません:ソースが選択サイズ以下か、縮小後に拡大する余地がありません"- },- {- "zh": "先降比例",- "src": "qml/SrStageEditor.qml",- "zh-TW": "先降比例",- "en": "Shrink scale",- "ja": "縮小率"- },{"zh": "光流","src": "qml/NodePage.qml",@@ -4237,18 +4216,11 @@"ja": "再ストリーミングするときはオン推奨:Veyra が前面になくても転送を続けます。オンの間は、この PC で他のソフトを使っていてもコントローラーが PS5 を操作します"},{- "zh": "再缩到",+ "zh": "再次降低到","src": "qml/SrStageEditor.qml",- "zh-TW": "再縮到",- "en": "Fit after to",- "ja": "後で縮小"- },- {- "zh": "再缩到未生效:只在超分放大后、且小于超分结果时执行",- "src": "src/ui/bridge/Status.cpp",- "zh-TW": "再縮到未生效:只在超解析放大後、且小於超解析結果時執行",- "en": "Fit after not applied: it runs only after an enlarging upscale, and only to a size smaller than the upscaled result",- "ja": "後で縮小は適用されていません:超解像で拡大した後、その結果より小さいサイズにのみ実行します"+ "zh-TW": "再次降低到",+ "en": "Reduce the first result to",+ "ja": "基本結果を縮小"},{"zh": "写入封装文件头",@@ -5062,6 +5034,20 @@"en": "Two lines are not shrunk automatically; more styles in subtitle settings","ja": "2 行表示は自動縮小しません。その他のスタイルは字幕設定で"},+ {+ "zh": "双重超分",+ "src": "qml/SrStageEditor.qml",+ "zh-TW": "雙重超分",+ "en": "Double super resolution",+ "ja": "2段階超解像"+ },+ {+ "zh": "双重超分目前使用 RTX 视频超分",+ "src": "qml/SrStageEditor.qml",+ "zh-TW": "雙重超分目前使用 RTX 視訊超分",+ "en": "Double SR currently uses RTX Video SR",+ "ja": "2段階超解像は現在RTX Video SRを使用します"+ },{"zh": "反馈问题","src": "qml/SettingsPage.qml",@@ -5853,6 +5839,13 @@"en": "Basic controls","ja": "基本設定"},+ {+ "zh": "基础超分的输出尺寸;关闭双重超分时保持原有单次超分。",+ "src": "qml/SrStageEditor.qml",+ "zh-TW": "基礎超分的輸出尺寸;關閉雙重超分時保持原有單次超分。",+ "en": "Base SR output size. With Double SR off, the original single-pass behavior is preserved.",+ "ja": "基本超解像の出力サイズです。2段階超解像をオフにすると、従来の1回の処理を維持します。"+ },{"zh": "填充裁切","src": "qml/ProDisplayPanel.qml",@@ -6560,13 +6553,6 @@"en": "Live preview; settings apply to every file","ja": "リアルタイムプレビュー。設定はすべてのファイルに適用"},- {- "zh": "实际尺寸",- "src": "qml/SrStageEditor.qml",- "zh-TW": "實際尺寸",- "en": "Actual sizes",- "ja": "実際のサイズ"- },{"zh": "实际运行:FSR %1 · 2X","src": "src/ui/bridge/FrameGeneration.cpp",@@ -7246,13 +7232,6 @@"en": "Color preset saved: %1","ja": "カラープリセットを保存しました:%1"},- {- "zh": "已保留内部超分目标,并将三段式超分的 NR/补帧最终处理尺寸设为 4K,避免恢复高负载组合。",- "src": "src/ui/bridge/Export.cpp",- "zh-TW": "已保留內部超分目標,並將三段式超分的 NR/補幀最終處理尺寸設為 4K,避免恢復高負載組合。",- "en": "The internal SR target is preserved. Final NR/frame-generation processing is fitted to 4K to avoid restoring the high-load combination.",- "ja": "内部の超解像目標を保持し、NR/フレーム生成の最終処理解像度を4Kに設定しました。高負荷の組み合わせを復元しないための制限です。"- },{"zh": "已停止","src": "qml/CaptureSourceDialog.qml",@@ -9529,13 +9508,6 @@"en": "Rename failed: the name cannot be empty, longer than 48 characters, or the same as another preset","ja": "名前の変更に失敗しました:空、48 文字超、または既存のプリセットと同じ名前にはできません"},- {- "zh": "放大时重建细节;原尺寸时修复视频文件和串流的压缩伪影,无压缩的采集卡格式在原尺寸不运行;开启先降到后,片源已达目标也会执行。效果取决于片源。",- "src": "qml/SrStageEditor.qml",- "zh-TW": "放大時重建細節;原尺寸時修復影片檔案和串流的壓縮偽影,無壓縮的擷取卡格式在原尺寸不執行;開啟先降到後,片源已達目標也會執行。效果取決於片源。",- "en": "Reconstructs detail when upscaling; at native size it reduces compression artifacts in video files and streams, and does not run for uncompressed capture-card formats. With Shrink first on, it also runs when the source already meets the target. Results depend on the source.",- "ja": "拡大時は細部を再構成し、元の解像度では動画ファイルとストリームの圧縮ノイズを軽減します。非圧縮のキャプチャーカード形式では元の解像度で実行しません。「先に縮小」がオンの場合は、ソースが目標に達していても実行します。効果はソースにより異なります。"- },{"zh": "效果","src": "qml/ColourPanel.qml",@@ -12441,13 +12413,6 @@"en": "Declared source peak %1 nit, curve cap %2 nit: %3","ja": "ソースの公称ピーク %1 nit、カーブ上限 %2 nit:%3"},- {- "zh": "片源本身糊时,先缩小再超分,RTX 视频超分更容易重建细节;会损失片源中真实的高分辨率细节(如原生 4K 的 HUD、字幕)。",- "src": "qml/SrStageEditor.qml",- "zh-TW": "片源本身糊時,先縮小再超解析,RTX 影片超解析更容易重建細節;會損失片源中真實的高解析度細節(如原生 4K 的 HUD、字幕)。",- "en": "When the source itself is soft, shrinking before upscaling lets RTX Video Super Resolution rebuild detail more easily; real high-resolution detail in the source (such as native 4K HUD or subtitles) is lost.",- "ja": "ソース自体がぼやけている場合、先に縮小してから超解像すると RTX ビデオ超解像が細部を再構成しやすくなります。ソース本来の高解像度の細部(ネイティブ 4K の HUD や字幕など)は失われます。"- },{"zh": "片源没有携带亮度信息","src": "qml/ProDisplayPanel.qml",@@ -12882,13 +12847,6 @@"en": "Monitoring overlay compatibility","ja": "モニタリングソフト互換"},- {- "zh": "目前仅 RTX 视频超分支持",- "src": "qml/SrStageEditor.qml",- "zh-TW": "目前僅 RTX 影片超解析支援",- "en": "RTX Video Super Resolution only for now",- "ja": "現在は RTX ビデオ超解像のみ対応"- },{"zh": "目前只支持 RTX 50 系列:40/30 系的多帧解锁只适用于原版运行库","src": "src/ui/bridge/FrameGeneration.cpp",@@ -12903,6 +12861,13 @@"en": "Target","ja": "対象"},+ {+ "zh": "目标尺寸",+ "src": "qml/SrStageEditor.qml",+ "zh-TW": "目標尺寸",+ "en": "Target size",+ "ja": "目標サイズ"+ },{"zh": "目标已失效","src": "src/ui/bridge/Capture.cpp",@@ -12938,13 +12903,6 @@"en": "Target lines","ja": "目標の行数"},- {- "zh": "目标须大于片源尺寸;已达到目标时不执行超分。",- "src": "qml/SrStageEditor.qml",- "zh-TW": "目標須大於片源尺寸;已達到目標時不執行超解析度。",- "en": "The target must exceed the source size. Upscaling is skipped when the source already meets the target.",- "ja": "入力より大きい目標解像度が必要です。入力が目標以上の場合は超解像処理を行いません。"- },{"zh": "直接打开 HTTP、HTTPS 或 RTSP 视频流,例如 IPTV 或摄像机地址","src": "qml/NetworkSourceDialog.qml",@@ -13190,6 +13148,27 @@"en": "Endpoint open","ja": "エンドポイントを開きました"},+ {+ "zh": "第二次超分到",+ "src": "qml/SrStageEditor.qml",+ "zh-TW": "第二次超分到",+ "en": "Second SR target",+ "ja": "2回目の超解像目標"+ },+ {+ "zh": "第二次超分未执行:再次降低后的尺寸须小于基础超分结果及第二次目标。",+ "src": "src/ui/bridge/Status.cpp",+ "zh-TW": "第二次超分未執行:再次降低後的尺寸須小於基礎超分結果及第二次目標。",+ "en": "Second SR was not applied: its reduced input must be smaller than the base result and the second target.",+ "ja": "2回目の超解像は未実行です。縮小後の入力は、基本結果と2回目の目標より小さくする必要があります。"+ },+ {+ "zh": "第二次超分质量",+ "src": "qml/SrStageEditor.qml",+ "zh-TW": "第二次超分品質",+ "en": "Second SR quality",+ "ja": "2回目の超解像品質"+ },{"zh": "等待 PS5 登录 PIN 超时,请重新连接。","src": "src/source/RemotePlaySessionSource.cpp",@@ -15640,20 +15619,6 @@"en": "SR 4K · NR 1 layer · FG 2X","ja": "超解像 4K · NR 1 層 · フレーム生成 2X"},- {- "zh": "超分到",- "src": "qml/SrStageEditor.qml",- "zh-TW": "超解析到",- "en": "Upscale to",- "ja": "超解像の目標"- },- {- "zh": "超分到更大尺寸后按面积缩回,相当于超采样;只在超分放大后执行。8K 超分耗时显著增加。",- "src": "qml/SrStageEditor.qml",- "zh-TW": "超解析到更大尺寸後按面積縮回,相當於超取樣;只在超解析放大後執行。8K 超解析耗時顯著增加。",- "en": "Upscales to a larger size, then area-averages back down, like supersampling; runs only after an enlarging upscale. 8K upscaling takes much more GPU time.",- "ja": "より大きなサイズへ超解像してから面積平均で縮小します(スーパーサンプリング相当)。超解像で拡大した場合のみ実行します。8K の超解像は処理時間が大きく増えます。"- },{"zh": "超分算法","src": "qml/NodePage.qml",@@ -15670,7 +15635,7 @@},{"zh": "超分运动来源",- "src": "qml/NodePage.qml",+ "src": "qml/SrStageEditor.qml","zh-TW": "超解析運動來源","en": "Super resolution motion source","ja": "超解像のモーション入力"@@ -17341,6 +17306,13 @@"en": "Gyro","ja": "ジャイロ"},+ {+ "zh": "降低的是基础超分后的画面,不是原始输入;选项必须小于基础结果和第二次超分目标。",+ "src": "qml/SrStageEditor.qml",+ "zh-TW": "降低的是基礎超分後的畫面,不是原始輸入;選項必須小於基礎結果和第二次超分目標。",+ "en": "This reduces the base SR result, not the original input. Select a size below both the base result and the second SR target.",+ "ja": "基本超解像の結果を縮小します。元の入力ではありません。基本結果と2回目の目標の両方より小さいサイズを選択してください。"+ },{"zh": "隐藏播放条","src": "qml/TopDock.qml",@@ -17385,7 +17357,7 @@},{"zh": "零运动会限制时序重建;RTX 视频超分不使用此输入",- "src": "qml/NodePage.qml",+ "src": "qml/SrStageEditor.qml","zh-TW": "零運動會限制時序重建;RTX 影片超解析不使用此輸入","en": "Zero motion limits temporal reconstruction; RTX Video Super Resolution does not use this input","ja": "ゼロモーションは時間方向の再構成を制限します。RTX ビデオ超解像はこの入力を使いません"@@ -17740,13 +17712,6 @@"en": "Must stay below the maximum","ja": "上限より低くしてください"},- {- "zh": "须小于超分目标",- "src": "qml/SrStageEditor.qml",- "zh-TW": "須小於超解析目標",- "en": "Must be smaller than the upscale target",- "ja": "超解像の目標より小さい必要があります"- },{"zh": "预算 ","src": "qml/ProPage.qml",diff --git a/include/veyra/engine/EffectChain.h b/include/veyra/engine/EffectChain.hindex c237a148..fce4e931 100644--- a/include/veyra/engine/EffectChain.h+++ b/include/veyra/engine/EffectChain.h@@ -181,6 +181,8 @@ struct ChainExecutionRequest {// Three-step SR as it runs (callers pass Off/Target where it does not apply).pipeline::SrPrescale srPrescale = pipeline::SrPrescale::Off;pipeline::SrOutput srOutput = pipeline::SrOutput::Target;+ bool dualSrEnabled = false;+ pipeline::SrTarget dualSrTarget = pipeline::SrTarget::Uhd4K;};struct ChainExecutionStep {EffectType type = EffectType::NrEnhance;@@ -212,6 +214,9 @@ struct ChainGlobalSettings {uint32_t dlssSrModel = 0; // EnhancementSettings::dlssSrModelpipeline::SrPrescale srPrescale = pipeline::SrPrescale::Off; // EnhancementSettings::srPrescalepipeline::SrOutput srOutput = pipeline::SrOutput::Target; // EnhancementSettings::srOutput+ bool dualSrEnabled = false;+ pipeline::SrTarget dualSrTarget = pipeline::SrTarget::Uhd4K;+ uint32_t dualSrQuality = 4;FrameGenerationBackend 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 f2450964..4f4d47f3 100644--- a/include/veyra/engine/EnhancementSettings.h+++ b/include/veyra/engine/EnhancementSettings.h@@ -341,10 +341,14 @@ struct EnhancementSettings {pipeline::SrTarget srTarget=pipeline::SrTarget::Uhd4K;uint32_t videoSrQuality=kDefaultVideoSrQuality; // 0 DLSS SR; 1–4 RTX Video SRuint32_t dlssSrModel=0; // DLSS SR only; see kDlssSrModelCount- // Three-step SR (user 2026-10-28): shrink to srPrescale, SR to srTarget,- // then fit into srOutput. Off/Target keep the single step.+ // Base SR uses srTarget; the optional second SR has its own target/quality.+ // srPrescale now lowers the first AI result only when dualSrEnabled.+ // srOutput is retained for reading the older experimental presets.pipeline::SrPrescale srPrescale=pipeline::SrPrescale::Off;pipeline::SrOutput srOutput=pipeline::SrOutput::Target;+ bool dualSrEnabled=false;+ pipeline::SrTarget dualSrTarget=pipeline::SrTarget::Uhd4K;+ uint32_t dualSrQuality=4;uint32_t multiplier=1;FrameGenerationBackend frameGenerationBackend=FrameGenerationBackend::Dlss;// NvVFX Mode: Low=0, Medium=1 (default), High=2; mixed tiers 3-5, see vfgPrimaryMode().@@ -426,7 +430,11 @@ struct EnhancementSettings {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(!sr||!srStageBackend(videoSrQuality)){active.srPrescale=defaults.srPrescale;active.srOutput=defaults.srOutput;}+ if(!sr||!srStageBackend(videoSrQuality)||!dualSrEnabled){+ active.srPrescale=defaults.srPrescale;active.srOutput=defaults.srOutput;+ active.dualSrEnabled=false;active.dualSrTarget=defaults.dualSrTarget;active.dualSrQuality=defaults.dualSrQuality;+ }+ active.srOutput=defaults.srOutput; // retired post-fit never changes the running graphif(multiplier<=1){active.frameGenerationBackend=defaults.frameGenerationBackend;active.vfgQuality=defaults.vfgQuality;active.fgMotion=defaults.fgMotion;active.fgStrictAdmission=defaults.fgStrictAdmission;@@ -568,6 +576,7 @@ struct EnhancementSettings {if(!pipeline::validSrTarget(srTarget))return "invalid SR target";if(!pipeline::validSrPrescale(srPrescale))return "invalid SR prescale";if(!pipeline::validSrOutput(srOutput))return "invalid SR output";+ if(!pipeline::validSrTarget(dualSrTarget)||dualSrQuality<1||dualSrQuality>4)return "invalid second SR target or quality";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";// 0 = auto quality; explicit values are capped at 300 Mbps so a typodiff --git a/include/veyra/engine/GraphDescription.h b/include/veyra/engine/GraphDescription.hindex e70fe1bd..ef637e78 100644--- a/include/veyra/engine/GraphDescription.h+++ b/include/veyra/engine/GraphDescription.h@@ -65,13 +65,13 @@ struct StageRequest {const ChainRuntimeOrder* nodeOrder=nullptr; // paired with this settings transaction};-// Three-step SR runs on RTX Video SR (NVIDIA) only; every other backend keeps-// the single step whatever the saved fields say.+// Double SR runs on RTX Video SR (NVIDIA) only; every other backend keeps+// its existing single pass, regardless of saved second-pass fields.inline pipeline::SrPrescale runningSrPrescale(const EnhancementSettings& s,bool nvidiaAdapter){- return nvidiaAdapter&&srStageBackend(s.videoSrQuality)?s.srPrescale:pipeline::SrPrescale::Off;+ return nvidiaAdapter&&srStageBackend(s.videoSrQuality)&&s.dualSrEnabled?s.srPrescale:pipeline::SrPrescale::Off;}inline pipeline::SrOutput runningSrOutput(const EnhancementSettings& s,bool nvidiaAdapter){- return nvidiaAdapter&&srStageBackend(s.videoSrQuality)?s.srOutput:pipeline::SrOutput::Target;+ (void)s;(void)nvidiaAdapter;return pipeline::SrOutput::Target;}// Fills the stage, size and parameter fields of `desc` from `settings`.@@ -122,13 +122,16 @@ inline pipeline::ResolutionPlan describeStages(const StageRequest& request,constauto plan=pipeline::ResolutionPlan::make({request.width,request.height},request.sr,boundedAmd?pipeline::NrSizePolicy::Realtime:policy,(request.stillImage||request.exportJob)&&!boundedAmd,settings.revision,settings.srTarget,lowLatency,- request.amdNr&¤tNrRuntime(settings.nrRuntime)==NrRuntime::LmxxfAmd?1080u:0u,srPrescale,srOutput);+ request.amdNr&¤tNrRuntime(settings.nrRuntime)==NrRuntime::LmxxfAmd?1080u:0u,srPrescale,srOutput,+ settings.dualSrEnabled&&request.nvidiaAdapter&&srStageBackend(settings.videoSrQuality),settings.dualSrTarget);if(request.exportJob&&!request.stillImage)plan.nr=exportNrProcessingExtent(plan.base,settings.nrRuntime,policy);desc.sourceWidth=request.width;desc.sourceHeight=request.height;desc.workWidth=plan.base.width;desc.workHeight=plan.base.height;desc.srInputWidth=plan.srInput.width;desc.srInputHeight=plan.srInput.height;desc.srOutputWidth=plan.srOutput.width;desc.srOutputHeight=plan.srOutput.height;+ desc.dualSr=plan.dualSrApplied;desc.dualSrQuality=settings.dualSrQuality;+ desc.firstSrWidth=plan.firstSrOutput.width;desc.firstSrHeight=plan.firstSrOutput.height;desc.nrWidth=plan.nr.width;desc.nrHeight=plan.nr.height;desc.flowWidth=plan.flow.width;desc.flowHeight=plan.flow.height;// RTX Video SR can restore compressed video at its original resolution.@@ -186,7 +189,8 @@ inline pipeline::ResolutionPlan describeStages(const StageRequest& request,const}ChainExecutionPlan execution;const auto validation=compileChainExecutionPlan(chain,{{request.width,request.height},settings.srTarget,- request.stillImage,request.exportJob,boundedAmd,srPrescale,srOutput},execution);+ request.stillImage,request.exportJob,boundedAmd,desc.dualSr?srPrescale:pipeline::SrPrescale::Off,+ pipeline::SrOutput::Target,desc.dualSr,settings.dualSrTarget},execution);if(!validation.accepted){desc.fixedExecutionPlanError=validation.message;return plan;}if(request.nodeOrder){// Node order owns the first NR stage, even for an ordinary resize or@@ -207,7 +211,8 @@ inline pipeline::ResolutionPlan describeStages(const StageRequest& request,constexportNrProcessingExtent(plan.base,settings.nrRuntime,size):pipeline::ResolutionPlan::make({request.width,request.height},request.sr,size,request.stillImage,settings.revision,settings.srTarget,lowLatency,- request.amdNr&¤tNrRuntime(settings.nrRuntime)==NrRuntime::LmxxfAmd?1080u:0u,srPrescale,srOutput).nr);+ request.amdNr&¤tNrRuntime(settings.nrRuntime)==NrRuntime::LmxxfAmd?1080u:0u,srPrescale,srOutput,+ desc.dualSr,settings.dualSrTarget).nr);}desc.fixedExecutionPlan=execution;return plan;diff --git a/include/veyra/engine/SrStageSafety.h b/include/veyra/engine/SrStageSafety.hdeleted file mode 100644index 1d6f8d1b..00000000--- a/include/veyra/engine/SrStageSafety.h+++ /dev/null@@ -1,14 +0,0 @@-#pragma once-#include "veyra/engine/EnhancementSettings.h"-namespace veyra::engine {-// Atomic settings edit: never submit a transient 8K NR/FG graph while the user-// is selecting an 8K SR target before selecting its smaller output.-inline bool boundSrStageOutput(EnhancementSettings& s,pipeline::Extent source){- if(!s.sr||!srStageBackend(s.videoSrQuality)||(!s.nr&&s.multiplier<=1))return false;- if(!source.valid())source={3840,2160};- const auto p=pipeline::srStageExtents(source,s.srTarget,s.srPrescale,s.srOutput);- if(!pipeline::unsafeSrStageOutput(source,p.input,p.evaluated,p.output,true))return false;- s.srOutput=pipeline::SrOutput::Uhd4K;- return true;-}-}diff --git a/include/veyra/ngx/VideoSrBackend.h b/include/veyra/ngx/VideoSrBackend.hindex 9f0de000..2afc7448 100644--- a/include/veyra/ngx/VideoSrBackend.h+++ b/include/veyra/ngx/VideoSrBackend.h@@ -8,12 +8,15 @@ namespace veyra::ngx {class VideoSrBackend {public:~VideoSrBackend(){release();}- bool create(NgxCoreHost&,ID3D12GraphicsCommandList*);+ bool create(NgxCoreHost&,ID3D12GraphicsCommandList*,unsigned width=0,unsigned height=0,unsigned outWidth=0,unsigned outHeight=0);bool evaluate(ID3D12GraphicsCommandList*,ID3D12Resource*,ID3D12Resource*,unsigned);bool release();+ const void* identity() const { return handle_; }+ bool duplicateCreation() const { return duplicateCreation_; }private:NgxCoreHost* core_=nullptr;NVSDK_NGX_Parameter* params_=nullptr;NVSDK_NGX_Handle* handle_=nullptr;+ bool duplicateCreation_=false;};}diff --git a/include/veyra/pipeline/EnhanceGraph.h b/include/veyra/pipeline/EnhanceGraph.hindex e8f05273..4da5b6be 100644--- a/include/veyra/pipeline/EnhanceGraph.h+++ b/include/veyra/pipeline/EnhanceGraph.h@@ -129,6 +129,8 @@ struct EnhanceGraphDesc {// Three-step SR (RTX Video SR): what SR reads after the prescale and what it// writes before the output fit. Zero: SR reads the source and writes the work extent.uint32_t srInputWidth=0,srInputHeight=0,srOutputWidth=0,srOutputHeight=0;+ bool dualSr=false;+ uint32_t firstSrWidth=0,firstSrHeight=0,dualSrQuality=4;uint32_t fgMultiplier=2;engine::FrameGenerationBackend frameGenerationBackend=engine::FrameGenerationBackend::Dlss;uint32_t vfgQuality=1;@@ -418,12 +420,6 @@ struct EnhanceGraphDesc {interNrColorTarget(parameter)<engine::kMaxNrInstances;}std::string_view validateFixedExecutionPlan() const {- if(enableSr&&engine::srStageBackend(videoSrQuality)&&- unsafeSrStageOutput({sourceWidth,sourceHeight},- {srInputWidth?srInputWidth:sourceWidth,srInputHeight?srInputHeight:sourceHeight},- {srOutputWidth?srOutputWidth:workWidth,srOutputHeight?srOutputHeight:workHeight},- {workWidth,workHeight},enableNr||enableFg))- return "three-step SR with NR/FG requires an output fit of 4K or smaller";if(!fixedExecutionPlanError.empty())return fixedExecutionPlanError;if(!fixedExecutionPlan)return {};using engine::EffectType;@@ -728,6 +724,7 @@ public:ID3D12Resource* diagnosticPreSrProtection() const { return preSrProtectionRgba_.Get(); }ID3D12Resource* diagnosticInterNrProtection() const { return interNrProtectionRgba_.Get(); }ID3D12Resource* diagnosticVideoSrInput() const { return videoSrInput_.Get(); }+ ID3D12Resource* diagnosticFirstSrLinear() const { return firstSrLinear_.Get(); }ID3D12Resource* diagnosticVideoSrOutput() const { return videoSrOutput_.Get(); }ID3D12Resource* diagnosticNrLayerInput(size_t index) const { return index < nrInstances_.size() ? nrInstances_[index]->input() : nullptr; }ID3D12Resource* diagnosticNrLayerOutput(size_t index) const { return index < nrInstances_.size() ? nrInstances_[index]->fullTarget() : nullptr; }@@ -820,7 +817,7 @@ private:uint32_t srcW_ = 0, srcH_ = 0, workW_ = 3840, workH_ = 2160;uint32_t srInW_ = 0, srInH_ = 0, srOutW_ = 0, srOutH_ = 0; // RTX Video SR input/result- bool srPrescaleActive()const{return srInW_!=srcW_||srInH_!=srcH_;}+ bool srPrescaleActive()const{return srInW_!=(desc_.dualSr?desc_.firstSrWidth:srcW_)||srInH_!=(desc_.dualSr?desc_.firstSrHeight:srcH_);}bool srResolveActive()const{return srOutW_!=workW_||srOutH_!=workH_;}uint32_t nrW_=0,nrH_=0;uint32_t nvofW_ = 0, nvofH_ = 0, rawW_ = 0, rawH_ = 0, nvofGrid_ = 4, selectedGrid_ = 4;@@ -845,6 +842,7 @@ private:ComPtr<ID3D12Resource> workRgba_;ComPtr<ID3D12Resource> videoSrInput_,videoSrOutput_;ComPtr<ID3D12Resource> srPrescaled_; // linear SR input after the three-step prescale+ ComPtr<ID3D12Resource> firstSrInput_,firstSrOutput_,firstSrLinear_;ComPtr<ID3D12Resource> videoHdrInput_,videoHdrOutput_;ComPtr<ID3D12Resource> residualRgba_,nrFlow_,baseFlow_;ComPtr<ID3D12Resource> preSrProtectionRgba_;@@ -905,6 +903,7 @@ private:float toneMapPeakNits_=0; // latched per graph/source; never varies with frame brightnessComputePass rgbPass_,hdrVideoSrPass_;ComputePass srPrescalePass_,srResolvePass_; // three-step SR area shrink before / after RTX Video SR+ ComputePass firstSrRestorePass_;ComputePass downsamplePass_,residualPass_,stackProtectionPass_,flowAdaptPass_;ComputePass flowRefinePass_,flowFillPass_,fgFlowAdaptPass_,flowClaimPass_;// Stage-5 output stabiliser (anti-flicker). Constructed only when the@@ -1034,6 +1033,7 @@ private:std::unique_ptr<guidance::AmdOpticalFlow> amdOf_;std::unique_ptr<guidance::GpuDisOpticalFlow> gpuDis_;std::unique_ptr<ngx::VideoSrBackend> videoSrBackend_;+ std::unique_ptr<ngx::VideoSrBackend> firstVideoSrBackend_;std::unique_ptr<ngx::TrueHdrBackend> videoHdrBackend_;std::unique_ptr<ngx::DlssFgBackend> fgBackend_;std::unique_ptr<gfx::FsrFgPresenter> fsrFgBackend_;diff --git a/include/veyra/pipeline/ResolutionPlan.h b/include/veyra/pipeline/ResolutionPlan.hindex b2e77858..9a049fe6 100644--- a/include/veyra/pipeline/ResolutionPlan.h+++ b/include/veyra/pipeline/ResolutionPlan.h@@ -76,14 +76,6 @@ struct SrStageExtents {bool prescaleIneffective=false,outputIneffective=false;bool enlarges()const{return evaluated!=input;}};-// Field failure 2026-10-28: a three-step SR result also became the full NR/FG-// working extent (8K + NR + VFG). Keep the new combination bounded until that-// full-size path has independent stability evidence. The SR evaluation itself-// may still be 8K; only downstream NR/FG textures must fit the 4K pixel budget.-inline bool unsafeSrStageOutput(Extent source,Extent input,Extent evaluated,Extent output,bool downstreamEffects){- const bool staged=input!=source||evaluated!=output;- return downstreamEffects&&staged&&uint64_t(output.width)*output.height>3840ull*2160;-}inline SrStageExtents srStageExtents(Extent source,SrTarget target,SrPrescale prescale=SrPrescale::Off,SrOutput output=SrOutput::Target){// Fit into the box, enlarging only: the single-step SR size rule.const auto enlarge=[](Extent from,Extent box){@@ -116,21 +108,36 @@ struct ResolutionPlan {Extent source,base,nr,flow,fg,output;// What SR reads and writes. Single-step SR: srInput==source, srOutput==base.Extent srInput,srOutput;+ Extent firstSrOutput;+ bool dualSrApplied=false;bool srApplied=false;bool srPrescaleIneffective=false,srOutputIneffective=false;uint64_t settingsRevision=0;static ResolutionPlan make(Extent source,bool sr,NrSizePolicy policy,bool exporting,uint64_t revision=0,SrTarget target=SrTarget::Uhd4K,bool nrBeforeSr=false,unsigned manualHeightBudget=0,- SrPrescale prescale=SrPrescale::Off,SrOutput output=SrOutput::Target) {+ SrPrescale prescale=SrPrescale::Off,SrOutput output=SrOutput::Target,+ bool dual=false,SrTarget secondTarget=SrTarget::Uhd4K) {if(!source.valid())throw std::invalid_argument("invalid SDR source extent");if(!validSrTarget(target))throw std::invalid_argument("invalid SR target");if(!validNrSizePolicy(policy))throw std::invalid_argument("invalid NR size policy");if(!validSrPrescale(prescale)||!validSrOutput(output))throw std::invalid_argument("invalid SR prescale or output");+ if(!validSrTarget(secondTarget))throw std::invalid_argument("invalid second SR target");ResolutionPlan p; p.source=source;p.base=p.srInput=p.srOutput=source;if(sr){const auto stage=srStageExtents(source,target,prescale,output);p.srInput=stage.input;p.srOutput=stage.evaluated;p.base=stage.output;p.srPrescaleIneffective=stage.prescaleIneffective;p.srOutputIneffective=stage.outputIneffective;+ if(dual){+ const auto first=srStageExtents(source,target);+ const auto second=srStageExtents(first.output,secondTarget,prescale,output);+ p.firstSrOutput=first.output;+ // A second pass needs a real reduction followed by enlargement.+ p.dualSrApplied=second.input!=first.output&&second.enlarges();+ if(p.dualSrApplied){p.srInput=second.input;p.srOutput=second.evaluated;p.base=second.output;}+ else{p.srInput=source;p.srOutput=p.base=first.output;}+ p.srPrescaleIneffective=!p.dualSrApplied;p.srOutputIneffective=second.outputIneffective;+ }}+ if(!p.firstSrOutput.valid())p.firstSrOutput=p.srOutput;p.srApplied=sr&&p.srOutput!=p.srInput;p.nr=p.base;if(nrBeforeSr&&!exporting)p.nr=source;if(!exporting&&policy!=NrSizePolicy::Native) {diff --git a/include/veyra/ui/QmlPlayerBridge.h b/include/veyra/ui/QmlPlayerBridge.hindex c12b4106..39273ffd 100644--- a/include/veyra/ui/QmlPlayerBridge.h+++ b/include/veyra/ui/QmlPlayerBridge.h@@ -395,6 +395,9 @@ class QmlPlayerBridge : public QObject {// Three-step SR (RTX Video SR). srPrescale: 0 off, 1..4 720p/900p/1080p/1440p,// 150..190 a manual 50..90 %. srOutput: 0 keep the SR result, 1 source size, 2..6 2K/4K/5K/6K/7K.Q_PROPERTY(int srPrescale READ srPrescale WRITE setSrPrescale NOTIFY settingsChanged)+ Q_PROPERTY(bool dualSrEnabled READ dualSrEnabled WRITE setDualSrEnabled NOTIFY settingsChanged)+ Q_PROPERTY(int dualSrTargetIndex READ dualSrTargetIndex WRITE setDualSrTargetIndex NOTIFY settingsChanged)+ Q_PROPERTY(int dualSrQuality READ dualSrQuality WRITE setDualSrQuality NOTIFY settingsChanged)Q_PROPERTY(int srOutput READ srOutput WRITE setSrOutput NOTIFY settingsChanged)Q_PROPERTY(bool protectionEnabled READ protectionEnabled WRITE setProtectionEnabled NOTIFY settingsChanged)Q_PROPERTY(QVariantMap protectionState READ protectionState NOTIFY protectionChanged)@@ -1038,6 +1041,12 @@ public:void setDlssSrModel(int value);QVariantList dlssSrModelChoices() const;int srPrescale() const;+ bool dualSrEnabled() const;+ void setDualSrEnabled(bool enabled);+ int dualSrTargetIndex() const;+ void setDualSrTargetIndex(int index);+ int dualSrQuality() const;+ void setDualSrQuality(int quality);void setSrPrescale(int value);int srOutput() const;void setSrOutput(int value);diff --git a/qml/Veyra/NodePage.qml b/qml/Veyra/NodePage.qmlindex df1d56d3..4bc2c9a0 100644--- a/qml/Veyra/NodePage.qml+++ b/qml/Veyra/NodePage.qml@@ -1530,22 +1530,8 @@ VPage {}}SrStageEditor { Layout.fillWidth: true; namePrefix: "node" }- VRow {- label: qsTr("超分运动来源")- hint: qsTr("零运动会限制时序重建;RTX 视频超分不使用此输入")- VSeg { options: [{id:"0",label:qsTr("零运动")},{id:"1",label:qsTr("光流")}]; current: String(veyra.srMotionSource); onPicked: id => veyra.srMotionSource = Number(id) }- }- VRow {- label: qsTr("质量")- hint: qsTr("RTX 视频超分档位")- enabled: veyra.videoSrQuality >= 1 && veyra.videoSrQuality <= 4 && Support.available(veyra, "sr")- opacity: enabled ? 1 : 0.4- VSeg {- options: [{ id: "1", label: "1" }, { id: "2", label: "2" }, { id: "3", label: "3" }, { id: "4", label: "4" }]- current: String(veyra.videoSrQuality)- onPicked: id => veyra.videoSrQuality = parseInt(id)- }- }++}}Component {diff --git a/qml/Veyra/ProPage.qml b/qml/Veyra/ProPage.qmlindex 9bd4763a..d5fbca58 100644--- a/qml/Veyra/ProPage.qml+++ b/qml/Veyra/ProPage.qml@@ -1350,27 +1350,8 @@ VPage {}}SrStageEditor { Layout.fillWidth: true; namePrefix: "list" }- VRow {- label: qsTr("超分运动来源")- hint: qsTr("零运动会限制时序重建;RTX 视频超分不使用此输入")- VSeg { options: [{id:"0",label:qsTr("零运动")},{id:"1",label:qsTr("光流")}]; current: String(veyra.srMotionSource); onPicked: id => veyra.srMotionSource = Number(id) }- }- VRow {- label: qsTr("质量")- hint: qsTr("RTX 视频超分档位")- enabled: veyra.videoSrQuality >= 1 && veyra.videoSrQuality <= 4 && Support.available(veyra, "sr")- opacity: enabled ? 1 : 0.4- VSeg {- options: [- { id: "1", label: "1" },- { id: "2", label: "2" },- { id: "3", label: "3" },- { id: "4", label: "4" }- ]- current: String(veyra.videoSrQuality)- onPicked: id => veyra.videoSrQuality = parseInt(id)- }- }++}// RTX Video HDR: SDR -> HDR before frame generation. Runsdiff --git a/qml/Veyra/SrStageEditor.qml b/qml/Veyra/SrStageEditor.qmlindex a72306cf..652c30bc 100644--- a/qml/Veyra/SrStageEditor.qml+++ b/qml/Veyra/SrStageEditor.qml@@ -1,7 +1,3 @@-// Three-step SR (user 2026-10-28): 先降到 -> 超分到 -> 再缩到, shared by the list-// page's SR card and the node page's SR node. The prescale and the output fit-// run on RTX Video SR only; with another backend those rows stay visible and-// disabled, with the reason.import QtQuickimport QtQuick.Layoutsimport "EffectSupport.js" as Support@@ -10,109 +6,68 @@ ColumnLayout {id: editorproperty string namePrefix: "list"spacing: 6- readonly property bool stageBackend: veyra.videoSrQuality >= 1 && veyra.videoSrQuality <= 4- readonly property bool stageEnabled: stageBackend && Support.available(veyra, "sr")- readonly property bool boundedOutput: stageEnabled && (veyra.nrEnabled || veyra.fgEnabled)- // SR target box height by the UI target IDs (1 2K, 2 4K, 3 8K, 4 5K, 5 6K, 6 7K).- readonly property int targetHeight: ({1: 1440, 2: 2160, 3: 4320, 4: 2880, 5: 3456, 6: 4032})[veyra.srTargetIndex] || 2160- // A manual prescale is stored as 100 + percent (50..90).- readonly property bool manualPrescale: veyra.srPrescale >= 150 && veyra.srPrescale <= 190- property int lastManualPercent: 75- Connections {- target: veyra- function onSettingsChanged() { if (editor.manualPrescale) editor.lastManualPercent = veyra.srPrescale - 100 }- }- function sized(id, label, height) {- const tooLarge = height >= targetHeight- return {id: id, label: label, disabled: tooLarge, note: tooLarge ? qsTr("须小于超分目标") : ""}- }- readonly property var prescaleChoices: [- {id: "0", label: qsTr("关闭", "off")}, sized("1", "720p", 720), sized("2", "900p", 900),- sized("3", "1080p", 1080), sized("4", "1440p", 1440), {id: "manual", label: qsTr("手动")}- ]- readonly property var outputChoices: [- {id: "0", label: qsTr("不缩"), disabled: boundedOutput && targetHeight > 2160},- {id: "1", label: qsTr("片源尺寸")}, sized("2", "2K", 1440), sized("3", "4K", 2160),- ...[sized("4", "5K", 2880), sized("5", "6K", 3456), sized("6", "7K", 4032)].map(o => Object.assign({}, o, {disabled: o.disabled || boundedOutput}))- ]-- Text {- visible: editor.boundedOutput- text: qsTr("NR 或补帧开启时,三段式超分的最终处理尺寸最高 4K;选择更高超分目标会同时设为再缩到 4K。")- color: Theme.t2; font.family: Theme.fontUi; font.pixelSize: 11- wrapMode: Text.WordWrap; Layout.fillWidth: true- }-+ readonly property bool supported: veyra.videoSrQuality >= 1 && veyra.videoSrQuality <= 4 && Support.available(veyra,"sr")+ readonly property bool manual: veyra.srPrescale >= 150 && veyra.srPrescale <= 190+ readonly property var targets: [{id:"1",label:"2K"},{id:"2",label:"4K"},{id:"4",label:"5K"},{id:"5",label:"6K"},{id:"6",label:"7K"},{id:"3",label:"8K"}]VRow {- label: qsTr("先降到")- hint: editor.stageBackend- ? qsTr("片源本身糊时,先缩小再超分,RTX 视频超分更容易重建细节;会损失片源中真实的高分辨率细节(如原生 4K 的 HUD、字幕)。")- : qsTr("目前仅 RTX 视频超分支持")- enabled: editor.stageEnabled- opacity: enabled ? 1 : 0.4- VSelect {- objectName: editor.namePrefix + "-sr-prescale"- options: editor.prescaleChoices- value: editor.manualPrescale ? qsTr("手动") : (options.find(o => o.id === String(veyra.srPrescale))?.label || "")- onPicked: id => veyra.srPrescale = id === "manual" ? 100 + editor.lastManualPercent : Number(id)- }+ label: qsTr("目标尺寸")+ hint: qsTr("基础超分的输出尺寸;关闭双重超分时保持原有单次超分。")+ VSeg { objectName: editor.namePrefix+"-sr-target"; options: editor.targets; current: String(veyra.srTargetIndex); onPicked: id => veyra.srTargetIndex=Number(id) }}VRow {- objectName: editor.namePrefix + "-sr-prescale-percent-row"- visible: editor.manualPrescale- enabled: editor.stageEnabled- opacity: enabled ? 1 : 0.4- label: qsTr("先降比例")- hint: qsTr("松开后应用 · 宽高同比例")- value: Math.round(prescaleSlider.displayedValue) + "%"- VSlider {- id: prescaleSlider- objectName: editor.namePrefix + "-sr-prescale-percent"- valueFromModel: true- resettable: true; defaultValue: 75- implicitWidth: 110- from: 50; to: 90; stepSize: 5- live: false // SR sizes rebuild the graph: commit once on release.- value: editor.manualPrescale ? veyra.srPrescale - 100 : editor.lastManualPercent- onMoved: value => veyra.srPrescale = 100 + Math.round(value)- }+ label: qsTr("超分运动来源")+ hint: qsTr("零运动会限制时序重建;RTX 视频超分不使用此输入")+ VSeg { options:[{id:"0",label:qsTr("零运动")},{id:"1",label:qsTr("光流")}]; current:String(veyra.srMotionSource); onPicked:id=>veyra.srMotionSource=Number(id) }}VRow {- label: qsTr("超分到")- hint: editor.stageBackend- ? qsTr("放大时重建细节;原尺寸时修复视频文件和串流的压缩伪影,无压缩的采集卡格式在原尺寸不运行;开启先降到后,片源已达目标也会执行。效果取决于片源。")- : qsTr("目标须大于片源尺寸;已达到目标时不执行超分。")- VSeg {- objectName: editor.namePrefix + "-sr-target"- options: [{ id: "1", label: "2K" }, { id: "2", label: "4K" }, { id: "4", label: "5K" }, { id: "5", label: "6K" }, { id: "6", label: "7K" }, { id: "3", label: "8K" }]- current: String(veyra.srTargetIndex)- onPicked: id => veyra.srTargetIndex = parseInt(id)- }+ label: qsTr("质量")+ enabled: editor.supported; opacity: enabled ? 1 : 0.4+ VSeg { objectName:editor.namePrefix+"-sr-quality"; options:[{id:"1",label:"1"},{id:"2",label:"2"},{id:"3",label:"3"},{id:"4",label:"4"}]; current:String(veyra.videoSrQuality); onPicked:id=>veyra.videoSrQuality=Number(id) }}VRow {- label: qsTr("再缩到")- hint: editor.stageBackend- ? qsTr("超分到更大尺寸后按面积缩回,相当于超采样;只在超分放大后执行。8K 超分耗时显著增加。")- : qsTr("目前仅 RTX 视频超分支持")- enabled: editor.stageEnabled+ label: qsTr("双重超分")+ hint: editor.supported ? qsTr("先完成基础超分,再将结果降低分辨率并执行第二次超分;两次执行独立,会增加耗时和显存。") : qsTr("双重超分目前使用 RTX 视频超分")+ enabled: editor.supportedopacity: enabled ? 1 : 0.4- VSelect {- objectName: editor.namePrefix + "-sr-output"- options: editor.outputChoices- value: (veyra.chain, options.find(o => o.id === String(veyra.srOutput))?.label || "")- onPicked: id => veyra.srOutput = Number(id)- }+ VSwitch { objectName: editor.namePrefix+"-dual-sr-toggle"; checked: veyra.dualSrEnabled; onToggled: checked => veyra.dualSrEnabled=checked }}- VRow {- objectName: editor.namePrefix + "-sr-stage-actual"- visible: veyra.srStageSummary.length > 0 || veyra.srStageNote.length > 0- label: qsTr("实际尺寸")- hint: veyra.srStageNote- Text {- text: veyra.srStageSummary- color: Theme.t2; font.family: Theme.fontUi; font.pixelSize: 11- wrapMode: Text.WordWrap- Layout.maximumWidth: 240+ ColumnLayout {+ objectName: editor.namePrefix+"-dual-sr-panel"+ visible: veyra.dualSrEnabled+ enabled: editor.supported+ Layout.fillWidth: true+ spacing: 6+ VRow {+ label: qsTr("再次降低到")+ hint: qsTr("降低的是基础超分后的画面,不是原始输入;选项必须小于基础结果和第二次超分目标。")+ VSelect {+ objectName: editor.namePrefix+"-sr-prescale"+ options: [{id:"1",label:"720p"},{id:"2",label:"900p"},{id:"3",label:"1080p"},{id:"4",label:"1440p"},{id:"manual",label:qsTr("手动")}]+ value: editor.manual ? qsTr("手动") : (options.find(o=>o.id===String(veyra.srPrescale))?.label||"1080p")+ onPicked: id => veyra.srPrescale=id==="manual"?175:Number(id)+ }+ }+ VRow {+ visible: editor.manual+ label: qsTr("二次处理比例")+ value: Math.round(percent.displayedValue)+"%"+ VSlider {+ id: percent; objectName: editor.namePrefix+"-sr-prescale-percent"+ valueFromModel: true; from: 50; to: 90; stepSize: 5; live: false+ value: editor.manual?veyra.srPrescale-100:75+ onMoved: value => veyra.srPrescale=100+Math.round(value)+ }+ }+ VRow {+ label: qsTr("第二次超分到")+ VSeg { objectName: editor.namePrefix+"-dual-sr-target"; options: editor.targets; current: String(veyra.dualSrTargetIndex); onPicked: id=>veyra.dualSrTargetIndex=Number(id) }+ }+ VRow {+ label: qsTr("第二次超分质量")+ hint: qsTr("RTX 视频超分,独立于基础超分质量")+ VSeg { objectName: editor.namePrefix+"-dual-sr-quality"; options:[{id:"1",label:"1"},{id:"2",label:"2"},{id:"3",label:"3"},{id:"4",label:"4"}]; current:String(veyra.dualSrQuality); onPicked:id=>veyra.dualSrQuality=Number(id) }}+ Text { text: veyra.srStageSummary; color: Theme.t2; font.family: Theme.fontUi; font.pixelSize:11; wrapMode:Text.WordWrap; Layout.fillWidth:true }+ Text { text: veyra.srStageNote; visible:text.length>0; color:Theme.t2; font.pixelSize:11; wrapMode:Text.WordWrap; Layout.fillWidth:true }}}diff --git a/scripts/acceptance/dual-sr-ui.qml b/scripts/acceptance/dual-sr-ui.qmlnew file mode 100644index 00000000..9287fd35--- /dev/null+++ b/scripts/acceptance/dual-sr-ui.qml@@ -0,0 +1,82 @@+import QtQuick+Item {+ id: test+ property string media: ""+ property bool saved: false+ function find(name) {+ let hit=null+ const walk=item=>{if(hit)return;if(item.objectName===name){hit=item;return}for(const c of item.children)walk(c)}+ walk(test.parent.parent);return hit+ }+ Timer {+ interval:500;running:test.media.length>0;repeat:true+ property int step:0+ property int ticks:0+ property int total:0+ function next(n){step=n;ticks=0}+ function check(ok,label){if(!ok)throw new Error(label);veyra.logUi("sr-stage-test","PASS "+label)}+ function settled(){return ticks>=7&&veyra.running&&!veyra.applying}+ onTriggered:{try{+ ++ticks;if(++total>200)throw new Error("bounded dual test step="+step)+ if(step===0){+ if(ticks<4)return+ veyra.muted=true;veyra.nrEnabled=false;veyra.fgEnabled=false+ veyra.srEnabled=true;veyra.videoSrQuality=1;veyra.dualSrEnabled=false;veyra.srTargetIndex=3+ veyra.openPath(test.media);next(1);return+ }+ if(step===1){+ if(!settled())return+ check(veyra.srTargetIndex===3&&veyra.outputSummary==="7680x4320","ordinary 8K remains an actual 8K output")+ check(!find("list-dual-sr-panel").visible,"second-pass settings start collapsed")+ veyra.srTargetIndex=2;next(2);return+ }+ if(step===2){+ if(!settled())return+ find("list-dual-sr-toggle").toggled(true);next(3);return+ }+ if(step===3){+ if(!settled())return+ check(veyra.dualSrEnabled&&find("list-dual-sr-panel").visible,"Double SR control expands the second-pass settings")+ check(veyra.srTargetIndex===2&&veyra.srStageSummary==="1920x1080 → 3840x2160 → 1920x1080 → 3840x2160","first SR then reduce then second SR in the running plan")+ find("list-dual-sr-quality").picked("2");find("list-dual-sr-target").picked("1");next(4);return+ }+ if(step===4){+ if(!settled())return+ check(veyra.srTargetIndex===2&&veyra.videoSrQuality===1&&veyra.dualSrTargetIndex===1&&veyra.dualSrQuality===2,"second controls do not change base target or quality")+ check(veyra.outputSummary==="2560x1440","second target owns the final output")+ test.parent.parent.grabToImage(r=>{r.saveToFile("E:/项目/Veyra/tests/codex-dual-sr-20261028/dual-controls.png");test.saved=true})+ next(45);return+ }+ if(step===45){+ if(!test.saved||ticks<3)return+ find("list-dual-sr-toggle").toggled(false);next(5);return+ }+ if(step===5){+ if(!settled())return+ check(!find("list-dual-sr-panel").visible&&veyra.outputSummary==="3840x2160"&&veyra.srStageSummary==="","disable collapses controls and restores base-only output")+ veyra.nodeMode=1;check(veyra.addEffect("sr")>=0,"add base SR to an empty node graph");veyra.navigate("node")+ veyra.videoSrQuality=1;veyra.srTargetIndex=2;next(6);return+ }+ if(step===6){+ if(!settled())return+ check(find("node-dual-sr-toggle")&&!find("node-dual-sr-panel").visible,"node editor has the same collapsed control")+ find("node-dual-sr-toggle").toggled(true);veyra.srPrescale=3;find("node-dual-sr-target").picked("3");next(7);return+ }+ if(step===7){+ if(!settled())return+ check(veyra.srTargetIndex===2&&veyra.dualSrTargetIndex===3&&veyra.outputSummary==="7680x4320","node second 8K target is independent and is not forced to 4K")+ check(veyra.srStageSummary==="1920x1080 → 3840x2160 → 1920x1080 → 7680x4320","node running sizes contain both SR operations")+ veyra.dualSrEnabled=false;veyra.nodeMode=0;veyra.navigate("pro")+ veyra.srTargetIndex=2;veyra.dualSrTargetIndex=2;veyra.dualSrEnabled=true+ veyra.nrEnabled=true;veyra.fgBackendName="vfg";veyra.fgMultiplier=2;veyra.fgEnabled=true+ next(8);return+ }+ if(step===8){+ if(ticks<24||!settled())return+ check(veyra.srActive&&veyra.nrActive&&veyra.fgActive&&veyra.fgBackendName==="vfg","bounded 4K two-pass SR with NR and VFG actually runs")+ check(veyra.outputSummary==="3840x2160"&&veyra.srStageSummary==="1920x1080 → 3840x2160 → 1920x1080 → 3840x2160","combined graph retains both SR operations and the requested 4K output")+ veyra.logUi("sr-stage-test","SR_STAGE_UI_PASS");console.log("SR_STAGE_UI_PASS");Qt.quit()+ }+ }catch(e){veyra.logUi("sr-stage-test","SR_STAGE_UI_FAIL "+e.message);console.log("SR_STAGE_UI_FAIL "+e.message);Qt.quit()}}+ }+}diff --git a/scripts/acceptance/sr-stage-ui.py b/scripts/acceptance/sr-stage-ui.pyindex 1e1a18e5..8568bc25 100644--- a/scripts/acceptance/sr-stage-ui.py+++ b/scripts/acceptance/sr-stage-ui.py@@ -1,4 +1,4 @@-"""Three-step SR rows in the real app (claude-sr-stage-20261028).+"""Double SR rows in the real app (shared claude-sr-stage-20261028 staging).Runs this tree's build in the task's staged copy (tmp stage_app.py: hard links to the2.1.1 portable donor, this build's EXE / shaders / QML), on a private profile, playing a@@ -12,6 +12,7 @@ import argparse, json, os, shutil, subprocess, sysparser=argparse.ArgumentParser()parser.add_argument('media',nargs='?',default='E:/项目/Veyra/tests/nr-manual-scale-20261024/media/nr-4k30.mp4')parser.add_argument('--task',default='claude-sr-stage-20261028')+parser.add_argument('--fixture',default='dual-sr-ui.qml')args=parser.parse_args()assert args.task.startswith(('codex-','claude-')) and '/' not in args.task and '\\' not in args.task and '..' not in args.taskB = Path('E:/项目/Veyra'); T = args.task; R = Path(__file__).resolve().parents[2]@@ -31,7 +32,9 @@ if P.exists(): shutil.rmtree(P)P.mkdir(parents=True)(P/'qml-preferences.v1.json').write_text(json.dumps(dict(language='zh-CN', autoResume=False, prewarmEnhancement=False)), 'utf8')main_src = R/'qml/Veyra/Main.qml'; main = main_src.read_text('utf8'); pos = main.rfind('}')-loader = ('\nLoader { anchors.fill: parent; source: ' + json.dumps((R/'scripts/acceptance/sr-stage-ui.qml').as_uri()) ++fixture=(R/'scripts/acceptance'/args.fixture).resolve()+assert fixture.is_relative_to((R/'scripts/acceptance').resolve()) and fixture.is_file()+loader = ('\nLoader { anchors.fill: parent; source: ' + json.dumps(fixture.as_uri()) +'; onLoaded: item.media=' + json.dumps(MEDIA.as_posix()) + ' }\n')replace(A/'qml/Veyra/Main.qml', (main[:pos] + loader + main[pos:]).encode('utf8'))env = {k: v for k, v in os.environ.items() if not k.upper().startswith(('VEYRA_', 'QT_', 'QSG_', 'QML_'))}@@ -49,7 +52,7 @@ finally:text = console.read_text('utf8', errors='replace')lines = log_file.read_text('utf8', errors='replace').splitlines() if log_file.exists() else []grab = lambda tag: [l.split('] ', 2)[-1] for l in lines if tag in l]-result = dict(exit=run.returncode, media=str(MEDIA), passed='SR_STAGE_UI_PASS' in text and 'SR_STAGE_UI_FAIL' not in text,+result = dict(exit=run.returncode, media=str(MEDIA), fixture=str(fixture), passed=run.returncode==0 and 'SR_STAGE_UI_PASS' in text and 'SR_STAGE_UI_FAIL' not in text,steps=grab('[sr-stage-test]'), videoSr=grab('[video-sr] selected'), resolution=grab('[resolution] source=')[:12],accepted=grab('accepted srTarget=')[:12],qmlErrors=[l for l in text.splitlines() if any(s in l for s in ['ReferenceError:', 'TypeError:', 'Binding loop detected', 'is not a type', 'ambiguous'])][:8],diff --git a/src/engine/EffectChain.cpp b/src/engine/EffectChain.cppindex ea40b2d3..b76116cd 100644--- a/src/engine/EffectChain.cpp+++ b/src/engine/EffectChain.cpp@@ -519,7 +519,8 @@ ChainValidation compileChainExecutionPlan(const EffectChain& chain, const ChainEconst auto validation = validateChain(chain);if (!validation.accepted) return validation;if (!request.source.valid() || !pipeline::validSrTarget(request.srTarget) ||- !pipeline::validSrPrescale(request.srPrescale) || !pipeline::validSrOutput(request.srOutput))+ !pipeline::validSrPrescale(request.srPrescale) || !pipeline::validSrOutput(request.srOutput) ||+ !pipeline::validSrTarget(request.dualSrTarget))return {false, "执行计划尺寸或超分目标非法"};// Retain storage ordinals even when an earlier instance is disabled. This@@ -537,7 +538,9 @@ ChainValidation compileChainExecutionPlan(const EffectChain& chain, const ChainEnrFirst = nrFirst && !request.stillImage && !request.exportJob;// SR processing is its evaluated size; a three-step output fit can make// the step output smaller than that.- const auto srStage = pipeline::srStageExtents(request.source, request.srTarget, request.srPrescale, request.srOutput);+ const auto resolved = pipeline::ResolutionPlan::make(request.source,true,pipeline::NrSizePolicy::Native,true,0,+ request.srTarget,false,0,request.srPrescale,request.srOutput,request.dualSrEnabled,request.dualSrTarget);+ const pipeline::SrStageExtents srStage{resolved.srInput,resolved.srOutput,resolved.base};ChainExecutionPlan plan;auto cursor = request.source;const auto append = [&](uint32_t index) {@@ -592,6 +595,7 @@ ChainGlobalSettings ChainGlobalSettings::capture(const EnhancementSettings& s) {ChainGlobalSettings c;c.srTarget = s.srTarget; c.videoSrQuality = s.videoSrQuality; c.dlssSrModel = s.dlssSrModel;c.srPrescale = s.srPrescale; c.srOutput = s.srOutput;+ c.dualSrEnabled=s.dualSrEnabled;c.dualSrTarget=s.dualSrTarget;c.dualSrQuality=s.dualSrQuality;c.fgBackend = s.frameGenerationBackend; c.flow = s.flow;c.vfgQuality=s.vfgQuality;c.opticalFlowBackend = s.opticalFlowBackend; c.amdFlowHalfResolution = s.amdFlowHalfResolution;@@ -607,6 +611,7 @@ void ChainGlobalSettings::apply(EnhancementSettings& s) const {s.hdrCurve=hdrCurve;s.hdrMetadata=hdrMetadata;s.srTarget = srTarget; s.videoSrQuality = videoSrQuality; s.dlssSrModel = dlssSrModel;s.srPrescale = srPrescale; s.srOutput = srOutput;+ s.dualSrEnabled=dualSrEnabled;s.dualSrTarget=dualSrTarget;s.dualSrQuality=dualSrQuality;s.frameGenerationBackend = fgBackend; s.flow = flow;s.vfgQuality=vfgQuality;s.opticalFlowBackend = opticalFlowBackend; s.amdFlowHalfResolution = amdFlowHalfResolution;@@ -628,6 +633,7 @@ void ChainConfiguration::apply(EnhancementSettings& s) const {bool ChainConfiguration::operator==(const ChainConfiguration& other) const {return chain == other.chain && srTarget == other.srTarget && videoSrQuality == other.videoSrQuality && dlssSrModel == other.dlssSrModel &&srPrescale == other.srPrescale && srOutput == other.srOutput &&+ dualSrEnabled==other.dualSrEnabled&&dualSrTarget==other.dualSrTarget&&dualSrQuality==other.dualSrQuality&&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@@ -728,6 +734,7 @@ bool requiresGraphRebuild(const EnhancementSettings& savedPrevious, const Enhancif (previous.srTarget != next.srTarget) return true;// Three-step SR changes what SR reads and writes.if (previous.srPrescale != next.srPrescale || previous.srOutput != next.srOutput) return true;+ if(previous.dualSrEnabled!=next.dualSrEnabled||previous.dualSrTarget!=next.dualSrTarget||previous.dualSrQuality!=next.dualSrQuality)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;diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cppindex 4ed83c74..ab664cb0 100644--- a/src/engine/EngineController.cpp+++ b/src/engine/EngineController.cpp@@ -1657,6 +1657,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sgd.workWidth!=nextDesc.workWidth||gd.workHeight!=nextDesc.workHeight||gd.nrWidth!=nextDesc.nrWidth||gd.nrHeight!=nextDesc.nrHeight||gd.flowWidth!=nextDesc.flowWidth||gd.flowHeight!=nextDesc.flowHeight||+ gd.dualSr!=nextDesc.dualSr||gd.dualSrQuality!=nextDesc.dualSrQuality||gd.firstSrWidth!=nextDesc.firstSrWidth||gd.firstSrHeight!=nextDesc.firstSrHeight||gd.srInputWidth!=nextDesc.srInputWidth||gd.srInputHeight!=nextDesc.srInputHeight||gd.srOutputWidth!=nextDesc.srOutputWidth||gd.srOutputHeight!=nextDesc.srOutputHeight)rebuild=true;bool accepted=ring.drainQueue();out={};hasOutput=false;@@ -2773,7 +2774,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sfor(size_t stage=0;stage<measured.gpu.size();++stage){const auto& sample=measured.gpu[stage];if(sample.state==diagnostics::SampleState::Measured&&sample.milliseconds&&sample.end&&sample.end!=lastGpuSampleEnd[stage]){gpuStageTimes[stage].add(*sample.milliseconds);lastGpuSampleEnd[stage]=sample.end;}}- measured.resolution=pipeline::ResolutionPlan::make({width,height},options.sr,options.snapshot().nrPolicy,isImage,options.settings.revision,options.settings.srTarget,options.settings.lowLatency&&options.nr,0,runningSrPrescale(options.settings,ctx.adapter().isNvidia),runningSrOutput(options.settings,ctx.adapter().isNvidia));measured.decodeCpuMs=decodeMs;measured.submitCpuMs=std::chrono::duration<double,std::milli>(processDone-processStart).count();measured.gpuWaitCpuMs=gpuWaitMs;measured.deadlineWaitCpuMs=frameWaitMs;measured.presentCpuMs=framePresentMs;measured.queueWatermark=out.batch.count;+ measured.resolution=pipeline::ResolutionPlan::make({width,height},options.sr,options.snapshot().nrPolicy,isImage,options.settings.revision,options.settings.srTarget,options.settings.lowLatency&&options.nr,0,runningSrPrescale(options.settings,ctx.adapter().isNvidia),runningSrOutput(options.settings,ctx.adapter().isNvidia),options.settings.dualSrEnabled&&ctx.adapter().isNvidia&&srStageBackend(options.settings.videoSrQuality),options.settings.dualSrTarget);measured.decodeCpuMs=decodeMs;measured.submitCpuMs=std::chrono::duration<double,std::milli>(processDone-processStart).count();measured.gpuWaitCpuMs=gpuWaitMs;measured.deadlineWaitCpuMs=frameWaitMs;measured.presentCpuMs=framePresentMs;measured.queueWatermark=out.batch.count;LiveStats completed;if(liveScheduler)completed=liveStats;uint64_t skipped=0;{std::lock_guard lock(mutex_);skipped=snapshot_.captureRateSkipped-rateSkippedBase;}frameFlow->update([&](auto& m){m.counters.captureReceived=captureStats.received-captureFlowBase.received;m.counters.mailboxOverwritten=captureStats.dropped-captureFlowBase.dropped;m.counters.sourceSkippedBeforeGraph=skipped;m.slotReuseWaitCount=slotWaitCount;m.slotReuseWaitMs=slotWaitMilliseconds;m.counters.commandSlotsInFlight=slotsInFlight;m.counters.commandSlotHighWater=std::max(m.counters.commandSlotHighWater,slotsInFlight);});diff --git a/src/engine/ExportJobManager.cpp b/src/engine/ExportJobManager.cppindex c040985e..c5157814 100644--- a/src/engine/ExportJobManager.cpp+++ b/src/engine/ExportJobManager.cpp@@ -32,7 +32,7 @@ struct Shared {// instead of reading a mismatched layout.// 10: 32-node chain with anti-aliasing; 11: beauty payloads and face detection.// 12: SR prescale/output fields change the shared settings layout.- static constexpr DWORD kVersion=12;+ static constexpr DWORD kVersion=13; // independent second SR parametersDWORD signature=magic,version=kVersion,bytes=sizeof(Shared);EnhancementSettings settings;EffectChain chain;diff --git a/src/engine/PresetLibrary.cpp b/src/engine/PresetLibrary.cppindex fbcfe354..8e0daa45 100644--- a/src/engine/PresetLibrary.cpp+++ b/src/engine/PresetLibrary.cpp@@ -14,7 +14,7 @@ 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,bool dlss=false,bool srStage=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,bool srStage=false,bool dual=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<<' '@@ -24,8 +24,9 @@ void writeRendering(std::ostream& out,const ChainGlobalSettings& g,bool vfg=fals<<' '<<g.hdrCurve.strengthPercent<<' '<<g.hdrCurve.displayPeakNits;if(dlss)out<<' '<<g.dlssSrModel;// Three-step SR prescale / output: library v16, session v11.- if(srStage)out<<' '<<uint32_t(g.srPrescale)<<' '<<uint32_t(g.srOutput);}-bool readRendering(std::istream& in,ChainGlobalSettings& g,bool vfg=false,bool tuning=false,bool dlss=false,bool srStage=false){+ if(srStage)out<<' '<<uint32_t(g.srPrescale)<<' '<<uint32_t(g.srOutput);+ if(dual)out<<' '<<g.dualSrEnabled<<' '<<uint32_t(g.dualSrTarget)<<' '<<g.dualSrQuality;}+bool readRendering(std::istream& in,ChainGlobalSettings& g,bool vfg=false,bool tuning=false,bool dlss=false,bool srStage=false,bool dual=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);@@ -41,6 +42,7 @@ bool readRendering(std::istream& in,ChainGlobalSettings& g,bool vfg=false,bool t}if(dlss&&(!(in>>g.dlssSrModel)||g.dlssSrModel>=kDlssSrModelCount))return false;if(srStage){uint32_t prescale=0,output=0;if(!(in>>prescale>>output))return false;g.srPrescale=pipeline::SrPrescale(prescale);g.srOutput=pipeline::SrOutput(output);}+ if(dual){int enabled=0;uint32_t target=0;if(!(in>>enabled>>target>>g.dualSrQuality)||enabled<0||enabled>1)return false;g.dualSrEnabled=enabled!=0;g.dualSrTarget=pipeline::SrTarget(target);}EnhancementSettings s;g.apply(s);return s.validate().empty();}void applyRenderingPreset(const PresetEntry& e,EnhancementSettings& s){@@ -96,6 +98,7 @@ void PresetLibrary::addBuiltins() {bool PresetLibrary::load() {error_.clear();addBuiltins();+ const auto directDual=std::filesystem::path(path_).concat(L".dual-sr");const auto directSrStage=std::filesystem::path(path_).concat(L".sr-stage");const auto directBeauty=std::filesystem::path(path_).concat(L".beauty");const auto directEffects=std::filesystem::path(path_).concat(L".effects");@@ -139,6 +142,8 @@ bool PresetLibrary::load() {const auto srStagePath=std::filesystem::path(path_).concat(L".sr-stage");if(std::filesystem::exists(directSrStage))path_=directSrStage;else if(std::filesystem::exists(srStagePath))path_=srStagePath;+ const auto dualPath=std::filesystem::path(path_).concat(L".dual-sr");+ if(std::filesystem::exists(directDual))path_=directDual;else if(std::filesystem::exists(dualPath))path_=dualPath;if (!std::filesystem::exists(path_)) return true;std::error_code ec;const auto size = std::filesystem::file_size(path_, ec);@@ -235,6 +240,8 @@ bool PresetLibrary::save() {// Opting into a new model must leave the older build's library intact.// v14 (anti-aliasing nodes, chains past 16 nodes) and v15 (beauty nodes) get their own files too.// v16 (three-step SR) as well.+ if(data.starts_with("VEYRA_PRESET_LIBRARY 17")&&!path_.wstring().ends_with(L".dual-sr"))path_=std::filesystem::path(path_).concat(L".dual-sr");+ if(!path_.wstring().ends_with(L".dual-sr")){if(data.starts_with("VEYRA_PRESET_LIBRARY 16")&&!path_.wstring().ends_with(L".sr-stage"))path_=std::filesystem::path(path_).concat(L".sr-stage");if(!path_.wstring().ends_with(L".sr-stage")){if(data.starts_with("VEYRA_PRESET_LIBRARY 15")&&!path_.wstring().ends_with(L".beauty"))path_=std::filesystem::path(path_).concat(L".beauty");@@ -265,6 +272,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");@@ -713,14 +721,16 @@ std::string PresetLibrary::encodeEntries(const std::vector<PresetEntry>& entriesreturn beautyChain(e.chain)||(e.nodeConfiguration&&(beautyChain(e.nodeConfiguration->chain)||(e.nodeConfiguration->editor&&beautyChain(e.nodeConfiguration->editor->nodes))));});// v16: three-step SR prescale / output in any stored globals.- const auto srStageOf=[](const ChainGlobalSettings& g){return g.srPrescale!=pipeline::SrPrescale::Off||g.srOutput!=pipeline::SrOutput::Target;};+ const auto srStageOf=[](const ChainGlobalSettings& g){return g.dualSrEnabled||g.dualSrTarget!=pipeline::SrTarget::Uhd4K||g.dualSrQuality!=4||g.srPrescale!=pipeline::SrPrescale::Off||g.srOutput!=pipeline::SrOutput::Target;};const bool srStage=std::any_of(entries_.begin(),entries_.end(),[&](const auto& e){if(e.globals&&srStageOf(*e.globals))return true;if(!e.nodeConfiguration)return false;const auto& c=*e.nodeConfiguration;return srStageOf(c)||(c.editor&&c.editor->globals&&srStageOf(*c.editor->globals));});- const int version=std::max(minimumVersion, srStage?16:beauty?15:effects?14: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);+ const auto dualOf=[](const ChainGlobalSettings& g){return g.dualSrEnabled||g.dualSrTarget!=pipeline::SrTarget::Uhd4K||g.dualSrQuality!=4;};+ const bool dual=std::any_of(entries_.begin(),entries_.end(),[&](const auto& e){return (e.globals&&dualOf(*e.globals))||(e.nodeConfiguration&&(dualOf(*e.nodeConfiguration)||(e.nodeConfiguration->editor&&e.nodeConfiguration->editor->globals&&dualOf(*e.nodeConfiguration->editor->globals))));});+ const int version=std::max(minimumVersion, dual?17:srStage?16:beauty?15:effects?14: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)) << ' '@@ -774,7 +784,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,version>=12,version>=16);}+ 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,version>=16,version>=17);}}if(version>=10){o<<' '<<e.flow.has_value();@@ -794,7 +804,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,16):16;+ const int allowedVersion=maxVersion>0?std::min(maxVersion,17):17;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);@@ -906,7 +916,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,version>=12,version>=16))return false;e.globals=g;+ if(!readRendering(in,g,version>=7,version>=11,version>=12,version>=16,version>=17))return false;e.globals=g;}}if(version>=10){@@ -959,10 +969,12 @@ std::string ChainSessionStore::encode(const ChainSession& session) {return n.type==EffectType::Beauty;});};const bool beauty=std::any_of(session.configurations.begin(),session.configurations.end(),[&](const auto& c){return beautyChain(c.chain)||(c.editor&&beautyChain(c.editor->nodes));});- const auto srStageOf=[](const ChainGlobalSettings& g){return g.srPrescale!=pipeline::SrPrescale::Off||g.srOutput!=pipeline::SrOutput::Target;};+ const auto srStageOf=[](const ChainGlobalSettings& g){return g.dualSrEnabled||g.dualSrTarget!=pipeline::SrTarget::Uhd4K||g.dualSrQuality!=4||g.srPrescale!=pipeline::SrPrescale::Off||g.srOutput!=pipeline::SrOutput::Target;};const bool srStage=std::any_of(session.configurations.begin(),session.configurations.end(),[&](const auto& c){return srStageOf(c)||(c.editor&&c.editor->globals&&srStageOf(*c.editor->globals));});- const int version = srStage?11:beauty?10:effects?9:nrModel?8:dlss?7:tuning?6:vfg?5:rendering?4:editor ? (editor->globals ? 3 : 2) : 1;+ const auto dualOf=[](const ChainGlobalSettings& g){return g.dualSrEnabled||g.dualSrTarget!=pipeline::SrTarget::Uhd4K||g.dualSrQuality!=4;};+ const bool dual=std::any_of(session.configurations.begin(),session.configurations.end(),[&](const auto& c){return dualOf(c)||(c.editor&&c.editor->globals&&dualOf(*c.editor->globals));});+ const int version = dual?12:srStage?11:beauty?10:effects?9: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;@@ -971,7 +983,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,version>=7,version>=11);out<<'\n';+ if(version>=4)writeRendering(out,c,version>=5,version>=6,version>=7,version>=11,version>=12);out<<'\n';PresetEntry entry;entry.name = i == 0 ? L"list" : L"node";entry.kind = ChainMode(i); entry.chain = c.chain;@@ -989,7 +1001,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,version>=7,version>=11);out<<'\n';+ << int(g.nrPolicy);if(version>=4)writeRendering(out,g,version>=5,version>=6,version>=7,version>=11,version>=12);out<<'\n';}out << graph.nextId << ' ' << graph.inputNext << ' ' << document.nodes.nodeCount << '\n';// The ordinary preset codec validates a linear runtime chain. Use a@@ -1016,7 +1028,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 > 11) || active < 0 || active > 1 || list != 1 || node < 0 || node > 1) return false;+ (version < 1 || version > 12) || 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};@@ -1027,7 +1039,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,version>=7,version>=11))return false;+ if(version>=4&&!readRendering(in,c,version>=5,version>=6,version>=7,version>=11,version>=12))return false;}if (!(in >> std::quoted(body))) return false;std::vector<PresetEntry> entries; std::wstring def, error;@@ -1052,7 +1064,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,version>=7,version>=11))return false;+ if(version>=4&&!readRendering(in,g,version>=5,version>=6,version>=7,version>=11,version>=12))return false;editor->globals = g;}uint32_t count = 0;@@ -1082,6 +1094,7 @@ bool ChainSessionStore::decode(const std::string& data, ChainSession& session, b}bool ChainSessionStore::load(ChainSession& session) {+ const auto directDual=std::filesystem::path(path_).concat(L".dual-sr");const auto directSrStage=std::filesystem::path(path_).concat(L".sr-stage");const auto directBeauty=std::filesystem::path(path_).concat(L".beauty");const auto directEffects=std::filesystem::path(path_).concat(L".effects");@@ -1123,6 +1136,8 @@ bool ChainSessionStore::load(ChainSession& session) {const auto srStagePath=std::filesystem::path(path_).concat(L".sr-stage");if(std::filesystem::exists(directSrStage,ec))path_=directSrStage;else if(std::filesystem::exists(srStagePath,ec))path_=srStagePath;+ const auto dualPath=std::filesystem::path(path_).concat(L".dual-sr");+ if(std::filesystem::exists(directDual))path_=directDual;else if(std::filesystem::exists(dualPath))path_=dualPath;const bool exists = std::filesystem::exists(path_, ec);if (!exists && !ec) return true;const auto size = std::filesystem::file_size(path_, ec);@@ -1152,6 +1167,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 12")&&!path_.wstring().ends_with(L".dual-sr"))path_=std::filesystem::path(path_).concat(L".dual-sr");+ if(!path_.wstring().ends_with(L".dual-sr")){if(data.starts_with("VEYRA_CHAIN_SESSION 11")&&!path_.wstring().ends_with(L".sr-stage"))path_=std::filesystem::path(path_).concat(L".sr-stage");if(!path_.wstring().ends_with(L".sr-stage")){if(data.starts_with("VEYRA_CHAIN_SESSION 10")&&!path_.wstring().ends_with(L".beauty"))path_=std::filesystem::path(path_).concat(L".beauty");@@ -1182,6 +1199,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.cppindex 71b62001..5b9e6f0d 100644--- a/src/engine/PresetStore.cpp+++ b/src/engine/PresetStore.cpp@@ -50,13 +50,14 @@ std::string PresetStore::serialize()const{// v33 appends the three-step SR prescale and output (2026-10-28).const bool srStage=std::any_of(entries_.begin(),entries_.end(),[](const auto& p){return p.settings.srPrescale!=pipeline::SrPrescale::Off||p.settings.srOutput!=pipeline::SrOutput::Target;});- const bool fullSchema=fsr4||higher||rendering||vfg||correction||dlss||nrModel||srStage;- const bool correctionExtended=srStage||nrModel||dlss||std::any_of(entries_.begin(),entries_.end(),[](const auto& p){+ const bool dual=std::any_of(entries_.begin(),entries_.end(),[](const auto& p){return p.settings.dualSrEnabled||p.settings.dualSrTarget!=pipeline::SrTarget::Uhd4K||p.settings.dualSrQuality!=4;});+ const bool fullSchema=fsr4||higher||rendering||vfg||correction||dlss||nrModel||srStage||dual;+ const bool correctionExtended=dual||srStage||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 "<<(srStage?33: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';+ std::ostringstream o;o.imbue(std::locale::classic());o<<std::setprecision(std::numeric_limits<float>::max_digits10)<<"VEYRA_PRESETS "<<(dual?34:srStage?33: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){@@ -75,22 +76,23 @@ 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||nrModel||srStage)o<<' '<<int(s.hdrOutputMode)<<' '<<int(s.fgMotion)<<' '<<int(s.srMotion)<<' '<<int(s.nrMotion);- if(vfg||correction||dlss||nrModel||srStage)o<<' '<<s.vfgQuality;- if(correction||dlss||nrModel||srStage){+ if(rendering||vfg||correction||dlss||nrModel||srStage||dual)o<<' '<<int(s.hdrOutputMode)<<' '<<int(s.fgMotion)<<' '<<int(s.srMotion)<<' '<<int(s.nrMotion);+ if(vfg||correction||dlss||nrModel||srStage||dual)o<<' '<<s.vfgQuality;+ if(correction||dlss||nrModel||srStage||dual){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||nrModel||srStage)o<<' '<<s.dlssSrModel;- if(nrModel||srStage){o<<' '<<s.model.performance;+ if(dlss||nrModel||srStage||dual)o<<' '<<s.dlssSrModel;+ if(nrModel||srStage||dual){o<<' '<<s.model.performance;for(unsigned i=0;i<s.nrLayerCount;++i)o<<' '<<s.nrLayers[i].model.performance;}- if(srStage)o<<' '<<uint32_t(s.srPrescale)<<' '<<uint32_t(s.srOutput);+ if(srStage||dual)o<<' '<<uint32_t(s.srPrescale)<<' '<<uint32_t(s.srOutput);+ if(dual)o<<' '<<s.dualSrEnabled<<' '<<uint32_t(s.dualSrTarget)<<' '<<s.dualSrQuality;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>33)||!(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>34)||!(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;@@ -161,6 +163,7 @@ bool PresetStore::parse(const std::string& data,std::vector<UserPreset>& out,stdif(!(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;}}if(version>=33){uint32_t prescale=0,output=0;if(!(in>>prescale>>output))return false;s.srPrescale=pipeline::SrPrescale(prescale);s.srOutput=pipeline::SrOutput(output);}+ if(version>=34){int enabled=0;uint32_t target=0;if(!(in>>enabled>>target>>s.dualSrQuality)||enabled<0||enabled>1)return false;s.dualSrEnabled=enabled!=0;s.dualSrTarget=pipeline::SrTarget(target);}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/VideoSrBackend.cpp b/src/ngx/VideoSrBackend.cppindex 006d1a3d..1194965b 100644--- a/src/ngx/VideoSrBackend.cpp+++ b/src/ngx/VideoSrBackend.cpp@@ -19,10 +19,15 @@ bool result(int op,NVSDK_NGX_Result r,unsigned seh){return ok;}}-bool VideoSrBackend::create(NgxCoreHost& core,ID3D12GraphicsCommandList* list){+bool VideoSrBackend::create(NgxCoreHost& core,ID3D12GraphicsCommandList* list,unsigned width,unsigned height,unsigned outWidth,unsigned outHeight){release();core_=&core;Status status=Status::Ok;params_=core.allocateParameters(status);if(!params_)return false;+ duplicateCreation_=false;params_->Set("CreationNodeMask",1u);params_->Set("VisibilityNodeMask",1u);- unsigned seh=0;auto r=invoke(0,list,params_,&handle_,seh);return result(0,r,seh)&&handle_;+ if(width&&height&&outWidth&&outHeight){params_->Set("Width",width);params_->Set("Height",height);params_->Set("OutWidth",outWidth);params_->Set("OutHeight",outHeight);}+ unsigned seh=0;auto r=invoke(0,list,params_,&handle_,seh);+ duplicateCreation_=!seh&&r==NVSDK_NGX_Result_FAIL_FeatureAlreadyExists;+ if(duplicateCreation_){handle_=nullptr;log::info("video-sr","create key already exists; no ownership acquired");return false;}+ return result(0,r,seh)&&handle_;}bool VideoSrBackend::evaluate(ID3D12GraphicsCommandList* list,ID3D12Resource* input,ID3D12Resource* output,unsigned quality){if(!handle_||!input||!output||quality<1||quality>4)return false;diff --git a/src/pipeline/EnhanceGraph.cpp b/src/pipeline/EnhanceGraph.cppindex bfb3c844..a7cba5c5 100644--- a/src/pipeline/EnhanceGraph.cpp+++ b/src/pipeline/EnhanceGraph.cpp@@ -590,9 +590,13 @@ bool EnhanceGraph::initialize(const EnhanceGraphDesc& desc)if((desc.srInputWidth==0)!=(desc.srInputHeight==0)||(desc.srOutputWidth==0)!=(desc.srOutputHeight==0)){veyra::log::error("resolution","partial SR extent is invalid");return false;}srInW_=desc.srInputWidth?desc.srInputWidth:srcW_;srInH_=desc.srInputHeight?desc.srInputHeight:srcH_;srOutW_=desc.srOutputWidth?desc.srOutputWidth:workW_;srOutH_=desc.srOutputHeight?desc.srOutputHeight:workH_;+ if(desc.dualSr&&(!engine::srStageBackend(desc.videoSrQuality)||desc.dualSrQuality<1||desc.dualSrQuality>4||+ !Extent{desc.firstSrWidth,desc.firstSrHeight}.valid()||!srPrescaleActive())){+ veyra::log::error("dual-sr","invalid independent SR stages or missing reduction");return false;+ }if(srPrescaleActive()||srResolveActive()){// Three-step SR: shrink, enlarge with RTX Video SR, fit into the work extent.- if(!Extent{srInW_,srInH_}.valid()||!Extent{srOutW_,srOutH_}.valid()||srInW_>srcW_||srInH_>srcH_||+ if(!Extent{srInW_,srInH_}.valid()||!Extent{srOutW_,srOutH_}.valid()||srInW_>(desc.dualSr?desc.firstSrWidth:srcW_)||srInH_>(desc.dualSr?desc.firstSrHeight:srcH_)||srOutW_<workW_||srOutH_<workH_||srOutW_<=srInW_||srOutH_<=srInH_){veyra::log::error("resolution","invalid three-step SR extent");return false;}if(!desc.enableSr||!engine::srStageBackend(desc.videoSrQuality)){veyra::log::error("resolution","three-step SR runs on RTX Video SR only");return false;}}@@ -643,13 +647,24 @@ bool EnhanceGraph::initialize(const EnhanceGraphDesc& desc)const bool vfg=fgEnabled_&&desc_.frameGenerationBackend==engine::FrameGenerationBackend::Vfg;const uint64_t vfgSharedBytes=vfg?uint64_t((workW_*4u+255u)&~255u)*workH_*(2u+2u*(desc_.fgMultiplier-1u)):0;const unsigned generatedTextures=fgEnabled_?(fsrEnabled()?2u:vfg?2u*(desc_.fgMultiplier-1u):10u):0;- const uint64_t estimate=uint64_t(workW_)*workH_*(76u+4u*generatedTextures)+vfgSharedBytes+ const uint64_t dualBytes=desc_.dualSr?uint64_t(desc_.firstSrWidth)*desc_.firstSrHeight*12u+uint64_t(srcW_)*srcH_*4u:0;+ const uint64_t estimate=dualBytes+uint64_t(workW_)*workH_*(76u+4u*generatedTextures)+vfgSharedBytes+nrTextureBytes+fullLayerBytes+uint64_t(srcW_)*srcH_*(32u+(desc_.protectionBeforeSr()?8u:0u))+temporalBytes+tailColorBytes+interProtectionBytes+(flowRefine_?uint64_t(nvofW_)*nvofH_*(flowConsistency_?13u:flowClaims_?18u:12u)+uint64_t(workW_)*workH_*4u:0);if(context_.videoMemoryInfo(budget,usage)){veyra::log::info("memory",std::format("graph lower-bound={}MiB budget={}MiB usage={}MiB; SDK allocations additional",estimate>>20,budget>>20,usage>>20));- if(usage>=budget||estimate>budget-usage){veyra::log::error("memory","insufficient adapter budget for requested graph textures");return false;}+ // Keep measured WDDM headroom for SDK-owned allocations. There is no+ // resolution cap or silent resize: reject the transaction when its+ // conservative reservation cannot fit, preserving the previous graph.+ // The new reservation belongs to the new two-pass graph. Keep the+ // existing single-pass admission policy, including ordinary 8K.+ const uint64_t sdkReserve=desc_.dualSr?((nrEnabled_?(1024ull<<20):0)++ (vfg?uint64_t(workW_)*workH_*128u:0)+(256ull<<20)):0;+ const uint64_t required=estimate+sdkReserve;+ const uint64_t available=budget>usage?budget-usage:0;+ veyra::log::info("memory",std::format("admission textures={}MiB sdkReserve={}MiB available={}MiB headroom={}%",estimate>>20,sdkReserve>>20,available>>20,desc_.dualSr?20:0));+ if(usage>=budget||required>(desc_.dualSr?available*4/5:available)){veyra::log::error("memory","insufficient adapter budget for requested graph and SDK reservation; dimensions unchanged");return false;}}Status st = Status::Ok;@@ -736,7 +751,14 @@ bool EnhanceGraph::createResources()}if(srEnabled_&&desc_.videoSrQuality&&desc_.videoSrQuality!=engine::kVideoSrFsr){videoSrInput_=makeTexture(context_.device(),srInW_,srInH_,DXGI_FORMAT_R8G8B8A8_UNORM,true);videoSrOutput_=makeTexture(context_.device(),srOutW_,srOutH_,DXGI_FORMAT_R8G8B8A8_UNORM,true);if(!videoSrInput_||!videoSrOutput_)return false;// Three-step SR: the linear SR input after the exact area shrink.- if(srPrescaleActive()&&!(srPrescaled_=makeTexture(context_.device(),srInW_,srInH_,DXGI_FORMAT_R16G16B16A16_FLOAT,true)))return false;}+ if(srPrescaleActive()&&!(srPrescaled_=makeTexture(context_.device(),srInW_,srInH_,DXGI_FORMAT_R16G16B16A16_FLOAT,true)))return false;+ if(desc_.dualSr){+ firstSrInput_=makeTexture(context_.device(),srcW_,srcH_,DXGI_FORMAT_R8G8B8A8_UNORM,true);+ firstSrOutput_=makeTexture(context_.device(),desc_.firstSrWidth,desc_.firstSrHeight,DXGI_FORMAT_R8G8B8A8_UNORM,true);+ firstSrLinear_=makeTexture(context_.device(),desc_.firstSrWidth,desc_.firstSrHeight,DXGI_FORMAT_R16G16B16A16_FLOAT,true);+ if(!firstSrInput_||!firstSrOutput_||!firstSrLinear_)return false;+ }+ }// FSR upscaling needs a render-extent depth; Veyra has no source-resolution// depth source, so this is the same explicit constant far depth the// frame-generation path uses. It limits disocclusion quality and must not@@ -1511,8 +1533,16 @@ bool EnhanceGraph::initNgxFeatures()ID3D12GraphicsCommandList* list = ring_.acquire(0, st);if (list == nullptr) { failedBackend_=engine::FailedBackend::Infrastructure; return false; }failedBackend_=engine::FailedBackend::Sr;- if(desc_.videoSrQuality){videoSrBackend_=std::make_unique<ngx::VideoSrBackend>();if(!videoSrBackend_->create(*coreHost_,list))return false;veyra::log::info("video-sr",std::format("selected quality={} input={}x{} output={}x{}{}",desc_.videoSrQuality,srcW_,srcH_,workW_,workH_,- srPrescaleActive()||srResolveActive()?std::format(" three-step prescale={}x{} evaluate={}x{}",srInW_,srInH_,srOutW_,srOutH_):std::string()));}+ if(desc_.videoSrQuality){videoSrBackend_=std::make_unique<ngx::VideoSrBackend>();if(!videoSrBackend_->create(*coreHost_,list,desc_.dualSr?srInW_:0,desc_.dualSr?srInH_:0,desc_.dualSr?srOutW_:0,desc_.dualSr?srOutH_:0))return false;veyra::log::info("video-sr",std::format("selected quality={} input={}x{} output={}x{}{}",desc_.videoSrQuality,srcW_,srcH_,workW_,workH_,+ srPrescaleActive()||srResolveActive()?std::format(" three-step prescale={}x{} evaluate={}x{}",srInW_,srInH_,srOutW_,srOutH_):std::string()));+ if(desc_.dualSr){firstVideoSrBackend_=std::make_unique<ngx::VideoSrBackend>();if(!firstVideoSrBackend_->create(*coreHost_,list,srcW_,srcH_,desc_.firstSrWidth,desc_.firstSrHeight)){+ if(!firstVideoSrBackend_->duplicateCreation())return false;+ firstVideoSrBackend_.reset();+ veyra::log::info("dual-sr","SDK create key shared; two ordered evaluations with separate textures");+ }+ if(firstVideoSrBackend_&&firstVideoSrBackend_->identity()==videoSrBackend_->identity()){veyra::log::error("dual-sr","runtime aliased the independent feature handles");return false;}+ veyra::log::info("dual-sr",std::format("passes=2 source={}x{} first={}x{} shrink={}x{} second={}x{} output={}x{} firstQuality={} secondQuality={}",srcW_,srcH_,desc_.firstSrWidth,desc_.firstSrHeight,srInW_,srInH_,srOutW_,srOutH_,workW_,workH_,desc_.videoSrQuality,desc_.dualSrQuality));}+ }else if (!srBackend_->create(*coreHost_, list, ngxParams_, sd, st) || !srBackend_->created()) {veyra::log::error("graph", "SR create failed");return false;@@ -1756,7 +1786,7 @@ bool EnhanceGraph::createComputePasses()if(!amdHdrEncodePass_.loadShader("HdrAmdNrEncode.dxil",cs)||!amdHdrEncodePass_.create(context_.device(),cs,2*nrLayerSlots,1,1))return false;if(!amdHdrRestorePass_.loadShader("HdrAmdNrRestore.dxil",cs)||!amdHdrRestorePass_.create(context_.device(),cs,4*nrLayerSlots,3,1))return false;}- if (!blitPass_.loadShader("ScaleBlit.dxil", cs) || !blitPass_.create(context_.device(), cs, 22, 1, 1)) return false;+ if (!blitPass_.loadShader("ScaleBlit.dxil", cs) || !blitPass_.create(context_.device(), cs, 27, 1, 1)) return false;// Nv12Upload stays: frame-time CopyTextureRegion is poisoned by the// injected layer (SEH in NGX evaluate, r33-final3 evidence); the compute// upload is the proven frame-path ingestion on this system.@@ -1767,7 +1797,8 @@ bool EnhanceGraph::createComputePasses()// Three-step SR: NrDownsample's exact area shrink before RTX Video SR, SrResolve after it.if(srPrescaled_&&(!srPrescalePass_.loadShader("NrDownsample.dxil",cs)||!srPrescalePass_.create(context_.device(),cs,2,1,1)))return false;if(videoSrOutput_&&srResolveActive()&&(!srResolvePass_.loadShader("SrResolve.dxil",cs)||!srResolvePass_.create(context_.device(),cs,10,3,1)))return false;- if (!stager_.initialize(context_.device(), 80)) {+ if(desc_.dualSr&&desc_.hdrWorking()&&(!firstSrRestorePass_.loadShader("HdrVideoSrRestore.dxil",cs)||!firstSrRestorePass_.create(context_.device(),cs,4,3,1)))return false;+ if (!stager_.initialize(context_.device(), 96)) {veyra::log::error("graph", "descriptor stager init failed");return false;}@@ -1947,10 +1978,22 @@ bool EnhanceGraph::createViews()// layout: (base, encoded input, SR result) at 0 source / 4 resolved SR input /// 7 shrunk input, 3 the work texture (UAV).if(srPrescaled_){- stagedSrv(srStageInput(),DXGI_FORMAT_R16G16B16A16_FLOAT,srPrescalePass_,0);+ stagedSrv(desc_.dualSr?firstSrLinear_.Get():srStageInput(),DXGI_FORMAT_R16G16B16A16_FLOAT,srPrescalePass_,0);makeUav(context_.device(),srPrescaled_.Get(),DXGI_FORMAT_R16G16B16A16_FLOAT,cpu(srPrescalePass_,1));stagedSrv(srPrescaled_.Get(),DXGI_FORMAT_R16G16B16A16_FLOAT,blitPass_,21);}+ if(desc_.dualSr){+ stagedSrv(srStageInput(),DXGI_FORMAT_R16G16B16A16_FLOAT,blitPass_,22);+ makeUav(context_.device(),firstSrInput_.Get(),DXGI_FORMAT_R8G8B8A8_UNORM,cpu(blitPass_,23));+ stagedSrv(firstSrOutput_.Get(),DXGI_FORMAT_R8G8B8A8_UNORM,blitPass_,24);+ makeUav(context_.device(),firstSrLinear_.Get(),DXGI_FORMAT_R16G16B16A16_FLOAT,cpu(blitPass_,25));+ if(desc_.hdrWorking()){+ stagedSrv(srStageInput(),DXGI_FORMAT_R16G16B16A16_FLOAT,firstSrRestorePass_,0);+ stagedSrv(firstSrInput_.Get(),DXGI_FORMAT_R8G8B8A8_UNORM,firstSrRestorePass_,1);+ stagedSrv(firstSrOutput_.Get(),DXGI_FORMAT_R8G8B8A8_UNORM,firstSrRestorePass_,2);+ makeUav(context_.device(),firstSrLinear_.Get(),DXGI_FORMAT_R16G16B16A16_FLOAT,cpu(firstSrRestorePass_,3));+ }+ }if(videoSrOutput_&&srResolveActive()){ID3D12Resource* bases[3]={srcRgba_.Get(),srStageInput(),srPrescaled_?srPrescaled_.Get():srcRgba_.Get()};const UINT sets[3]={0,4,7};@@ -2562,12 +2605,31 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frameauto runVideoSr=[&]()->bool{gpuTimer_.mark(list,GpuStage::Sr);+ if(desc_.dualSr){+ tracker_.transition(list,srStageInput(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);+ tracker_.transition(list,firstSrInput_.Get(),D3D12_RESOURCE_STATE_UNORDERED_ACCESS);+ const float encFirst[8]={uintBits(srcW_),uintBits(srcH_),uintBits(srcW_),uintBits(srcH_),desc_.hdrWorking()?3.f:1.f,0,0,0};+ blitPass_.bind(list,encFirst,gpuHandleOf(blitPass_,22).ptr,gpuHandleOf(blitPass_,23).ptr);+ list->Dispatch((srcW_+15)/16,(srcH_+15)/16,1);tracker_.uavBarrier(list,firstSrInput_.Get());+ tracker_.transition(list,firstSrInput_.Get(),D3D12_RESOURCE_STATE_COMMON);tracker_.transition(list,firstSrOutput_.Get(),D3D12_RESOURCE_STATE_COMMON);+ auto* first=firstVideoSrBackend_?firstVideoSrBackend_.get():videoSrBackend_.get();+ if(!first->evaluate(list,firstSrInput_.Get(),firstSrOutput_.Get(),desc_.videoSrQuality)){failedBackend_=engine::FailedBackend::Sr;return false;}+ tracker_.uavBarrier(list,firstSrOutput_.Get());tracker_.transition(list,firstSrOutput_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);+ tracker_.transition(list,firstSrLinear_.Get(),D3D12_RESOURCE_STATE_UNORDERED_ACCESS);+ const float decFirst[8]={uintBits(desc_.firstSrWidth),uintBits(desc_.firstSrHeight),uintBits(desc_.firstSrWidth),uintBits(desc_.firstSrHeight),-1,0,0,0};+ if(desc_.hdrWorking()){+ tracker_.transition(list,firstSrInput_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);+ firstSrRestorePass_.bind(list,decFirst,gpuHandleOf(firstSrRestorePass_,0).ptr,gpuHandleOf(firstSrRestorePass_,3).ptr);+ }else blitPass_.bind(list,decFirst,gpuHandleOf(blitPass_,24).ptr,gpuHandleOf(blitPass_,25).ptr);+ list->Dispatch((desc_.firstSrWidth+15)/16,(desc_.firstSrHeight+15)/16,1);tracker_.uavBarrier(list,firstSrLinear_.Get());+ tracker_.transition(list,firstSrLinear_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);++metrics_.srEvaluateCount;+ }// Three-step SR shrinks the resolved SR input first (exact area, linear light).const bool prescaled=srPrescaled_!=nullptr;if(prescaled){- tracker_.transition(list,srStageInput(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);+ tracker_.transition(list,desc_.dualSr?firstSrLinear_.Get():srStageInput(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);tracker_.transition(list,srPrescaled_.Get(),D3D12_RESOURCE_STATE_UNORDERED_ACCESS);- const float down[8]={uintBits(srcW_),uintBits(srcH_),uintBits(srInW_),uintBits(srInH_),0,0,0,0};+ const float down[8]={uintBits(desc_.dualSr?desc_.firstSrWidth:srcW_),uintBits(desc_.dualSr?desc_.firstSrHeight:srcH_),uintBits(srInW_),uintBits(srInH_),0,0,0,0};srPrescalePass_.bind(list,down,gpuHandleOf(srPrescalePass_,0).ptr,gpuHandleOf(srPrescalePass_,1).ptr);list->Dispatch((srInW_+15)/16,(srInH_+15)/16,1);tracker_.uavBarrier(list,srPrescaled_.Get());tracker_.transition(list,srPrescaled_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);@@ -2576,7 +2638,7 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frameconst float enc[8]={uintBits(srInW_),uintBits(srInH_),uintBits(srInW_),uintBits(srInH_),desc_.hdrWorking()?3.0f:1.0f,0,0,0};blitPass_.bind(list,enc,gpuHandleOf(blitPass_,prescaled?21:desc_.nrBeforeSr||sourcePostOutput_?18:0).ptr,gpuHandleOf(blitPass_,16).ptr);list->Dispatch((srInW_+15)/16,(srInH_+15)/16,1);tracker_.uavBarrier(list,videoSrInput_.Get());tracker_.transition(list,videoSrInput_.Get(),D3D12_RESOURCE_STATE_COMMON);tracker_.transition(list,videoSrOutput_.Get(),D3D12_RESOURCE_STATE_COMMON);- if(!videoSrBackend_->evaluate(list,videoSrInput_.Get(),videoSrOutput_.Get(),desc_.videoSrQuality)){failedBackend_=engine::FailedBackend::Sr;return false;}+ if(!videoSrBackend_->evaluate(list,videoSrInput_.Get(),videoSrOutput_.Get(),desc_.dualSr?desc_.dualSrQuality:desc_.videoSrQuality)){failedBackend_=engine::FailedBackend::Sr;return false;}tracker_.uavBarrier(list,videoSrOutput_.Get());tracker_.transition(list,videoSrOutput_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);tracker_.transition(list,workRgba_.Get(),D3D12_RESOURCE_STATE_UNORDERED_ACCESS);// HDR restore and the resolve take the base that was encoded.const UINT restoreSet=prescaled?7:desc_.nrBeforeSr||sourcePostOutput_?4:0;@@ -3662,6 +3724,7 @@ void EnhanceGraph::shutdown()fsrFgBackend_.reset();vfgBackend_.reset();if (fgBackend_) featuresReleased=fgBackend_->release()&&featuresReleased;+ if(firstVideoSrBackend_){featuresReleased=firstVideoSrBackend_->release()&&featuresReleased;firstVideoSrBackend_.reset();}if(videoSrBackend_){featuresReleased=videoSrBackend_->release()&&featuresReleased;videoSrBackend_.reset();}if(videoHdrBackend_)featuresReleased=videoHdrBackend_->release()&&featuresReleased;videoHdrBackend_.reset();videoHdrInput_.Reset();videoHdrOutput_.Reset();@@ -3748,7 +3811,7 @@ void EnhanceGraph::shutdown()fgFlowClaims_.Reset();fgFlowAgreement_.Reset();flowClaimPass_={};flowClaims_=false;for(unsigned i=0;i<kGeneratedPoolSlots;++i){if(fgDisableMapped_[i]&&fgDisableReadback_[i]){D3D12_RANGE written{0,0};fgDisableReadback_[i]->Unmap(0,&written);}fgDisableMapped_[i]=nullptr;fgDisable_[i].Reset();fgDisableReadback_[i].Reset();generatedLeases_[i].reset();genFrame_[i].Reset();}for(auto& lease:realLeases_)lease.reset();fgDisableInit_.Reset();encPass_ = ComputePass{};- blitPass_ = ComputePass{};hdrVideoSrPass_={};srPrescalePass_={};srResolvePass_={};+ blitPass_ = ComputePass{};hdrVideoSrPass_={};srPrescalePass_={};srResolvePass_={};firstSrRestorePass_={};yuvPass_ = ComputePass{};for(auto i=additionalColorInstances_.rbegin();i!=additionalColorInstances_.rend();++i)i->reset();for(auto i=nodeColorInstances_.rbegin();i!=nodeColorInstances_.rend();++i)i->reset();@@ -3788,6 +3851,7 @@ void EnhanceGraph::shutdown()proxyTex_.Reset();for(auto& r:sourceReferences_)r.Reset();for(auto& r:baseReferences_)r.Reset();workRgba_.Reset();preGradeRgba_.Reset();srcRgba_.Reset();videoSrInput_.Reset();videoSrOutput_.Reset();srPrescaled_.Reset();+ firstSrInput_.Reset();firstSrOutput_.Reset();firstSrLinear_.Reset();nrHoldPass_.reset();colorDetail_.close();chromaTex_.Reset();diff --git a/src/ui/PlayerUiFacade.cpp b/src/ui/PlayerUiFacade.cppindex 0ac7bb31..cc20c93d 100644--- a/src/ui/PlayerUiFacade.cpp+++ b/src/ui/PlayerUiFacade.cpp@@ -64,6 +64,8 @@ bool sameSnapshot(const veyra::engine::PlayerSnapshot& a, const veyra::engine::Pa.metrics.resolution.nr.height == b.metrics.resolution.nr.height &&a.metrics.resolution.output.width == b.metrics.resolution.output.width &&a.metrics.resolution.output.height == b.metrics.resolution.output.height &&+ a.metrics.resolution.firstSrOutput == b.metrics.resolution.firstSrOutput &&+ a.metrics.resolution.dualSrApplied == b.metrics.resolution.dualSrApplied &&a.metrics.resolution.srInput == b.metrics.resolution.srInput &&a.metrics.resolution.srOutput == b.metrics.resolution.srOutput &&a.metrics.resolution.srPrescaleIneffective == b.metrics.resolution.srPrescaleIneffective &&diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cppindex b9510fd1..0a3af697 100644--- a/src/ui/QmlPlayerBridge.cpp+++ b/src/ui/QmlPlayerBridge.cpp@@ -170,25 +170,9 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesystQTimer::singleShot(0, this, [this, migrationNotice] { emit notice(migrationNotice, false); });const auto savedConfiguration = restored;QStringList disabled;- bool boundedSrStage=false;for (auto& configuration : restored.configurations) {const auto reason = disableUnavailableEffects(configuration);if (!reason.isEmpty()) disabled << reason;- engine::EnhancementSettings candidate;configuration.apply(candidate);- if(engine::boundSrStageOutput(candidate,{})){- configuration.srOutput=candidate.srOutput;- if(configuration.editor&&configuration.editor->globals){- auto editor=std::make_shared<engine::NodeEditorDocument>(*configuration.editor);- editor->globals->srOutput=candidate.srOutput;- configuration.editor=std::move(editor);- }- boundedSrStage=true;- }- }- if(boundedSrStage){- const auto message=tr("已保留内部超分目标,并将三段式超分的 NR/补帧最终处理尺寸设为 4K,避免恢复高负载组合。");- veyra::log::warn("sr-stage-safety",message.toStdString());- QTimer::singleShot(0,this,[this,message]{emit notice(message,false);});}if (!disabled.isEmpty()) {const auto message = tr("已关闭当前硬件或包不支持的效果,参数仍保留:") + disabled.join("; ");diff --git a/src/ui/QmlPlayerBridge_p.h b/src/ui/QmlPlayerBridge_p.hindex 5fdbd760..0310924f 100644--- a/src/ui/QmlPlayerBridge_p.h+++ b/src/ui/QmlPlayerBridge_p.h@@ -18,7 +18,6 @@#include <QScopedValueRollback>#include "veyra/ui/EffectAvailability.h"#include "veyra/engine/FrameGenerationSelection.h"-#include "veyra/engine/SrStageSafety.h"#include "veyra/ui/QmlExportQueueModel.h"#include "veyra/ui/PlaylistModel.h"#include "veyra/ui/UpdateChecker.h"@@ -861,10 +860,6 @@ struct QmlPlayerBridge::Impl {}const auto& runtime = activeRuntime();engine::fromChain(runtime, settings);- if(engine::boundSrStageOutput(settings,snapshot.metrics.resolution.source)){- draftGlobals.srOutput=settings.srOutput;- veyra::log::warn("sr-stage-safety","bounded NR/FG output to 4K in the same settings transaction; SR target preserved");- }if (const auto reason = unavailableEffects(settings); !reason.isEmpty()) {veyra::log::warn("effect-availability", reason.toStdString());return false;@@ -907,6 +902,7 @@ struct QmlPlayerBridge::Impl {s.srTarget = previous.srTarget; s.videoSrQuality = previous.videoSrQuality;s.dlssSrModel = previous.dlssSrModel;s.srPrescale = previous.srPrescale; s.srOutput = previous.srOutput;+ s.dualSrEnabled=previous.dualSrEnabled;s.dualSrTarget=previous.dualSrTarget;s.dualSrQuality=previous.dualSrQuality;}if (!projected->firstOf(engine::EffectType::FrameGeneration)){s.frameGenerationBackend = previous.frameGenerationBackend;@@ -914,10 +910,6 @@ struct QmlPlayerBridge::Impl {}}engine::fromChain(*projected, s);- if(engine::boundSrStageOutput(s,snapshot.metrics.resolution.source)){- draftGlobals.srOutput=s.srOutput;- veyra::log::warn("sr-stage-safety","bounded node NR/FG output to 4K in the same settings transaction; SR target preserved");- }if(const auto error=s.validate();!error.empty()){veyra::log::error("qml-settings",error);validation={false,"效果参数无效,未提交;详见诊断日志"};return false;diff --git a/src/ui/bridge/Chain.cpp b/src/ui/bridge/Chain.cppindex f3b953ad..ec76f7f6 100644--- a/src/ui/bridge/Chain.cpp+++ b/src/ui/bridge/Chain.cpp@@ -573,6 +573,7 @@ bool QmlPlayerBridge::resetNode(uint id) {impl_->draftGlobals.dlssSrModel = defaults.dlssSrModel;impl_->draftGlobals.srPrescale = defaults.srPrescale;impl_->draftGlobals.srOutput = defaults.srOutput;+ impl_->draftGlobals.dualSrEnabled=false;impl_->draftGlobals.dualSrTarget=defaults.dualSrTarget;impl_->draftGlobals.dualSrQuality=defaults.dualSrQuality;}if (!impl_->revalidate(true, &previous)) {const auto error = impl_->validation.message; node = before;diff --git a/src/ui/bridge/Enhancement.cpp b/src/ui/bridge/Enhancement.cppindex 8abd3ca7..9f524c01 100644--- a/src/ui/bridge/Enhancement.cpp+++ b/src/ui/bridge/Enhancement.cpp@@ -40,6 +40,24 @@ void QmlPlayerBridge::setDlssSrModel(int value) {if (impl_->commit(s)) emit settingsChanged();}int QmlPlayerBridge::srPrescale() const { return int(settings().srPrescale); }+bool QmlPlayerBridge::dualSrEnabled() const { return settings().dualSrEnabled; }+void QmlPlayerBridge::setDualSrEnabled(bool enabled){+ auto s=settings();if(s.dualSrEnabled==enabled)return;+ if(enabled&&!engine::srStageBackend(s.videoSrQuality))return;+ s.dualSrEnabled=enabled;+ if(enabled){if(s.srPrescale==pipeline::SrPrescale::Off)s.srPrescale=pipeline::SrPrescale::P1080;s.srOutput=pipeline::SrOutput::Target;}+ if(impl_->commit(s))emit settingsChanged();+}+int QmlPlayerBridge::dualSrTargetIndex() const {+ switch(settings().dualSrTarget){case pipeline::SrTarget::Qhd:return 1;case pipeline::SrTarget::Uhd4K:return 2;case pipeline::SrTarget::Uhd8K:return 3;case pipeline::SrTarget::Uhd5K:return 4;case pipeline::SrTarget::Uhd6K:return 5;case pipeline::SrTarget::Uhd7K:return 6;}return 2;+}+void QmlPlayerBridge::setDualSrTargetIndex(int index){+ if(index<1||index>6)return;+ const pipeline::SrTarget targets[]={pipeline::SrTarget::Qhd,pipeline::SrTarget::Uhd4K,pipeline::SrTarget::Uhd8K,pipeline::SrTarget::Uhd5K,pipeline::SrTarget::Uhd6K,pipeline::SrTarget::Uhd7K};+ auto s=settings();s.dualSrTarget=targets[index-1];if(impl_->commit(s))emit settingsChanged();+}+int QmlPlayerBridge::dualSrQuality() const {return int(settings().dualSrQuality);}+void QmlPlayerBridge::setDualSrQuality(int quality){if(quality<1||quality>4)return;auto s=settings();s.dualSrQuality=uint32_t(quality);if(impl_->commit(s))emit settingsChanged();}int QmlPlayerBridge::srOutput() const { return int(settings().srOutput); }// Three-step SR runs on RTX Video SR only; other backends keep the single step.void QmlPlayerBridge::setSrPrescale(int value) {diff --git a/src/ui/bridge/Export.cpp b/src/ui/bridge/Export.cppindex 08e583b8..b752a000 100644--- a/src/ui/bridge/Export.cpp+++ b/src/ui/bridge/Export.cpp@@ -272,10 +272,7 @@ void QmlPlayerBridge::setSrTargetIndex(int index) {}if (s.srTarget == want) return;s.srTarget = want;- const auto oldOutput=s.srOutput;- if(!impl_->commit(std::move(s)))return;- if(oldOutput!=settings().srOutput&&settings().srOutput==pipeline::SrOutput::Uhd4K)- emit notice(tr("已保留内部超分目标,并将三段式超分的 NR/补帧最终处理尺寸设为 4K,避免恢复高负载组合。"),false);+ impl_->commit(std::move(s));emit settingsChanged();}diff --git a/src/ui/bridge/Status.cpp b/src/ui/bridge/Status.cppindex ef27cf9f..92b056f9 100644--- a/src/ui/bridge/Status.cpp+++ b/src/ui/bridge/Status.cpp@@ -18,10 +18,10 @@ QString QmlPlayerBridge::srStageSummary() const {const auto& s = impl_->snapshot;const auto& plan = s.metrics.resolution;if (!s.running || !plan.output.valid() || plan.settingsRevision != s.applied.revision || !plan.srApplied) return {};- if (plan.srInput == plan.source && plan.srOutput == plan.base) return {};+ if (!plan.dualSrApplied) return {};const auto size = [](pipeline::Extent e) { return QStringLiteral("%1x%2").arg(e.width).arg(e.height); };- QStringList parts{size(plan.source)};- if (plan.srInput != plan.source) parts << size(plan.srInput);+ QStringList parts{size(plan.source),size(plan.firstSrOutput)};+ parts << size(plan.srInput);parts << size(plan.srOutput);if (plan.base != plan.srOutput) parts << size(plan.base);return parts.join(QStringLiteral(" → "));@@ -31,8 +31,7 @@ QString QmlPlayerBridge::srStageNote() const {const auto& plan = s.metrics.resolution;if (!s.running || !plan.output.valid() || plan.settingsRevision != s.applied.revision) return {};QStringList notes;- if (plan.srPrescaleIneffective) notes << tr("先降到未生效:片源不大于所选尺寸,或先降后已不能再放大");- if (plan.srOutputIneffective) notes << tr("再缩到未生效:只在超分放大后、且小于超分结果时执行");+ if (plan.srPrescaleIneffective) notes << tr("第二次超分未执行:再次降低后的尺寸须小于基础超分结果及第二次目标。");return notes.join(QStringLiteral(";"));}diff --git a/tests/integration/ExportWorkflowTests.cpp b/tests/integration/ExportWorkflowTests.cppindex 760edc2c..a999d705 100644--- a/tests/integration/ExportWorkflowTests.cpp+++ b/tests/integration/ExportWorkflowTests.cpp@@ -38,6 +38,14 @@ int wmain(int argc,wchar_t** argv){const bool fsr=mode.find(L"fsr-")==0;const bool rejectXess=mode==L"reject-xess";const bool srStage=mode==L"sr-stage-fit"||mode==L"sr-stage-prescale";+ const bool dualSr=mode==L"dual-sr";+ if(dualSr){+ settings.sr=true;settings.videoSrQuality=1;settings.srMotion=MotionSource::Zero;+ settings.srTarget=veyra::pipeline::SrTarget::Uhd4K;+ settings.dualSrEnabled=true;settings.srPrescale=veyra::pipeline::SrPrescale::P1080;+ settings.dualSrTarget=veyra::pipeline::SrTarget::Qhd;settings.dualSrQuality=2;+ media.audio.policy=media.subtitles.policy=ExportTrackPolicy::None;+ }if(srStage){settings.sr=true;settings.videoSrQuality=1;settings.srMotion=MotionSource::Zero;settings.srPrescale=veyra::pipeline::SrPrescale::P1080;@@ -174,11 +182,22 @@ int wmain(int argc,wchar_t** argv){for(const auto& t:info.tracks)if(t.subtitle&&media.subtitles.count<media.subtitles.indices.size())media.subtitles.indices[media.subtitles.count++]=t.index;require(media.subtitles.count>0,"reject source has no subtitle track");}- require(manager.start(input,output,settings,hevc,srStage?4:0,-1,from,to,veyra::sink::ExportRateControl::Cq,media),"start refused");+ require(manager.start(input,output,settings,hevc,(srStage||dualSr)?4:0,-1,from,to,veyra::sink::ExportRateControl::Cq,media),"start refused");auto s=finish(manager);collected(s);std::wcout<<L"state="<<int(s.state)<<L" encoded="<<s.encoded<<L" message="<<s.message<<L"\n";if(mode.find(L"reject")!=std::wstring::npos){require(s.state==ExportState::Failed,"incompatible source was not rejected");require(!std::filesystem::exists(output),"rejection produced final file");require(!s.message.empty(),"failure reason missing");}else require(s.state==ExportState::Succeeded,"export failed");+ if(dualSr){+ require(s.encoded==4&&s.sourceFrames==4,"dual SR export lost source frames");+ require(s.frozen.dualSrEnabled&&s.frozen.dualSrTarget==settings.dualSrTarget&&+ s.frozen.dualSrQuality==2&&s.frozen.videoSrQuality==1&&+ s.frozen.srTarget==settings.srTarget&&s.frozen.srPrescale==settings.srPrescale,+ "independent SR fields lost crossing the worker protocol");+ std::ifstream log(s.workerLog);const std::string text((std::istreambuf_iterator<char>(log)),{});+ require(text.find("passes=2 source=1920x1080 first=3840x2160 shrink=1920x1080 second=2560x1440 output=2560x1440 firstQuality=1 secondQuality=2")!=std::string::npos,+ "export worker did not create the requested two SR operations");+ std::wcout<<L"DUAL_SR_EXPORT source=4 encoded=4 frozenAndEvaluated=1\n";+ }if(srStage){require(s.encoded==4&&s.sourceFrames==4,"SR stage export lost source frames");require(s.frozen.srPrescale==settings.srPrescale&&s.frozen.srOutput==settings.srOutput&&s.frozen.srTarget==settings.srTarget,diff --git a/tests/integration/SrQualityTests.cpp b/tests/integration/SrQualityTests.cppindex 3fda7f74..69b6bcdd 100644--- a/tests/integration/SrQualityTests.cpp+++ b/tests/integration/SrQualityTests.cpp@@ -172,9 +172,9 @@ Frame hdrFrame(const sink::RgbaImage& img){}return f;}-struct Run{bool ok=false;sink::RgbaImage output,srInput;double srMs=-1;uint64_t evaluations=0;pipeline::Extent srIn{},srOut{},work{};bool enabled=false;};+struct Run{bool ok=false;sink::RgbaImage output,srInput,firstLinear;double srMs=-1;uint64_t evaluations=0;pipeline::Extent srIn{},srOut{},work{};bool enabled=false;};Run run(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing& ring,const AVFrame* frame,bool hdr,const engine::EnhancementSettings& settings,- bool readSrInput,bool still=false,bool uncompressed=false,unsigned frames=6){+ bool readSrInput,bool still=false,bool uncompressed=false,unsigned frames=6,bool readFirst=false){engine::StageRequest request;request.width=unsigned(frame->width);request.height=unsigned(frame->height);request.sr=settings.sr;request.stillImage=still;request.uncompressedSource=uncompressed;request.nr=settings.nr;pipeline::EnhanceGraphDesc desc;engine::describeStages(request,settings,desc);@@ -191,7 +191,8 @@ Run run(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing& ring,const AVFrame* fif(ok){auto* tex=graph.videoFrameResource(out.videoSlot);ok=tex&&read(ctx,ring,tex,D3D12_RESOURCE_STATE_COMMON,tex->GetDesc().Format==DXGI_FORMAT_R16G16B16A16_FLOAT?8:4,r.output);}// The single-step and prescale SDR paths leave the encoded SR input in COMMON.- if(ok&&readSrInput)ok=read(ctx,ring,graph.diagnosticVideoSrInput(),D3D12_RESOURCE_STATE_COMMON,4,r.srInput);+ if(ok&&readSrInput)ok=read(ctx,ring,graph.diagnosticVideoSrInput(),hdr?D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE:D3D12_RESOURCE_STATE_COMMON,4,r.srInput);+ if(ok&&readFirst)ok=read(ctx,ring,graph.diagnosticFirstSrLinear(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE,8,r.firstLinear);r.evaluations=graph.metrics().srEvaluateCount;r.enabled=graph.srEnabled();if(!ms.empty()){std::sort(ms.begin(),ms.end());r.srMs=ms[ms.size()/2];}r.ok=ok;out={};ring.drainQueue();graph.shutdown();return r;@@ -300,6 +301,37 @@ int test(const std::filesystem::path& directory){}ring.shutdown();ctx.shutdown();std::cout<<"STAGE_RESULT passed="<<ok<<std::endl;return ok?0:1;}+int dual(const std::filesystem::path& directory){+ 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;+ bool ok=true;const auto check=[&](bool pass,const std::string& name){std::cout<<(pass?"PASS ":"FAIL ")<<name<<std::endl;ok=ok&&pass;};+ const auto image=pattern(2560,1440);const auto sdr=sdrFrame(image),hdr=hdrFrame(image);+ if(!sdr||!hdr)return 2;+ auto s=vsr(1,pipeline::SrTarget::Uhd4K);s.dualSrEnabled=true;s.srPrescale=pipeline::SrPrescale::P1080;s.dualSrTarget=pipeline::SrTarget::Uhd4K;s.dualSrQuality=2;+ const auto two=run(ctx,ring,sdr.get(),false,s,true,false,false,3,true);+ check(two.ok&&two.evaluations==6&&two.firstLinear.width==3840&&two.srInput.width==1920&&two.work==pipeline::Extent{3840,2160},"two independent AI evaluations per frame, with first 4K output retained");+ if(two.ok){+ const auto expected=shrink(two.firstLinear,2,true);int worst=0;+ for(size_t p=0;p<size_t(1920)*1080;++p)for(unsigned c=0;c<3;++c)+ worst=std::max(worst,std::abs(int(two.srInput.pixels[p*4+c])-int(std::lround(encode(expected[p*3+c])))));+ check(worst<=2,"second input is the area reduction of the FIRST AI result, max difference "+std::to_string(worst));+ }+ s.srTarget=pipeline::SrTarget::Uhd8K;+ const auto eightThenFour=run(ctx,ring,sdr.get(),false,s,false,false,false,2);+ check(eightThenFour.ok&&eightThenFour.evaluations==4&&eightThenFour.output.width==3840,"base 8K -> reduce 1080p -> second 4K actually runs twice");+ s.srTarget=pipeline::SrTarget::Uhd4K;+ const auto matched=sdrFrame(pattern(1920,1080));+ const auto shared=run(ctx,ring,matched.get(),false,s,false,false,false,2);+ check(shared.ok&&shared.evaluations==4&&shared.output.width==3840,"equal input/output create keys still execute two AI passes without duplicate ownership");+ const auto h=run(ctx,ring,hdr.get(),true,s,false,false,false,2,true);+ bool finite=h.ok;for(size_t i=0;finite&&i<h.output.pixels.size()/2;++i)finite=std::isfinite(half(h.output,i));+ check(finite&&h.evaluations==4&&h.firstLinear.width==3840,"HDR restores the first result before the second reduction and evaluation");+ s.dualSrEnabled=false;s.srTarget=pipeline::SrTarget::Uhd8K;s.srOutput=pipeline::SrOutput::Uhd4K;+ const auto normal=run(ctx,ring,sdr.get(),false,s,false,false,false,2);+ check(normal.ok&&normal.evaluations==2&&normal.output.width==7680,"dual OFF preserves normal 8K output and ignores retired pre/post fields");+ ring.shutdown();ctx.shutdown();std::cout<<"DUAL_SR_RESULT passed="<<ok<<std::endl;return ok?0:1;+}int boundaries(const std::filesystem::path& directory){std::filesystem::create_directories(directory);Logger::instance().openFile((directory/L"engine.log").wstring());gfx::D3D12DeviceContext ctx;gfx::CommandSlotRing ring;Status status;@@ -383,6 +415,7 @@ int wmain(int argc,wchar_t** argv){const HRESULT com=CoInitializeEx(nullptr,COINIT_MULTITHREADED);if(FAILED(com))return 2;if(argc==3&&std::wstring_view(argv[2])==L"stage"){const int result=stage::test(argv[1]);CoUninitialize();return result;}+ if(argc==3&&std::wstring_view(argv[2])==L"dual"){const int result=stage::dual(argv[1]);CoUninitialize();return result;}if(argc==3&&std::wstring_view(argv[2])==L"stage-boundaries"){const int result=stage::boundaries(argv[1]);CoUninitialize();return result;}if(argc==3&&std::wstring_view(argv[2])==L"stage-capabilities"){const int result=stage::capabilities(argv[1]);CoUninitialize();return result;}if(argc>=9&&std::wstring_view(argv[2])==L"stage-image"){diff --git a/tests/unit/EffectChainTests.cpp b/tests/unit/EffectChainTests.cppindex 3b3c2242..5d9b4d2b 100644--- a/tests/unit/EffectChainTests.cpp+++ b/tests/unit/EffectChainTests.cpp@@ -2,7 +2,6 @@// modes must obey. These are the guards for the multi-NR and node-mode work.#include "veyra/engine/EffectChain.h"#include "veyra/engine/GraphDescription.h"-#include "veyra/engine/SrStageSafety.h"#include <type_traits>#include <algorithm>#include <random>@@ -1453,7 +1452,7 @@ static void testThreeStepSr(){"three-step SR: a 4K prescale changes only what SR reads; NR, flow and output sizes stay");}// The chain step: present even when the source already has the target size.- EnhancementSettings s;s.nr=false;s.sr=true;s.videoSrQuality=3;s.srPrescale=SrPrescale::P1080;+ EnhancementSettings s;s.nr=false;s.sr=true;s.videoSrQuality=3;s.srPrescale=SrPrescale::P1080;s.dualSrEnabled=true;{const auto chain=toChain(s);ChainExecutionPlan plan;ChainExecutionRequest request{{3840,2160},SrTarget::Uhd4K,false,false,false,SrPrescale::P1080,SrOutput::Target};@@ -1493,8 +1492,8 @@ static void testThreeStepSr(){request.nvidiaAdapter=false;describeStages(request,s,desc);check(desc.srInputWidth==3840&&desc.srOutputWidth==desc.workWidth,"three-step SR: other adapters keep the single step");request.nvidiaAdapter=true;request.width=2560;request.height=1440;- auto fit=s;fit.srPrescale=SrPrescale::Off;fit.srTarget=SrTarget::Uhd8K;fit.srOutput=SrOutput::Uhd4K;describeStages(request,fit,desc);- check(desc.enableSr&&desc.srInputWidth==2560&&desc.srOutputWidth==7680&&desc.srOutputHeight==4320&&desc.workWidth==3840&&+ auto fit=s;fit.srPrescale=SrPrescale::P1080;fit.srTarget=SrTarget::Uhd8K;fit.srOutput=SrOutput::Uhd4K;describeStages(request,fit,desc);+ check(desc.enableSr&&desc.dualSr&&desc.firstSrWidth==7680&&desc.srInputWidth==1920&&desc.srOutputWidth==3840&&desc.srOutputHeight==2160&&desc.workWidth==3840&&desc.workHeight==2160&&desc.validateFixedExecutionPlan().empty(),"three-step SR: 2K -> 8K -> 4K works at 4K after SR");}// Settings: validation, inactive normalization, rebuilds and chain globals.@@ -1508,7 +1507,7 @@ static void testThreeStepSr(){check(off.activeVideoSettings().srPrescale==SrPrescale::Off&&dlss.activeVideoSettings().srPrescale==SrPrescale::Off,"three-step SR: SR off and other backends normalize the fields");auto before=s;before.srPrescale=SrPrescale::Off;auto output=s;output.srOutput=SrOutput::Qhd;- check(requiresGraphRebuild(before,s)&&requiresGraphRebuild(s,output),"three-step SR: prescale and output changes rebuild the graph");+ check(requiresGraphRebuild(before,s)&&!requiresGraphRebuild(s,output),"double SR: reduction rebuilds, retired post-fit does not change the graph");auto dlssBefore=before;dlssBefore.videoSrQuality=0;check(!requiresGraphRebuild(dlssBefore,dlss),"three-step SR: inactive edits do not rebuild the graph");EnhancementSettings restored;ChainGlobalSettings::capture(output).apply(restored);@@ -1593,24 +1592,29 @@ int main() {testWideChains();testThreeStepSr();{- using namespace veyra;using pipeline::SrPrescale;using pipeline::SrTarget;using pipeline::SrOutput;- EnhancementSettings s;s.sr=s.nr=true;s.videoSrQuality=2;s.srTarget=SrTarget::Uhd8K;s.srPrescale=SrPrescale::P1080;- s.multiplier=2;s.frameGenerationBackend=FrameGenerationBackend::Vfg;- StageRequest r;r.width=3840;r.height=2160;r.sr=r.nr=r.fg=true;r.fgMultiplier=2;- pipeline::EnhanceGraphDesc unsafe;describeStages(r,s,unsafe);- check(!unsafe.validateFixedExecutionPlan().empty(),"8K three-step NR/VFG rejected before GPU allocation");- check(boundSrStageOutput(s,{3840,2160})&&s.srOutput==SrOutput::Uhd4K&&s.srTarget==SrTarget::Uhd8K&&s.nr&&s.multiplier==2,- "atomic SR safety fit retains 8K evaluation, NR and VFG choices");- pipeline::EnhanceGraphDesc safe;describeStages(r,s,safe);- check(safe.validateFixedExecutionPlan().empty()&&safe.srOutputWidth==7680&&safe.workWidth==3840&&safe.enableNr&&safe.enableFg,- "8K internal SR with 4K downstream NR/VFG remains admitted");- check(!boundSrStageOutput(s,{3840,2160}),"bounded SR settings are idempotent");- s.srOutput=SrOutput::Target;s.nr=false;s.multiplier=1;- check(!boundSrStageOutput(s,{3840,2160}),"SR alone retains its explicit final size");- s.nr=true;s.srPrescale=SrPrescale::Off;- check(!boundSrStageOutput(s,{3840,2160}),"legacy single-step SR settings are unchanged");- s.srPrescale=SrPrescale::P1080;s.srOutput=SrOutput::Uhd5K;- check(boundSrStageOutput(s,{}),"unknown-source restored three-step settings are bounded before opening");+ using namespace veyra;using pipeline::SrTarget;using pipeline::SrPrescale;using pipeline::SrOutput;+ EnhancementSettings s;s.sr=true;s.nr=false;s.videoSrQuality=2;s.srTarget=SrTarget::Uhd8K;+ s.srPrescale=SrPrescale::P1080;s.srOutput=SrOutput::Uhd4K;+ StageRequest r;r.width=2560;r.height=1440;r.sr=true;+ pipeline::EnhanceGraphDesc d;auto p=describeStages(r,s,d);+ check(!d.dualSr&&d.workWidth==7680&&d.srInputWidth==2560,"dual off restores ordinary 8K and ignores retired pre/post fields");+ s.dualSrEnabled=true;s.dualSrTarget=SrTarget::Uhd4K;s.dualSrQuality=1;+ p=describeStages(r,s,d);+ check(d.dualSr&&d.firstSrWidth==7680&&d.srInputWidth==1920&&d.srOutputWidth==3840&&d.workWidth==3840&&d.dualSrQuality==1&&d.videoSrQuality==2&&d.validateFixedExecutionPlan().empty(),+ "dual SR describes first 8K, reduction 1080p and second 4K with separate qualities");+ check(p.dualSrApplied&&p.firstSrOutput==pipeline::Extent{7680,4320},"metrics preserve first-stage dimensions rather than labelling one AI pass as two");+ s.srTarget=SrTarget::Uhd4K;s.dualSrTarget=SrTarget::Uhd8K;p=describeStages(r,s,d);+ check(d.firstSrWidth==3840&&d.workWidth==7680&&s.dualSrTarget==SrTarget::Uhd8K,"second 8K selection remains 8K with no silent 4K fit");+ auto disabled=s;disabled.dualSrEnabled=false;auto edited=disabled;edited.dualSrTarget=SrTarget::Qhd;edited.dualSrQuality=3;+ check(!requiresGraphRebuild(disabled,edited),"editing stored second-stage settings while disabled does not rebuild base SR");+ check(requiresGraphRebuild(disabled,s),"enabling the second actual SR pass rebuilds");+ auto g=ChainGlobalSettings::capture(s);EnhancementSettings restored;g.apply(restored);+ check(restored.dualSrEnabled&&restored.dualSrTarget==s.dualSrTarget&&restored.dualSrQuality==s.dualSrQuality,"chain globals retain independent second-stage settings");+ auto invalid=s;invalid.dualSrQuality=0;check(!invalid.validate().empty(),"reject invalid second SR quality before any GPU work");+ invalid=s;invalid.dualSrTarget=SrTarget(99);check(!invalid.validate().empty(),"reject invalid second SR target");+ ChainExecutionRequest badRequest{{2560,1440},s.srTarget};badRequest.dualSrEnabled=true;badRequest.dualSrTarget=SrTarget(99);+ ChainExecutionPlan rejected;check(!compileChainExecutionPlan(toChain(s),badRequest,rejected).accepted,"invalid second target returns a rejected plan rather than throwing");+ s.videoSrQuality=kVideoSrFsr;describeStages(r,s,d);check(!d.dualSr&&!s.activeVideoSettings().dualSrEnabled,"other base backends keep their existing single-stage path");}std::printf(failures ? "effect chain: %d FAILURES\n" : "effect chain: all checks passed\n", failures);return failures ? 1 : 0;diff --git a/tests/unit/PresetLibraryTests.cpp b/tests/unit/PresetLibraryTests.cppindex 9667b322..19810bb4 100644--- a/tests/unit/PresetLibraryTests.cpp+++ b/tests/unit/PresetLibraryTests.cpp@@ -1102,6 +1102,28 @@ __declspec(noinline) void testDlssSrModels() {}// Three-step SR (2026-10-28): library v16 / session v11 in .sr-stage files; the// older files keep their bytes for a 2.1.1 rollback.+__declspec(noinline) void testDualSrStorage() {+ const auto path=scratch(L"dual-library.v1");+ PresetLibrary writer(path);writer.setIncludeBuiltins(false);+ auto e=std::make_unique<PresetEntry>();e->name=L"base";e->chain=toChain(sample());+ check(writer.load()&&writer.put(*e),"dual storage seeds an ordinary library");+ const auto original=readBytes(path);+ auto s=sample();s.dualSrEnabled=true;s.srPrescale=veyra::pipeline::SrPrescale::P1080;s.dualSrTarget=veyra::pipeline::SrTarget::Uhd8K;s.dualSrQuality=2;+ e->name=L"two passes";e->globals=ChainGlobalSettings::capture(s);+ check(writer.put(*e)&&readBytes(path)==original,"dual library preserves the original file");+ check(readBytes(std::filesystem::path(path).concat(L".dual-sr")).starts_with("VEYRA_PRESET_LIBRARY 17"),"dual library uses the independent v17 sidecar");+ PresetLibrary reader(path);reader.setIncludeBuiltins(false);auto out=sample();+ const bool loaded=reader.load()&&reader.entries().size()==2;+ if(loaded)PresetLibrary::apply(reader.entries()[1],out);+ check(loaded&&out.dualSrEnabled&&out.dualSrTarget==s.dualSrTarget&&out.dualSrQuality==2,"library reload restores both SR stages");+ const auto sessionPath=scratch(L"dual-session.v1");auto session=std::make_unique<ChainSession>(ChainSession::initial(sample()));+ ChainSessionStore sessions(sessionPath);check(sessions.save(*session),"dual session seeds ordinary configuration");+ const auto old=readBytes(sessionPath);session->configurations[0]=ChainConfiguration::capture(toChain(s),s,-1,-1);+ check(sessions.save(*session)&&readBytes(sessionPath)==old,"dual session preserves the older file");+ check(readBytes(std::filesystem::path(sessionPath).concat(L".dual-sr")).starts_with("VEYRA_CHAIN_SESSION 12"),"dual session uses v12 sidecar");+ auto back=std::make_unique<ChainSession>();ChainSessionStore reload(sessionPath);+ check(reload.load(*back)&&back->configurations[0].dualSrEnabled&&back->configurations[0].dualSrQuality==2&&back->configurations[0].dualSrTarget==s.dualSrTarget,"session reload preserves independent second target and quality");+}__declspec(noinline) void testSrStageStorage() {EnhancementSettings source;source.nr=false;source.sr=true;source.videoSrQuality=3;const auto libraryPath=scratch(L"sr-stage-library.v1");@@ -1284,6 +1306,7 @@ int main() {testBeautyNodeStorage();testDlssSrModels();testSrStageStorage();+ testDualSrStorage();testFlowStorage();testFlowApplication();testNrCorrectionStorage();diff --git a/tests/unit/RepairPresetTests.cpp b/tests/unit/RepairPresetTests.cppindex 4d9db2b3..906065c7 100644--- a/tests/unit/RepairPresetTests.cpp+++ b/tests/unit/RepairPresetTests.cpp@@ -349,4 +349,11 @@ ok=ok&&b.entries().size()==1&&b.defaultSettings()==s;}ok&=roundtrip;std::cout<<"SR stage mode="<<mode<<" schema="<<version<<" roundtrip="<<roundtrip<<'\n';}+ {+ EnhancementSettings dual;dual.sr=true;dual.dualSrEnabled=true;dual.srPrescale=veyra::pipeline::SrPrescale::P1080;dual.dualSrTarget=veyra::pipeline::SrTarget::Uhd8K;dual.dualSrQuality=2;+ auto path=p;path+=L"-dual";PresetStore w(path);bool pass=w.load()&&w.put(L"dual",dual);PresetStore r(path);+ pass=pass&&r.load()&&r.entries().size()==1&&r.entries()[0].settings==dual;+ std::ifstream h(path);std::string magic;int version=0;h>>magic>>version;pass=pass&&version==34;+ ok=ok&&pass;std::cout<<"dual SR schema34 roundtrip="<<pass<<'\n';+ }std::cout<<"preset roundtrip, all fields, duplicate, rename-default, delete, validation, unknown schema, corrupt-preservation="<<ok<<'\n';return ok?0:1;}