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(sr): bound downstream NR and frame generation for staged SR
Veyra Goal Agent67d0294e9b9f
diff --git a/AGENTS.md b/AGENTS.mdindex 7ead6061..ff7cac3b 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -1,5 +1,7 @@# Veyra Agent 工作规则+> 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 914cf4dc..5bca91ad 100644--- a/docs/CURRENT_STATUS.md+++ b/docs/CURRENT_STATUS.md@@ -12,6 +12,8 @@**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`不属于本轮,未顺带合并。+**后续卡死防护:**当前施工树已转到`codex/sr-stage-freeze-20261028`。用户在1080p先降/8K最终输出+NR+VFG 2X组合遇到整机卡死重启,原接手版不再推荐。现保留8K内部SR,将新三段式链的NR/FG最终处理输出限制到4K,做原子参数修正、旧会话恢复和底层分配前拒绝;私有配置短时文件组合验证通过。具体GPU/驱动阻塞根因未证实,未重跑原危险组合,不宣称原组合稳定,详见[卡死后续记录](SR_STAGE_FREEZE_2026-10-28.md)。+- 项目整理1–4由用户明确授权执行,起点main `7bf02d4`;结构整理提交`d4b1034`,构建与相关回归已通过。本轮以main作为后续开发入口,准确整合HEAD见执行任务FINAL回执。- 已清43退休产物目录、移除89干净旧工作树、归档122分支引用;工作树101→12,收尾施工分支移除后本地分支132→10。保留的旧分支是6脏树、2条Lecram暂停线和1条带独有忽略内容的旧诊断线,另加main。- 历史规则/计划/报告已分类,611份文档进入history;原9千行桥接改为启动接线与领域模块,对话框和专业页复用组件已拆分。E盘空闲空间相对开工前净增约28.14GiB,包含本轮保全归档/测试目录成本。diff --git a/docs/SR_STAGE_FREEZE_2026-10-28.md b/docs/SR_STAGE_FREEZE_2026-10-28.mdnew file mode 100644index 00000000..ff16f533--- /dev/null+++ b/docs/SR_STAGE_FREEZE_2026-10-28.md@@ -0,0 +1,37 @@+# 三段式超分整机卡死:证据与防护(2026-10-28)++用户在接手版`cf84762`选择“先降1080p→超分8K”后整机卡住并重启。此前短时SR测试不能证明这个完整组合稳定;该接手版不再作为推荐测试构建。当前修复分支`codex/sr-stage-freeze-20261028`,不合并main、不push、不Release。++## 已确认的事实++- 原测试目录有`veyra-hang-20261028-063350-33396.dmp`,约1.6MB;应用日志为0字节。原转储已保全到`E:/项目/Veyra/reports/sr-stage-freeze-20261028/user-hang.dmp`。+- 系统记录06:34的Kernel-Power 41,证明非正常重启,不能单凭事件41判断显存不足、GPU故障或电源故障。重启后WER还处理了一批旧日期的141报告,不能把它们当本次GPU重置证据。+- 用现有PresetLibrary解码器只读解析原会话:SR开启,RTX视频超分质量2,目标8K、先降1080p、再缩关闭;NR开启、Ampere运行时;VFG 2X开启。源视频信息未从配置推断。+- 关键区别:`再缩关闭`让NR/补帧的工作纹理也成为8K。此前主要测试8K内部超分后缩回4K,SR单独运行的短测试不等于8K的完整NR/VFG链验收。++## 转储说明与根因边界++原EXE没有PDB。用同一批OBJ/LIB离线重新链接生成MAP,重链接EXE与原构建的`.text`逐字节一致,再解析转储。保存了模块列表、各线程当前IP、原始栈指针扫描和本地符号映射。++当时界面线程当前IP在`win32u!NtGdiBitBlt`;呈现相关线程当前IP在`win32u!NtGdiDdDDIQueryAdapterInfo`,栈中候选返回地址包括DXGI、D3D12与`PresentSink::resize`、`VideoPresenter::present`。这指向系统绘图/驱动路径阻塞,不是普通QML报错。**这些候选地址来自原始栈扫描,不是完整展开的调用栈;不能据此认定具体驱动内部缺陷。**++8K完整链的资源/调度压力是合理怀疑,但没有故障前显存采样、对应内核转储或可复现的底层错误,不能宣布“已证明显存耗尽”,也不能宣布已根治驱动挂死。本轮不重跑原危险组合。++## 本轮防护++1. 对新三段式SR,若NR或补帧开启,最终处理输出限制在4K像素预算内;SR仍可在8K执行,再缩回4K后交给NR和补帧。纯SR与旧单步路径的明确尺寸规则保持。+2. 修改参数时在**同一个事务**中补齐4K输出,不先提交临时的8K NR/FG图。列表、节点共用逻辑;预设/旧会话恢复也做防护,并明确提示调整。保留NR、VFG倍率和内部SR目标。+3. `EnhanceGraphDesc::validateFixedExecutionPlan`在GPU资源分配及SDK初始化之前拒绝绕过界面提交的高负载三段式组合;不能只靠界面禁用按钮。+4. 超分编辑器显示限制原因,禁用不安全的“再缩”选项。新说明补齐繁中、英文、日文。++这是一项针对已知触发路径的限制与安全恢复,**不是原8K NR/VFG组合的修复验收**,也不保证其他原因引起的系统挂起不会发生。++## 验证与交付++- 首次构建发现恢复节点文档是不可变共享对象,改为复制后再更新,避免原存档/快照被原地修改;后续产品及相关目标构建通过。+- EffectChain新增7项:危险描述提前拒绝、原子输出修正、8K内部/4K最终允许、幂等、纯SR保留、旧单步不改、未知源恢复;完整EffectChain、PresetLibrary、UI i18n退出0。+- QtQuick:117通过、0失败、1跳过;翻译缺失和占位符问题均0。+- 实际文件测试使用原会话文件的**私有副本**,关闭自动恢复/预热,只打开本地4K测试视频,不使用采集卡。7项断言通过:启动前恢复为4K、保留NR/FG、取消再缩的危险编辑被原子修正、实际SR/NR/FG全开,尺寸链为`3840×2160→1920×1080→7680×4320→3840×2160`;整个日志没有`base=7680x4320`。稳定出帧约12秒后正常退出,不冒充长时压力测试。+- 原会话文件逐SHA保持;注入的测试Main.qml已恢复,运行组件与正式供体身份保持。没有修改真实配置、驱动、模型或正式包。++运行目录仍为`E:/项目/Veyra/tests/claude-sr-stage-20261028/app`,其中EXE已更新。最终摘要和哈希见`E:/项目/Veyra/reports/sr-stage-freeze-20261028/FINAL.json`,原始证据/测试日志分别在同名reports与logs目录。diff --git a/docs/SR_STAGE_HANDOFF_2026-10-28.md b/docs/SR_STAGE_HANDOFF_2026-10-28.mdindex 9ae69a65..a8244f4d 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)+> 后续用户在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 4f8719d6..a0753c70 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -45,3 +45,15 @@ GitHub连接器用于文件树/提交/引用更新,缺少Release编辑接口GPU首次runner的stdout路径重名,前组stdout被覆盖;各组exit/末尾标记仍在gpu.json,各组独立engine事件日志保留;runner已改用序号。未借机重复整轮测试。未做main二进制逐像素对照、长时动态画质/显存峰值或实卡采集;Claude原图片A/B与本轮定向验收分开陈述。详细范围、命令、失败与验证见docs/SR_STAGE_HANDOFF_2026-10-28.md;本轮JSON/日志:reports与logs/codex-sr-stage-handoff-20261028。正式2.1.1包/SDK/模型/用户配置不改,Lecram继续暂停。++## 2026-10-28 三段式SR整机卡死后续防护++用户报告1080p先降/8K输出导致整机卡住后重启。新分支codex/sr-stage-freeze-20261028从cf84762开始,checkpoint/pre-sr-stage-freeze-20261028;旧测试构建不再推荐。只读保全实际hang dump、相关系统事件与会话参数,真实配置未改,不重跑原危险组合。++配置解码确认质量2 RTX视频超分、先降1080p、8K最终输出/不再缩、NR Ampere开启、VFG 2X开启。系统41证明非正常重启;重启后处理的旧日期141报告不能冒充本次证据。EXE无PDB,离线同OBJ/LIB重链接MAP的.text与旧构建逐字节一致,原始栈候选映射指向DXGI/PresentSink resize与VideoPresenter;线程当前IP在系统驱动查询/BitBlt。没有完整调用栈、当时显存值或对应内核dump,不把显存压力怀疑写成已证实根因。++防护:新三段式SR同时开NR/FG时,最终处理尺寸限制4K像素预算,保留8K内部评估。列表/节点参数在同一事务补齐再缩4K;旧会话恢复复制不可变节点文档后修正,明确提示;底层validateFixedExecutionPlan在分配/SDK前拒绝绕过UI的危险组合。首轮构建因写入const节点文档失败,改为复制后通过。原单步与纯SR规则保持。++复用既有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/驱动/模型/真实用户配置。diff --git a/i18n/catalog.json b/i18n/catalog.jsonindex 13bc9f3e..a41d8227 100644--- a/i18n/catalog.json+++ b/i18n/catalog.json@@ -1470,6 +1470,13 @@"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",@@ -7239,6 +7246,13 @@"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",diff --git a/include/veyra/engine/SrStageSafety.h b/include/veyra/engine/SrStageSafety.hnew file mode 100644index 00000000..1d6f8d1b--- /dev/null+++ b/include/veyra/engine/SrStageSafety.h@@ -0,0 +1,14 @@+#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/pipeline/EnhanceGraph.h b/include/veyra/pipeline/EnhanceGraph.hindex c261ef20..e8f05273 100644--- a/include/veyra/pipeline/EnhanceGraph.h+++ b/include/veyra/pipeline/EnhanceGraph.h@@ -418,6 +418,12 @@ 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;diff --git a/include/veyra/pipeline/ResolutionPlan.h b/include/veyra/pipeline/ResolutionPlan.hindex 9264b4da..b2e77858 100644--- a/include/veyra/pipeline/ResolutionPlan.h+++ b/include/veyra/pipeline/ResolutionPlan.h@@ -76,6 +76,14 @@ 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){diff --git a/qml/Veyra/SrStageEditor.qml b/qml/Veyra/SrStageEditor.qmlindex 5d2650ee..a72306cf 100644--- a/qml/Veyra/SrStageEditor.qml+++ b/qml/Veyra/SrStageEditor.qml@@ -12,6 +12,7 @@ ColumnLayout {spacing: 6readonly property bool stageBackend: veyra.videoSrQuality >= 1 && veyra.videoSrQuality <= 4readonly 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).@@ -30,10 +31,18 @@ ColumnLayout {sized("3", "1080p", 1080), sized("4", "1440p", 1440), {id: "manual", label: qsTr("手动")}]readonly property var outputChoices: [- {id: "0", label: qsTr("不缩")}, {id: "1", label: qsTr("片源尺寸")}, sized("2", "2K", 1440),- sized("3", "4K", 2160), sized("4", "5K", 2880), sized("5", "6K", 3456), sized("6", "7K", 4032)+ {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+ }+VRow {label: qsTr("先降到")hint: editor.stageBackend@@ -90,7 +99,7 @@ ColumnLayout {VSelect {objectName: editor.namePrefix + "-sr-output"options: editor.outputChoices- value: options.find(o => o.id === String(veyra.srOutput))?.label || ""+ value: (veyra.chain, options.find(o => o.id === String(veyra.srOutput))?.label || "")onPicked: id => veyra.srOutput = Number(id)}}diff --git a/scripts/acceptance/sr-stage-safety-ui.py b/scripts/acceptance/sr-stage-safety-ui.pynew file mode 100644index 00000000..93e8a04f--- /dev/null+++ b/scripts/acceptance/sr-stage-safety-ui.py@@ -0,0 +1,28 @@+"""One bounded file-only regression using a copy of the reported settings."""+import hashlib,json,os,shutil,subprocess+from pathlib import Path+B=Path('E:/项目/Veyra');R=Path(__file__).resolve().parents[2];T='sr-stage-freeze-20261028'+A=B/'tests/claude-sr-stage-20261028/app';P=B/'tests'/T/'profile';L=B/'logs'/T;TMP=B/'tmp'/T;OUT=B/'reports'/T+for p in (P,L,TMP,OUT):p.mkdir(parents=True,exist_ok=True)+user=A/'runtime_local/user-data-2.0.0'+before={p.name:hashlib.sha256(p.read_bytes()).hexdigest() for p in user.glob('chain-session*')}+for name in before:shutil.copyfile(user/name,P/name)+(P/'qml-preferences.v1.json').write_text(json.dumps({'language':'zh-CN','autoResume':False,'prewarmEnhancement':False}),encoding='utf-8')+media=B/'tests/nr-manual-scale-20261024/media/nr-4k30.mp4'+src=(R/'qml/Veyra/Main.qml').read_bytes();text=src.decode('utf-8');idx=text.rfind('}')+loader='\nLoader {source: '+json.dumps((R/'scripts/acceptance/sr-stage-safety-ui.qml').as_uri())+'; onLoaded: item.media='+json.dumps(media.as_posix())+'}\n'+def replace(path,data):+ staged=path.with_name(path.name+'.safety-new');staged.write_bytes(data);os.replace(staged,path)+replace(A/'qml/Veyra/Main.qml',(text[:idx]+loader+text[idx:]).encode('utf-8'))+env={k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_','QT_','QSG_','QML_'))}+env.update(TEMP=str(TMP),TMP=str(TMP),APPDATA=str(P/'AppData'),LOCALAPPDATA=str(P/'LocalAppData'),CUDA_CACHE_PATH=str(TMP/'cuda'),QML_DISABLE_DISK_CACHE='1',QT_FORCE_STDERR_LOGGING='1',VEYRA_LOG_FILE=str(L/'engine.log'))+try:+ with (L/'console.log').open('wb') as f:rc=subprocess.run([str(A/'veyra_qml_ui.exe'),'--page','pro','--data-dir',str(P),'--exit-after','60000'],cwd=A,env=env,stdout=f,stderr=subprocess.STDOUT,timeout=75).returncode+finally:replace(A/'qml/Veyra/Main.qml',src)+console=(L/'console.log').read_text(encoding='utf-8',errors='replace');engine=(L/'engine.log').read_text(encoding='utf-8',errors='replace')+errors=[l for l in console.splitlines() if any(x in l for x in ('ReferenceError:','TypeError:','Binding loop detected','is not a type','SyntaxError:'))]+unchanged=all(hashlib.sha256((user/n).read_bytes()).hexdigest()==h for n,h in before.items())+result={'exit':rc,'passed':rc==0 and 'SR_SAFETY_UI_PASS' in console and 'SR_SAFETY_UI_FAIL' not in console and not errors and unchanged,'qmlErrors':errors,'userSettingsUnchanged':unchanged,'unsafeWorkExtentObserved':'base=7680x4320' in engine,'steps':[l for l in engine.splitlines() if '[sr-safety-test]' in l or '[sr-stage-safety]' in l],'log':str(L/'engine.log')}+result['passed']=result['passed'] and not result['unsafeWorkExtentObserved']+(OUT/'safe-ui.json').write_text(json.dumps(result,ensure_ascii=False,indent=2),encoding='utf-8');print(json.dumps(result,ensure_ascii=False,indent=2))+raise SystemExit(0 if result['passed'] else 1)diff --git a/scripts/acceptance/sr-stage-safety-ui.qml b/scripts/acceptance/sr-stage-safety-ui.qmlnew file mode 100644index 00000000..579c174d--- /dev/null+++ b/scripts/acceptance/sr-stage-safety-ui.qml@@ -0,0 +1,35 @@+// Private-profile regression for the 2026-10-28 freeze; never opens a device.+import QtQuick+Item {+ id: test+ property string media: ""+ Timer {+ interval: 500; running: test.media.length > 0; repeat: true+ property int ticks: 0+ property int step: 0+ property int played: 0+ function check(ok,label) { if (!ok) throw new Error(label); veyra.logUi("sr-safety-test","PASS " + label) }+ onTriggered: { try {+ if (++ticks > 100) throw new Error("bounded safety test step=" + step)+ if (step === 0) {+ if (ticks < 4) return+ check(veyra.srTargetIndex === 3 && veyra.srPrescale === 3, "restore preserves internal 1080p to 8K")+ check(veyra.srOutput === 3, "restore bounds final output before any source opens")+ check(veyra.nrEnabled && veyra.fgEnabled, "restore retains NR and frame-generation selections")+ // Attempt to undo the output fit while the other stages are on.+ veyra.srOutput = 0+ check(veyra.srOutput === 3, "unsafe output edit is bounded atomically")+ veyra.muted = true+ veyra.openPath(test.media); step = 1; return+ }+ if (step === 1) {+ if (!veyra.running || veyra.applying) return+ if (++played < 24) return+ check(veyra.outputSummary === "3840x2160", "running output stays 4K")+ check(veyra.srStageSummary === "3840x2160 → 1920x1080 → 7680x4320 → 3840x2160", "SR evaluates 8K and fits before the downstream stages")+ check(veyra.srActive && veyra.nrActive && veyra.fgActive, "SR, NR and frame generation all actually active")+ veyra.logUi("sr-safety-test","SR_SAFETY_UI_PASS"); console.log("SR_SAFETY_UI_PASS"); Qt.quit()+ }+ } catch(e) { veyra.logUi("sr-safety-test","SR_SAFETY_UI_FAIL " + e.message); console.log("SR_SAFETY_UI_FAIL " + e.message); Qt.quit() } }+ }+}diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cppindex 0a3af697..b9510fd1 100644--- a/src/ui/QmlPlayerBridge.cpp+++ b/src/ui/QmlPlayerBridge.cpp@@ -170,9 +170,25 @@ 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 00164ece..5fdbd760 100644--- a/src/ui/QmlPlayerBridge_p.h+++ b/src/ui/QmlPlayerBridge_p.h@@ -18,6 +18,7 @@#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"@@ -860,6 +861,10 @@ 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;@@ -909,6 +914,10 @@ 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/Export.cpp b/src/ui/bridge/Export.cppindex b752a000..08e583b8 100644--- a/src/ui/bridge/Export.cpp+++ b/src/ui/bridge/Export.cpp@@ -272,7 +272,10 @@ void QmlPlayerBridge::setSrTargetIndex(int index) {}if (s.srTarget == want) return;s.srTarget = want;- impl_->commit(std::move(s));+ 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);emit settingsChanged();}diff --git a/tests/unit/EffectChainTests.cpp b/tests/unit/EffectChainTests.cppindex 085031e1..3b3c2242 100644--- a/tests/unit/EffectChainTests.cpp+++ b/tests/unit/EffectChainTests.cpp@@ -2,6 +2,7 @@// 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>@@ -1591,6 +1592,26 @@ int main() {testBeautySettingsChain();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");+ }std::printf(failures ? "effect chain: %d FAILURES\n" : "effect chain: all checks passed\n", failures);return failures ? 1 : 0;}