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(presets): include shared optical flow in unified list presets
Veyra Goal Agent1b0f57677541
diff --git a/AGENTS.md b/AGENTS.mdindex b278ccac..ca9db487 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -1,5 +1,7 @@# Veyra 项目 Agent 执行规则+> **2026-10-06 列表预设纠偏**:用户明确不要独立补帧预设,要求图示光流/估算质量/内容节奏进入已有列表预设,并重新打包2.0.4。按docs/LIST_PRESET_FLOW_PLAN_2026-10-06.md在E盘codex/list-preset-flow-20261006实施必要PresetLibrary/bridge/QML/翻译/定向测试/本地main续修与打包;保留旧包/原工作区及用户配置,不替换运行库。新guard list-preset-flow-control.py使用独立不可变基线。此具体修复覆盖这些接点历史冻结;不推送/公开发布,不派Agent/压力测试/关机,沿用≤300秒测试与≤900秒构建。+> **2026-10-05 2.0.4 整合与测试包授权**:用户要求检查其他分支及 Claude 刚完成的修复,与 NR 强度/三风格画面调控、采集/Xbox 修复整合到本地 main,打包 2.0.4 给用户测试并准备正式发布。工作树 `E:/项目/Veyra/worktrees/release-2.0.4-20261005`,分支 `codex/release-2.0.4-20261005`;按 `docs/RELEASE_2.0.4_PLAN_2026-10-05.md` 执行。本轮允许存档、提交、标签、本地 main 合并、必要版本/打包/翻译/定向验收及发现的整合缺陷修复;仅合入已审查的产品改动,不复活历史撤回实验。Claude UI 工作树的 18 份未提交文件已逐字节封存并复制,原工作区/桌面/用户配置保持。新 guard 为 `scripts/acceptance/release-2.0.4-control.py`,不可变 start 与全引用 bundle 在本轮 E 盘 archives。继续 NVIDIA/AMD 同源码分包,保留 patched FFmpeg、libass、原组件身份;不派 Agent、不跑压力或竞争负载。测试每进程≤300秒、构建≤900秒。此次是本地测试交付及发布准备,未请求新的 push/GitHub Release/上传或关机;HDR/Dolby PR13/14仍暂缓。本条覆盖此次整合所需的旧 main/分支冻结,不扩大无关算法或运行库改动范围。> **2026-10-05 当前采集/Xbox现场反馈**:用户提交 `logs(4).7z`,最后明确 `veyra-qml(28).log` 为“xbox问题”。按 `docs/CAPTURE_XBOX_FIELD_PLAN_2026-10-05.md` 在 E 盘 `capture-xbox-field-20261005` / `codex/capture-xbox-field-20261005` 从 `33d6685` 隔离排查修复。这次仅涉及 Xbox 视频错误/丢AU后的关键帧恢复、有界硬解重开与必要软件回退、采集时间线诊断标签、定向测试/文档/本地候选;覆盖这些接点的历史冻结,不改 NR/颜色/补帧算法或串流协议。每轮先运行 `py -3.11 -B scripts/acceptance/capture-xbox-control.py`,不可变基线独立于旧 guards;main、其它 18 个工作区、用户配置和已有包保留。无新 merge/push/Release、压力测试、关机或子 Agent 授权;所有产物 E 盘,真实 Xbox/AMD 效果未实测不得称通过。diff --git a/README.md b/README.mdindex 58c460da..0c314ccd 100644--- a/README.md+++ b/README.md@@ -18,7 +18,7 @@ A Windows enhancement player for videos, images, capture cards and streaming. Su[Download 2.0.3 portable](https://github.com/Likely7/Veyra-NRVideo/releases/tag/v2.0.3) · [Full changelog: English / 中文](docs/RELEASE_NOTES_2.0.3.md) · [Issues](https://github.com/Likely7/Veyra-NRVideo/issues)-**2.0.4 testing, 2026-10-05:** the local candidate combines the later performance/field fixes, NR strength 5 and style-specific automatic/manual picture control, bounded Xbox decoder recovery and Claude's latest UI repairs. List panels can be resized, slider numbers can be typed, floating mode buttons avoid picture clicks, and the complete frame-generation tab can be saved as a preset. GPU scheduling defaults to Realtime when no choice is saved; existing choices remain. [2.0.4 changes and test limits](docs/RELEASE_NOTES_2.0.4.md). The public download remains 2.0.3 until field testing and publication.+**2.0.4 testing, 2026-10-06:** the local candidate combines the later performance/field fixes, NR strength 5 and style-specific automatic/manual picture control, bounded Xbox decoder recovery and Claude's latest UI repairs. List panels can be resized, slider numbers can be typed, floating mode buttons avoid picture clicks, and the existing list/node preset dialog can include shared optical flow, estimation quality and content cadence. GPU scheduling defaults to Realtime when no choice is saved; existing choices remain. [2.0.4 changes and test limits](docs/RELEASE_NOTES_2.0.4.md). The public download remains 2.0.3 until field testing and publication.**Local development, 2026-10-05:** this branch includes later RTSS restart, custom playback rate, subtitle, UI refresh, Professional layout and fullscreen restoration repairs; public 2.0.3 assets do not include them. Every local NR optimization node now has a measured retain/reject decision: core reuse, single-NR caching, idle prewarming, paused-frame reuse, narrowly admitted compute queues and NVENC export scheduling are retained. Auto NR and coarse-to-fine sizes remain optional and change the image. Normal matched runs measured about 6.1 ms for native single-layer NR; the dual-NR/SR4K/DLSS2X pipeline improved 3.52%, with nearly unchanged submission P99. [The execution record](docs/PERF_EXECUTION_NR_2026-10-04.md) and [local regression evidence](docs/PERF_R0_ACCEPTANCE_2026-10-05.md) distinguish measurements and limitations. Severe background frame loss remains unresolved; reliable OBS Game Capture uses the existing compatibility mode, while GPU UI capture is unstable even in the sealed baseline. HDR/Dolby PRs remain deferred. [Current project status](docs/CURRENT_STATUS.md) distinguishes published, local and unverified work.diff --git a/README_CN.md b/README_CN.mdindex 9641c9d1..2a1f55af 100644--- a/README_CN.md+++ b/README_CN.md@@ -16,7 +16,7 @@ Windows 视频、图片、采集卡与串流增强工具。在同一处理链组[下载 2.0.3 免安装版](https://github.com/Likely7/Veyra-NRVideo/releases/tag/v2.0.3) · [完整更新(English / 中文)](docs/RELEASE_NOTES_2.0.3.md) · [反馈](https://github.com/Likely7/Veyra-NRVideo/issues)-**2.0.4 测试,2026-10-05:** 本地候选整合此前性能/现场修复、NR 强度5与三种风格自动/手动画面调控、Xbox 解码恢复和 Claude 最新 UI 修复。列表参数面板可拖动宽度,滑条数字可点击输入,浮窗切模式避免误触视频,补帧页全部参数可保存为预设。未保存选择时 GPU 优先级默认实时,旧选择保持。详见 [2.0.4 更新与测试边界](docs/RELEASE_NOTES_2.0.4.md)。用户测试和发布前,公开下载仍为2.0.3。+**2.0.4 测试,2026-10-06:** 本地候选整合此前性能/现场修复、NR 强度5与三种风格自动/手动画面调控、Xbox 解码恢复和 Claude 最新 UI 修复。列表参数面板可拖动宽度,滑条数字可点击输入,浮窗切模式避免误触视频,已有列表/节点预设可勾选保存光流算法、运动估算质量和内容节奏。未保存选择时 GPU 优先级默认实时,旧选择保持。详见 [2.0.4 更新与测试边界](docs/RELEASE_NOTES_2.0.4.md)。用户测试和发布前,公开下载仍为2.0.3。**本地开发进度,2026-10-05:** 此分支另含RTSS重启、自定义倍速、字幕、UI刷新、专业布局和全屏恢复修复,公开2.0.3包尚未包含。本机全部NR优化节点已有实测保留/拒绝处置:保留核心复用、单NR缓存、空闲预热、暂停复用、限定COMPUTE和NVENC导出调度;自动NR及先粗后细会改画面,只作可选。正常匹配对照单层原生NR约6.1ms,双NR+SR4K+DLSS2X整链减少3.52%,软件提交P99几乎未变。[执行账本](docs/PERF_EXECUTION_NR_2026-10-04.md)和[最终回归记录](docs/PERF_R0_ACCEPTANCE_2026-10-05.md)列明数据与限制。严重后台掉帧仍未确认根因;OBS游戏采集使用现有兼容模式,GPU界面捕获在封存基线也不稳定。HDR/杜比PR继续暂缓。diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.mdindex 27c0e084..36fce0bb 100644--- a/docs/CURRENT_STATUS.md+++ b/docs/CURRENT_STATUS.md@@ -1,5 +1,14 @@# 当前项目状态 / Current Status+## 2026-10-06 2.0.4预设纠偏++用户截图说明不要独立补帧预设,而是把共享光流·运动估算区块纳入既有列表预设。分支codex/list-preset-flow-20261006从main d2e589a隔离施工;before全引用bundle、21工作树原字节/patch及旧2.0.4 ZIP/manifest SHA封存。移除独立FG UI/API,旧fgPresets数据不删除;统一库Flow可选范围含后端/质量/AMD半分辨率/内容节奏,默认启动节奏优先级同步修复。v10另存.flow、v1–9行为保留,新未勾选项不被ChainGlobalSettings覆盖。新增checkbox/完整摘要,四语言词条齐全。++实际命令、输出路径、失败与修复详 LIST_PRESET_FLOW_ACCEPTANCE_2026-10-06.md:生产496步及增量构建均0;482预设/236效果链/246修复/旧存储/i18n通过;Qt50/0,生产弹窗及重启/导入导出/部分范围,FSR/XeSS/DLSS切换、原版双NR5、4K HEVC完整60帧且导出worker明确flow=0/content=3,两个包ASS及默认D3D12启动通过。EXE d01329aa6d9fbd6ac2d1eee294782f4cb9d233490595ed2e3e1a9ea12c16b2d6,File/Product2.0.4。preset1旧保护节点夹具、ui1隐藏弹窗定位、nrexport1变量重名失败保留;更正后重测通过。++新产物全部 E:/项目/Veyra/{build,tests,logs,tmp,test-packages,verify,archives}/list-preset-flow-20261006,AMD/NVIDIA分别694/215既有组件文件原字节保持。20个其它工作区、原2.0.4包与Claude修改不变,无SDK/runtime进Git。当前准备本地main延续合并及最终封包,独立解压启动完成后交付;无新push/Release,不扩大Xbox/AMD/20–40/采集/物理延迟通过范围。++## 2026-10-06 2.0.4 本地整合与发布准备已审查其他分支及Claude最新18份未提交UI修复,纳入当前NR强度5/三风格九参数调控、Xbox解码恢复,并保留main已有性能/计时/AMD NR/字幕/RTSS/倍速/布局修复。原桌面、Claude与其他工作区修改均完整保留;不把旧诊断/撤回实验重新合入。生产版本2.0.4构建与针对性回归通过,实际补帧切换、完整预设恢复/非法值拒绝、两层NR及HEVC4K60帧导出、Qt50项、两包独立启动/ASS和默认D3D12通过。最终EXE SHA dadb7cd28022a4ebff9291b4fc6b282e6253bad397fff7ae6f81ff2bf069322d。diff --git a/docs/LIST_PRESET_FLOW_ACCEPTANCE_2026-10-06.md b/docs/LIST_PRESET_FLOW_ACCEPTANCE_2026-10-06.mdnew file mode 100644index 00000000..dabea805--- /dev/null+++ b/docs/LIST_PRESET_FLOW_ACCEPTANCE_2026-10-06.md@@ -0,0 +1,31 @@+# 2.0.4 统一预设纠偏验收++用户要求移除独立补帧预设,改为让光流·运动估算整个区块随既有列表预设保存。范围见 LIST_PRESET_FLOW_PLAN_2026-10-06.md。原2.0.4封存包与其它工作区保持。++实现:同一PresetLibrary增加可选Flow内容位、v10共享参数快照,携带光流后端/质量/AMD半分辨率/内容节奏。新库另存.flow,不覆盖v1–9文件;旧条目仍按原ChainGlobalSettings行为应用。未勾选Flow的新条目会保留当前共享值,即使同时应用效果链。默认启动不会让旧contentRate偏好覆盖所选预设;节点与导出继续复用相同存储/应用路径。独立补帧UI/API移除,旧偏好里的fgPresets原数据保留、停止消费。++生产构建build1 496步/0;build2增量3步/0;build3/build4分别补充纯预设夹具,两步/0,生产EXE未变化。EXE SHA256 d01329aa6d9fbd6ac2d1eee294782f4cb9d233490595ed2e3e1a9ea12c16b2d6,PE File/Product 2.0.4。++已执行(以下命令统一在本次worktree,均为 py -3.11 -B):++| 命令 / 日志收据(logs/list-preset-flow-20261006) | 实际结果 |+| --- | --- |+| scripts/acceptance/list-preset-flow-build.py build1(七生产/回归目标)及build2–4 | 全部exit 0;旧运行组件不替换 |+| scripts/acceptance/list-preset-flow-tests.py preset3 preset | 482个PASS/0 FAIL;全部32内容掩码的列表/节点范围、54后端/质量/节奏组合、非法值/截断拒绝、旧v1及实际v6/v7 sidecar不覆盖、默认/导入导出 |+| 同脚本 chain1 chain / repair1 repair / legacy1 legacy | 236 PASS / 246 PASS / 旧单用途预设测试exit0 |+| 同脚本 i18n1 i18n;scripts/i18n/extract.py --check | 全部exit0,2002词条、三种译文缺失0、占位符问题0 |+| 同脚本 qml1 qml | Qt 50 passed/0 failed/0 skipped;保留既有mock teardown警告,不冒充生产QML错误 |+| 同脚本 ui3 ui / uirestore1 ui-restore + NVIDIA候选路径 | 真实保存弹窗开关与完整摘要、mask16、列表/节点恢复、不勾选保留、生产API导出导入、播放继续、重启默认压过旧prefs;旧fgPresets原字节值保留且UI/API已移除 |+| 同脚本 hot1 hot + NVIDIA候选路径 | 真实FSR3→XeSS→DLSS→FSR3→关闭;原版NR强度5的风格1自动/风格2手动两层继续播放 |+| 同脚本 nrexport2 nr-export / nrrestore1 nr-restore + NVIDIA候选路径 | 4张实际PNG、单/双层与列表/节点参数、九控制保留;选mask17的列表预设而实时参数故意改掉,worker export-frozen仍flow=0/content=3;D3D12 NVENC HEVC 3840×2160完整60帧;跨进程会话恢复 |+| 同脚本 smokeAMD1/smokeNVIDIA1 smoke + 对应候选;smokeNative1 smoke-native | 两包单独profile启动/ASS五事件及字体附件通过,默认D3D12 UI/视频启动通过 |++所有GPU检查串行,单测试≤300秒、构建≤900秒;没有压力/竞争负载、主机账号连接、全局驱动或用户配置改动。验收截图 tests/list-preset-flow-20261006/ui3/screenshots/unified-flow-save.png 中实际开关与摘要可见。++失败没有抹掉:preset1新增节点夹具未移除旧保护节点而64项失败,修正夹具后preset2/preset3通过,旧存储语义的回归仍使用legacy mask15;ui1找不到已脱离父节点的隐藏弹窗,改为由生产DialogHost先打开后ui2通过,ui3实际点击开关并滚动复核;nrexport1脚本重用了original变量,在应用启动前AttributeError退出,修正为save_call后nrexport2通过。日志/旧临时夹具保留,失败不算产品通过。++本地main合并、源码ZIP、最终ZIP全CRC/载荷SHA和独立解压启动为下一阶段;结果以同任务archives/main-merge.json、logs/tested-inputs.json、test-packages/DELIVERY.json、logs/cold-verify-results.json为准,不用计划当完成证据。++新产物统一在 E:/项目/Veyra/{build,tests,logs,tmp,test-packages,verify,archives}/list-preset-flow-20261006;所有子进程临时目录只覆盖本进程及子进程。使用原Qt、patched FFmpeg、libass与SDK;不引入新组件或驱动。每阶段list-preset-flow-control.py核查20个其它工作区及旧包不变。++不扩大硬件通过范围:真实Xbox/RX9000 NR/RTX20–40/受影响采集卡及物理显示延迟仍按旧2.0.4验收的未测项保留。本轮只重新打包本地测试版,不公开push/Release。diff --git a/docs/LIST_PRESET_FLOW_PLAN_2026-10-06.md b/docs/LIST_PRESET_FLOW_PLAN_2026-10-06.mdnew file mode 100644index 00000000..32c7eb14--- /dev/null+++ b/docs/LIST_PRESET_FLOW_PLAN_2026-10-06.md@@ -0,0 +1,11 @@+# 2.0.4 列表预设的光流/内容节奏纠偏++用户截图纠偏:移除独立补帧预设,把光流算法、运动估算质量、内容节奏加入已有“另存为列表预设”。共享参数另列勾选项,取消勾选时保留当前值;原有补帧倍率/后端仍用原预设字段。使用同一预设库,不另建存储或工作流。++起点main d2e589a,新分支codex/list-preset-flow-20261006,worktree E:/项目/Veyra/worktrees/list-preset-flow-20261006;所有新产物按用途在E:/项目/Veyra的list-preset-flow-20261006目录。before全引用bundle已verify,21个旧工作树的未提交原字节/patch/status保存;原2.0.4包和20个其它工作区保留。不可变start.json与SHA在archives同任务目录。每阶段先执行list-preset-flow-control.py;不改旧guard和封存证据。++实现:删除独立FG卡片/API,旧prefs里的fgPresets不主动删除。现有PresetEntry加可选共享运动快照和独立内容位,覆盖光流/质量/AMD性能档/节奏;新格式10,旁路保存.flow,不覆盖旧版本库。旧格式1–9仍读,原行为保留;新的未勾选组严格不覆盖。列表/节点/导入导出和实际视频导出共用PresetLibrary,不引入第二序列化器。补齐选择摘要与四语言。++验证:旧库/全部内容掩码、新组单独/组合保存、未勾选保护、非法值/损坏不覆盖、重开/导出导入;真实QML桥接保存弹窗、恢复与移除旧卡片,以及原NR/FG生产热切换/导出。build≤900秒/test≤300秒/GPU串行,无压力/竞争负载、Agent、用户配置/驱动改动或主机连接。++交付:保持2.0.4显示版本,NVIDIA/AMD同生产EXE,继承上一轮已核验payload组件原字节;本地main延续上轮合并授权,仅修本问题。不push/Release。源码ZIP与CRC/全SHA/PE依赖/独立解压启动及新DELIVERY回执齐全后交付,旧包不覆盖。diff --git a/docs/RELEASE_NOTES_2.0.4.md b/docs/RELEASE_NOTES_2.0.4.mdindex 38959a14..29c3637d 100644--- a/docs/RELEASE_NOTES_2.0.4.md+++ b/docs/RELEASE_NOTES_2.0.4.md@@ -7,20 +7,20 @@- **NR 画面调控:** 总变化强度最高5,保留关闭调控的原始效果;自动分别适配风格0/1/2,并可调力度。手动提供九项色彩、亮度、高光和时域保护。每层独立,列表/节点、会话/预设与导出使用同一设置。- **Xbox 恢复:** H.264 解码报错或压缩输入丢包后清理参考历史、等待关键帧;连续失败时每会话有界重开硬解,再失败回退软解;仍无法恢复时明确结束并保留失败原因。恢复首帧带时间线断点,音频不靠停声制造同步。- **UI:** 列表画面与参数面板之间可拖动,记忆宽度、双击还原,视频窗口随面板同步;滑条旁数字支持点击输入、Enter/失焦确认、Esc取消;修复极简浮窗切模式误触播放/暂停、调色开关窄列溢出、NR卡片间距与导出滚动条。-- **补帧预设:** 独立保存/应用/删除补帧页倍率、方式、质量、运动、光流与内容节奏等完整配置,跨进程保留。逐字段核对实际设置,不可用或部分未生效时明确提示。+- **统一预设:** 移除误加的独立补帧预设。在“另存为列表/节点预设”中勾选“光流与内容节奏”,保存光流算法、运动估算质量、AMD半分辨率和内容节奏;未勾选时应用预设保留当前值。支持默认预设、重启及导入导出,旧预设保留原有行为。- **播放与性能:** 整合已验证的核心/单NR缓存、暂停复用及限定队列/导出调度,自定义0.25–4倍速、布局/全屏恢复、RTSS重启兼容;预热默认关闭。GPU优先级无保存值时默认实时,系统拒绝时尝试高档并显示实际状态,用户旧选择保持。- **现场修复与字幕:** 采集跳帧不再错误地反馈为低源节奏/频繁清历史;播放期间请求退出进程电源节流,停止恢复系统策略。每次图重建恢复GPU耗时采样;AMD NR不再被非NVIDIA规范化逻辑关闭。libass渲染外挂/内嵌ASS特效和字体附件,普通SRT/VTT保持原样。分别提供完整 NVIDIA / AMD 包,两个包同一EXE,运行组件和模型原字节保持,保留 patched FFmpeg 和 libass 许可证。新文件夹解压运行 `veyra_qml_ui.exe`,不用下载SDK或源码才能运行。ZIP可用Windows或7-Zip解压。-本机RTX5070的短测不能代替真实Xbox/RX9070XT、RX9000 NR、RTX20/30/40、受影响采集卡及后台系统场景。采集输入仍约60Hz,原NR+4K SR+3X组合实际消费约55–57fps,未宣称本版本该组合必达60fps。Xbox日志的硬解Invalid argument触发器尚未在AMD实机复制,恢复路径修复不等于驱动/补帧根因已查明。软件回退可能增加CPU与解码延迟,实时GPU优先级可能影响同时运行的其他程序,可在设置改为高/普通。可选Auto NR/先粗后细会改变画面;HDR/Dolby PR13/14继续暂缓。详见 [验收记录](RELEASE_2.0.4_ACCEPTANCE_2026-10-05.md)。+本机RTX5070的短测不能代替真实Xbox/RX9070XT、RX9000 NR、RTX20/30/40、受影响采集卡及后台系统场景。采集输入仍约60Hz,原NR+4K SR+3X组合实际消费约55–57fps,未宣称本版本该组合必达60fps。Xbox日志的硬解Invalid argument触发器尚未在AMD实机复制,恢复路径修复不等于驱动/补帧根因已查明。软件回退可能增加CPU与解码延迟,实时GPU优先级可能影响同时运行的其他程序,可在设置改为高/普通。可选Auto NR/先粗后细会改变画面;HDR/Dolby PR13/14继续暂缓。详见 [整合验收](RELEASE_2.0.4_ACCEPTANCE_2026-10-05.md) 和 [本次预设纠偏验收](LIST_PRESET_FLOW_ACCEPTANCE_2026-10-06.md)。## English- NR total strength reaches 5 with optional, per-layer automatic/manual picture control. Styles 0/1/2 have separate automatic defaults; nine manual controls and an amount slider are shared by sessions, presets and exports. Disabling control preserves the original residual behavior.- Xbox decoder recovery flushes reference history after hard errors or compressed-input loss, waits for a keyframe, and permits one hardware reopen followed by one software fallback per session. Persistent failures end with a preserved error; the first recovered frame resets enhancement history.- Professional panels are resizable and remember their width. Slider numbers accept typed values. Floating mode controls avoid unintended playback clicks; card spacing, narrow colour controls and the export scrollbar are repaired.-- Frame-generation presets save the complete tab and survive restart. Applied values are checked individually, with an explicit message for unavailable or partially applied settings.+- The existing list/node preset dialog includes an optional optical-flow and content-cadence block. It preserves the shared backend, estimation quality, AMD half-resolution and cadence through restart, startup defaults and import/export. Unchecked fields keep their current values. The separate frame-generation preset UI was removed.- Includes later NR performance work, custom playback rate, RTSS compatibility and fullscreen/layout repairs. Prewarming defaults off. An unset GPU scheduling preference now requests Realtime, with an explicit High fallback when refused; saved preferences remain unchanged.- Includes capture cadence/drop recovery, measured GPU timing after graph rebuilds, AMD NR enablement and libass animated/embedded ASS subtitles with font attachments.diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex c57977b5..189e942f 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -1,5 +1,14 @@# Veyra 工作记录+## 2026-10-06 2.0.4预设纠偏++用户截图说明不要独立补帧预设,而是把共享光流·运动估算区块纳入既有列表预设。分支codex/list-preset-flow-20261006从main d2e589a隔离施工;before全引用bundle、21工作树原字节/patch及旧2.0.4 ZIP/manifest SHA封存。移除独立FG UI/API,旧fgPresets数据不删除;统一库Flow可选范围含后端/质量/AMD半分辨率/内容节奏,默认启动节奏优先级同步修复。v10另存.flow、v1–9行为保留,新未勾选项不被ChainGlobalSettings覆盖。新增checkbox/完整摘要,四语言词条齐全。++实际命令、输出路径、失败与修复详 LIST_PRESET_FLOW_ACCEPTANCE_2026-10-06.md:生产496步及增量构建均0;482预设/236效果链/246修复/旧存储/i18n通过;Qt50/0,生产弹窗及重启/导入导出/部分范围,FSR/XeSS/DLSS切换、原版双NR5、4K HEVC完整60帧且导出worker明确flow=0/content=3,两个包ASS及默认D3D12启动通过。EXE d01329aa6d9fbd6ac2d1eee294782f4cb9d233490595ed2e3e1a9ea12c16b2d6,File/Product2.0.4。preset1旧保护节点夹具、ui1隐藏弹窗定位、nrexport1变量重名失败保留;更正后重测通过。++新产物全部 E:/项目/Veyra/{build,tests,logs,tmp,test-packages,verify,archives}/list-preset-flow-20261006,AMD/NVIDIA分别694/215既有组件文件原字节保持。20个其它工作区、原2.0.4包与Claude修改不变,无SDK/runtime进Git。当前准备本地main延续合并及最终封包,独立解压启动完成后交付;无新push/Release,不扩大Xbox/AMD/20–40/采集/物理延迟通过范围。++## 2026-10-05~06 2.0.4 分支整合与发布前测试用户明确授权检查各分支/Claude最新修复、整合当前修复到main并打包2.0.4测试。本轮从81b755b建隔离release-2.0.4-20261005;整合前main de18fc4已含性能及Claude现场修复6e9d827。审查29分支/20既有worktree,完整before bundle已verify,全部未提交/未跟踪文件原字节/补丁/hash保存;其余19工作树和原桌面保持。Claude最新21:50~22:19会话18份未提交UI文件从封存ZIP移植,保留原分支和未提交状态;旧OBS等价实现已在main,不重复覆盖,旧诊断/撤回实验不混入产品。diff --git a/i18n/catalog.json b/i18n/catalog.jsonindex f1ce74f9..d4df5a8b 100644--- a/i18n/catalog.json+++ b/i18n/catalog.json@@ -490,6 +490,13 @@"en": "AMD NR (experimental): requires an RX 9000 driver and lmxxf runtime, with an internal 1080p pixel budget. Model strength, residual and protection are supported; style uses the runtime configuration. HDR has not been validated.","ja": "AMD NR(実験):RX 9000 ドライバーと lmxxf ランタイムが必要です。内部処理の画素数は最大 1080p 相当です。モデル強度・残差・保護に対応し、スタイルはランタイム設定を使います。HDR は未検証です。"},+ {+ "zh": "AMD 光流",+ "src": "src/ui/QmlPlayerBridge.cpp",+ "zh-TW": "AMD 光流",+ "en": "AMD optical flow",+ "ja": "AMD オプティカルフロー"+ },{"zh": "AMD 性能档","src": "qml/ProPage.qml",@@ -1624,13 +1631,6 @@"en": "The Xbox sent no decodable picture; reconnect.","ja": "Xbox からデコード可能な映像が届きません。再接続してください。"},- {- "zh": "Xbox 视频解码连续失败,恢复后仍无法出画。请重连,并保留日志。",- "src": "src/source/XboxSessionSource.cpp",- "zh-TW": "Xbox 影片解碼連續失敗,恢復後仍無法顯示畫面。請重新連線,並保留日誌。",- "en": "Xbox video decoding failed repeatedly and could not recover a picture. Reconnect and keep the logs.",- "ja": "Xbox の映像デコードが連続して失敗し、復旧後も映像を表示できませんでした。再接続し、ログを保存してください。"- },{"zh": "Xbox 登录已失效,请重新登录。","src": "src/source/XboxSessionSource.cpp",@@ -1638,6 +1638,13 @@"en": "Xbox sign-in has expired; sign in again.","ja": "Xbox のサインインの有効期限が切れました。再度サインインしてください。"},+ {+ "zh": "Xbox 视频解码连续失败,恢复后仍无法出画。请重连,并保留日志。",+ "src": "src/source/XboxSessionSource.cpp",+ "zh-TW": "Xbox 影片解碼連續失敗,恢復後仍無法顯示畫面。請重新連線,並保留日誌。",+ "en": "Xbox video decoding failed repeatedly and could not recover a picture. Reconnect and keep the logs.",+ "ja": "Xbox の映像デコードが連続して失敗し、復旧後も映像を表示できませんでした。再接続し、ログを保存してください。"+ },{"zh": "Xbox 连接失败:","src": "src/source/XboxSessionSource.cpp",@@ -2625,13 +2632,6 @@"en": "The saved capture format is no longer available; choose the resolution, frame rate and pixel format again.","ja": "保存したキャプチャーフォーマットは使用できません。解像度、フレームレート、ピクセル形式を選び直してください。"},- {- "zh": "保存补帧页全部设置",- "src": "qml/ProPage.qml",- "zh-TW": "儲存補幀頁全部設定",- "en": "Saves every setting on the Frame Gen tab",- "ja": "フレーム生成タブの設定をすべて保存します"- },{"zh": "保存超时","src": "src/ui/QmlPlayerBridge.cpp",@@ -2758,6 +2758,13 @@"en": "Optical flow · motion estimation","ja": "オプティカルフロー · 動き推定"},+ {+ "zh": "光流与内容节奏",+ "src": "src/ui/QmlPlayerBridge.cpp",+ "zh-TW": "光流與內容節奏",+ "en": "Optical flow and content cadence",+ "ja": "オプティカルフローとコンテンツのフレームレート"+ },{"zh": "光流宽高减半,更省但更糙","src": "qml/ProPage.qml",@@ -3361,13 +3368,6 @@"en": "Delete node","ja": "ノードを削除"},- {- "zh": "删除补帧预设失败",- "src": "src/ui/QmlPlayerBridge.cpp",- "zh-TW": "刪除補幀預設失敗",- "en": "Could not delete the frame generation preset",- "ja": "フレーム生成プリセットを削除できませんでした"- },{"zh": "删除这一层","src": "qml/ProPage.qml",@@ -3515,6 +3515,13 @@"en": "Excludes the area from every NR layer · list mode only","ja": "領域内をすべての NR 層から除外 · リストモードのみ"},+ {+ "zh": "半分辨率",+ "src": "src/ui/QmlPlayerBridge.cpp",+ "zh-TW": "半解析度",+ "en": "Half resolution",+ "ja": "半解像度"+ },{"zh": "单例节点或数量已达上限","src": "qml/NodePage.qml",@@ -5468,13 +5475,6 @@"en": "Saved device (not connected)","ja": "保存済みのデバイス(未接続)"},- {- "zh": "已保存补帧预设:%1",- "src": "src/ui/QmlPlayerBridge.cpp",- "zh-TW": "已儲存補幀預設:%1",- "en": "Frame generation preset saved: %1",- "ja": "フレーム生成プリセットを保存しました:%1"- },{"zh": "已保存颜色预设:%1","src": "src/ui/QmlPlayerBridge.cpp",@@ -5643,13 +5643,6 @@"en": "Color settings copied","ja": "カラー設定をコピーしました"},- {- "zh": "已存在同名补帧预设",- "src": "src/ui/QmlPlayerBridge.cpp",- "zh-TW": "已存在同名補幀預設",- "en": "A frame generation preset with this name already exists",- "ja": "同じ名前のフレーム生成プリセットがすでにあります"- },{"zh": "已存在同名颜色预设","src": "src/ui/QmlPlayerBridge.cpp",@@ -5699,20 +5692,6 @@"en": "Color preset exported","ja": "カラープリセットを書き出しました"},- {- "zh": "部分补帧设置未被当前显卡或组件接受:%1",- "src": "src/ui/QmlPlayerBridge.cpp",- "zh-TW": "部分補幀設定未被目前顯卡或元件接受:%1",- "en": "Some frame generation settings were not accepted by the current GPU or components: %1",- "ja": "現在のGPUまたはコンポーネントで一部のフレーム生成設定を適用できませんでした:%1"- },- {- "zh": "已应用补帧预设:%1",- "src": "src/ui/QmlPlayerBridge.cpp",- "zh-TW": "已應用補幀預設:%1",- "en": "Frame generation preset applied: %1",- "ja": "フレーム生成プリセットを適用しました:%1"- },{"zh": "已开启","src": "qml/ProPage.qml",@@ -7730,13 +7709,6 @@"en": "No timing for this node yet","ja": "このノードの計測はまだありません"},- {- "zh": "暂无补帧预设",- "src": "qml/ProPage.qml",- "zh-TW": "暫無補幀預設",- "en": "No frame generation presets yet",- "ja": "フレーム生成プリセットはまだありません"- },{"zh": "暂无颜色预设","src": "qml/ColourPanel.qml",@@ -10642,13 +10614,6 @@"en": "FG off","ja": "フレーム生成オフ"},- {- "zh": "补帧关闭",- "src": "src/ui/QmlPlayerBridge.cpp",- "zh-TW": "補幀關閉",- "en": "Frame generation off",- "ja": "フレーム生成オフ"- },{"zh": "补帧只能放在链路最后","src": "src/engine/EffectChain.cpp",@@ -10733,41 +10698,6 @@"en": "The frame generation choice was not accepted; previous setting kept. Check the multiplier and backend capability","ja": "フレーム生成の選択が受け付けられなかったため、元の設定のままです。倍率と方式の対応範囲を確認してください"},- {- "zh": "补帧预设",- "src": "qml/ProPage.qml",- "zh-TW": "補幀預設",- "en": "Frame generation presets",- "ja": "フレーム生成プリセット"- },- {- "zh": "补帧预设不存在",- "src": "src/ui/QmlPlayerBridge.cpp",- "zh-TW": "補幀預設不存在",- "en": "The frame generation preset does not exist",- "ja": "フレーム生成プリセットが存在しません"- },- {- "zh": "补帧预设保存失败",- "src": "src/ui/QmlPlayerBridge.cpp",- "zh-TW": "補幀預設儲存失敗",- "en": "Could not save the frame generation preset",- "ja": "フレーム生成プリセットを保存できませんでした"- },- {- "zh": "补帧预设名称需为 1–48 个字符",- "src": "src/ui/QmlPlayerBridge.cpp",- "zh-TW": "補幀預設名稱需為 1–48 個字符",- "en": "Frame generation preset names must be 1–48 characters",- "ja": "フレーム生成プリセット名は 1–48 文字にしてください"- },- {- "zh": "补帧预设最多保存 32 个",- "src": "src/ui/QmlPlayerBridge.cpp",- "zh-TW": "補幀預設最多儲存 32 個",- "en": "Up to 32 frame generation presets can be saved",- "ja": "フレーム生成プリセットは 32 個まで保存できます"- },{"zh": "裁剪范围超出画面","src": "src/source/ScreenCaptureSource.cpp",@@ -13239,6 +13169,20 @@"en": "The preset does not exist","ja": "プリセットが存在しません"},+ {+ "zh": "预设光流字段损坏",+ "src": "src/engine/PresetLibrary.cpp",+ "zh-TW": "預設光流欄位損壞",+ "en": "Preset optical-flow fields are damaged",+ "ja": "プリセットのオプティカルフロー設定が破損しています"+ },+ {+ "zh": "预设光流或内容节奏无效",+ "src": "src/engine/PresetLibrary.cpp",+ "zh-TW": "預設光流或內容節奏無效",+ "en": "Invalid preset optical flow or content cadence",+ "ja": "プリセットのオプティカルフローまたはコンテンツのフレームレートが無効です"+ },{"zh": "预设内容类型无效","src": "src/engine/PresetLibrary.cpp",diff --git a/include/veyra/engine/PresetLibrary.h b/include/veyra/engine/PresetLibrary.hindex 6eec23e7..469d6ae5 100644--- a/include/veyra/engine/PresetLibrary.h+++ b/include/veyra/engine/PresetLibrary.h@@ -22,11 +22,28 @@ enum class PresetContent : uint32_t {Color = 1u << 1, // colour gradeFrameGeneration = 1u << 2, // multiplier and backendAudio = 1u << 3, // sync mode and offset+ Flow = 1u << 4, // shared optical flow and content cadence};constexpr uint32_t presetContentMask(PresetContent value) { return uint32_t(value); }-inline constexpr uint32_t kPresetAllContent =+inline constexpr uint32_t kPresetLegacyContent =presetContentMask(PresetContent::Chain) | presetContentMask(PresetContent::Color) |presetContentMask(PresetContent::FrameGeneration) | presetContentMask(PresetContent::Audio);+inline constexpr uint32_t kPresetAllContent = kPresetLegacyContent | presetContentMask(PresetContent::Flow);++struct PresetFlowSettings {+ OpticalFlowBackend backend = OpticalFlowBackend::Nvidia;+ FlowQuality quality = FlowQuality::Balanced;+ bool amdHalfResolution = false;+ ContentRate content = ContentRate::Transport;+ static PresetFlowSettings capture(const EnhancementSettings& s) {+ return {s.opticalFlowBackend, s.flow, s.amdFlowHalfResolution, s.content};+ }+ void apply(EnhancementSettings& s) const {+ s.opticalFlowBackend = backend; s.flow = quality;+ s.amdFlowHalfResolution = amdHalfResolution; s.content = content;+ }+ bool operator==(const PresetFlowSettings&) const = default;+};// The frame-generation pair a preset can carry. Deliberately smaller than the// full EnhancementSettings: a preset must never smuggle in capture or export@@ -43,7 +60,7 @@ struct PresetEntry {std::wstring note;ChainMode kind = ChainMode::List;bool builtin = false; // read-only: can be copied, never renamed or erased- uint32_t contents = kPresetAllContent;+ uint32_t contents = kPresetLegacyContent;EffectChain chain{};ColorSettings color{};PresetFrameGeneration fg{};@@ -55,6 +72,9 @@ struct PresetEntry {// v6: chain rendering choices also travel with list presets. No capture,// audio or export configuration is carried by this optional snapshot.std::optional<ChainGlobalSettings> globals;+ // v10 explicitly scopes shared flow, including when its checkbox is off.+ // Absent on v1-v9 entries, which retain their existing chain semantics.+ std::optional<PresetFlowSettings> flow;bool operator==(const PresetEntry&) const = default;};diff --git a/include/veyra/ui/QmlPlayerBridge.h b/include/veyra/ui/QmlPlayerBridge.hindex c69e0594..ee749f79 100644--- a/include/veyra/ui/QmlPlayerBridge.h+++ b/include/veyra/ui/QmlPlayerBridge.h@@ -457,11 +457,6 @@ class QmlPlayerBridge : public QObject {// node's settings, separate from the whole-chain presets.Q_PROPERTY(QVariantList lutLibrary READ lutLibrary NOTIFY colourLibraryChanged)Q_PROPERTY(QVariantList colourLooks READ colourLooks NOTIFY colourLibraryChanged)- // 补帧预设 (field request 2026-10-05): the whole 补帧 tab - backend, multiplier,- // motion source, optical flow, flow quality, content cadence, strict pacing and- // the low-latency queue - kept in the shell preferences, apart from the- // whole-chain presets (which carry only the multiplier and backend).- Q_PROPERTY(QVariantList fgPresets READ fgPresets NOTIFY fgPresetsChanged)public:bool amdNrGpu() const;@@ -946,10 +941,6 @@ public:Q_INVOKABLE bool importColourLook(const QString& path);Q_INVOKABLE void exportColourLookDialog(int index);Q_INVOKABLE bool exportColourLook(int index, const QString& path);- QVariantList fgPresets() const;- Q_INVOKABLE bool saveFgPreset(const QString& name, bool replace);- Q_INVOKABLE bool applyFgPreset(int index);- Q_INVOKABLE bool deleteFgPreset(int index);// The native HWND the engine presents into. The UI creates it as a child// window of the QML window and hands it over; the bridge never draws QML@@ -1057,7 +1048,6 @@ signals:void subtitleTextChanged();void preferencesChanged();void colourLibraryChanged();- void fgPresetsChanged();// Emitted only when the underlying snapshot actually changed, so QML// bindings do not re-evaluate 60 times a second for nothing.void snapshotChanged();diff --git a/qml/Veyra/DialogHost.qml b/qml/Veyra/DialogHost.qmlindex b7b2c731..da73f6e3 100644--- a/qml/Veyra/DialogHost.qml+++ b/qml/Veyra/DialogHost.qml@@ -1600,7 +1600,7 @@ Item {const name = presetNameField.text.trim()if (name.length === 0) { saveNote.text = qsTr("预设需要一个名字"); return }let mask = 0- const ids = ["chain", "color", "fg", "audio"]+ const ids = ["chain", "color", "fg", "audio", "flow"]for (const part of parts) {const bit = ids.indexOf(part.id)if (bit >= 0 && chosen[part.id] === true) mask |= (1 << bit)diff --git a/qml/Veyra/ProPage.qml b/qml/Veyra/ProPage.qmlindex 17e832a1..b079424e 100644--- a/qml/Veyra/ProPage.qml+++ b/qml/Veyra/ProPage.qml@@ -1588,57 +1588,6 @@ VPage {visible: root.tab === "fg"objectName: "list-fg-group"- // 补帧预设 (field request 2026-10-05): this whole tab by name - 补帧方式,- // 倍率, 运动来源, 光流算法, 运动估算质量, 内容节奏, 严格节奏 and- // 低延迟队列 - beside the whole-chain presets, as 颜色预设 is on 色彩.- VGroup {- objectName: "list-fg-presets"- VRow {- label: qsTr("补帧预设")- hint: qsTr("保存补帧页全部设置")- VSelect {- objectName: "fg-preset-select"- implicitWidth: 170- value: veyra.fgPresets.length ? qsTr("应用预设…") : qsTr("暂无补帧预设")- options: veyra.fgPresets.map(p => ({ id: String(p.index), label: p.name, note: p.note }))- onPicked: id => veyra.applyFgPreset(Number(id))- }- }- RowLayout {- Layout.fillWidth: true- spacing: 6- DialogHost.VTextField {- id: fgPresetName- objectName: "fg-preset-name"- Layout.fillWidth: true- placeholder: qsTr("新预设名称")- }- VButton {- objectName: "fg-preset-save"- text: qsTr("保存")- enabled: fgPresetName.text.trim().length > 0- onClicked: {- const name = fgPresetName.text.trim()- const exists = veyra.fgPresets.some(p => p.name === name)- if (veyra.saveFgPreset(name, exists)) fgPresetName.text = ""- }- }- VButton {- id: fgPresetMore- objectName: "fg-preset-more"- text: qsTr("管理"); ghost: true- enabled: veyra.fgPresets.length > 0- onClicked: fgPresetMenu.openAt(fgPresetMore, "down")- }- VMenu {- id: fgPresetMenu- title: qsTr("补帧预设")- items: veyra.fgPresets.map(p => ({ act: "delete", index: p.index, label: qsTr("删除「") + p.name + "」", note: p.note, icon: "trash" }))- onPicked: (i, item) => veyra.deleteFgPreset(item.index)- }- }- }-VAccordion {id: fgCardobjectName: "list-fg-card"diff --git a/scripts/acceptance/list-preset-flow-audit.py b/scripts/acceptance/list-preset-flow-audit.pynew file mode 100644index 00000000..5ec0d908--- /dev/null+++ b/scripts/acceptance/list-preset-flow-audit.py@@ -0,0 +1,52 @@+"""Independent complete payload hashes, vendor boundaries and PE import closure."""+import hashlib, json, os, sys+from pathlib import Path+import pefile++BASE=Path('E:/项目/Veyra'); TASK='list-preset-flow-20261006'+app=Path(sys.argv[1]).resolve(); flavor=sys.argv[2]; label=sys.argv[3]+assert app.is_relative_to(BASE.resolve()) and flavor in ('NVIDIA','AMD')+out=BASE/'logs'/TASK/(label+'.json'); assert not out.exists()+manifest=json.loads((app/'package-manifest.json').read_text(encoding='utf8'))+names={f.relative_to(app).as_posix():f for f in app.rglob('*') if f.is_file()}+expected={r['path'] for r in manifest['files']}|{'package-manifest.json'}+assert set(names)==expected, {'unexpected':list(set(names)-expected),'missing':list(expected-set(names))}+for row in manifest['files']:+ f=names[row['path']]+ with f.open('rb') as stream: sha=hashlib.file_digest(stream,'sha256').hexdigest()+ assert f.stat().st_size==row['size'] and sha==row['sha256'],row['path']+assert not any(f.suffix.lower() in ('.pdb','.lib','.pyd','.whl','.addon64') for f in names.values())+drivers={'nvcuda.dll','nvopticalflow64.dll','amdhip64.dll','amdhip64_6.dll','amdhip64_7.dll'}+assert not drivers & {f.name.lower() for f in names.values()}+if flavor=='NVIDIA':+ assert not any(n.startswith('runtime/amd-nr/') for n in names)+ vfg={f.name for n,f in names.items() if n.startswith('runtime/nvidia-vfg/')}+ assert vfg=={'NVVideoEffects.dll','nvVFXVideoFrameGeneration.dll','NVCVImage.dll','cudart64_12.dll','nvngxruntime.dll'},vfg+else:+ assert not any(f.name.lower().startswith(('nvngx','nvvideoeffects','cudart','npp','nvcv')) for f in names.values())+ assert 'runtime/amd-nr/LmxxfNrRuntime.dll' in names+fsr={f.name for n,f in names.items() if n.startswith('runtime_local/amd/fidelityfx/')}+assert fsr=={'amd_fidelityfx_loader_dx12.dll','amd_fidelityfx_upscaler_dx12.dll','amd_fidelityfx_framegeneration_dx12.dll'}+runtime=json.loads((app/'release-runtime-manifest.json').read_text(encoding='utf8'))+assert runtime==json.loads((app/'runtime/experimental/release-runtime-manifest.json').read_text(encoding='utf8'))+assert {n for n,f in names.items() if n.startswith(('runtime/','runtime_local/')) and f.suffix.lower() not in ('.json','.md','.txt')} <= {r['path'] for r in runtime['files']}+packaged={f.name.lower() for f in names.values() if f.suffix.lower()=='.dll'}+system=Path(os.environ['WINDIR'])/'System32'; imports=[]; missing=[]+for name,f in names.items():+ if f.suffix.lower() not in ('.dll','.exe'):continue+ pe=pefile.PE(str(f),fast_load=True)+ pe.parse_data_directories(directories=[pefile.DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_IMPORT'],pefile.DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT']])+ direct=[i.dll.decode().lower() for i in getattr(pe,'DIRECTORY_ENTRY_IMPORT',[])]+ delay=[i.dll.decode().lower() for i in getattr(pe,'DIRECTORY_ENTRY_DELAY_IMPORT',[])]+ pe.close()+ assert not any(n.startswith('npp') for n in direct+delay),(name,direct,delay)+ for dll in direct+delay:+ if dll in packaged or dll.startswith(('api-ms-','ext-ms-')) or (system/dll).is_file():continue+ missing.append({'file':name,'dependency':dll,'delay':dll in delay})+ imports.append({'file':name,'direct':direct,'delay':delay})+assert not missing,missing+result=dict(flavor=flavor,app=str(app),payloadFiles=len(manifest['files']),payloadBytes=sum(r['size'] for r in manifest['files']),+ sourceCommit=manifest.get('baseCommit'),releaseReady=manifest.get('releaseReady'),runtimeFiles=len(runtime['files']),+ peFiles=len(imports),imports=imports,missing=missing,fsrException=True)+out.write_text(json.dumps(result,ensure_ascii=False,indent=2),encoding='utf8')+print('PACKAGE AUDIT PASS',flavor,result['payloadFiles'],result['payloadBytes'],out,flush=True)diff --git a/scripts/acceptance/list-preset-flow-build.py b/scripts/acceptance/list-preset-flow-build.pynew file mode 100644index 00000000..58253abf--- /dev/null+++ b/scripts/acceptance/list-preset-flow-build.py@@ -0,0 +1,38 @@+"""Build merged production and regression targets without replacing dependencies."""+from pathlib import Path+import hashlib,json,os,subprocess,sys+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='list-preset-flow-20261006'+label=sys.argv[1];assert label.replace('-','').isalnum()+BUILD=BASE/'build'/TASK;TMP=BASE/'tmp'/TASK/'build';LOG=BASE/'logs'/TASK/(label+'.log')+for p in (BUILD,TMP,LOG.parent):p.mkdir(parents=True,exist_ok=True)+guard=[sys.executable,'-B',str(ROOT/'scripts/acceptance/list-preset-flow-control.py')]+subprocess.run(guard,check=True)+settings=[];cache=BASE/'build/capture-xbox-field-20261005/CMakeCache.txt'+for line in cache.read_text(encoding='utf8').splitlines():+ if ':' not in line or '=' not in line or line.startswith(('#','//')):continue+ keytype,value=line.split('=',1);key,kind=keytype.split(':',1)+ if kind in ('INTERNAL','STATIC') or key=='VEYRA_DISPLAY_VERSION':continue+ if key.startswith('VEYRA_') or key in ('CMAKE_PREFIX_PATH','CMAKE_MAKE_PROGRAM','PROTOC','PKG_CONFIG_EXECUTABLE'):+ if key=='VEYRA_LIBASS_ROOT':assert (Path(value)/'include/ass/ass.h').is_file()+ settings.append(f'set({key} [[{value}]] CACHE {kind} "Accepted dependencies" FORCE)')+assert any('VEYRA_LIBASS_ROOT' in line for line in settings)+settings.append('set(VEYRA_DISPLAY_VERSION [[2.0.4]] CACHE STRING "2.0.4 test candidate" FORCE)')+(TMP/'dependencies.cmake').write_text('\n'.join(settings),encoding='utf8')+targets=sys.argv[2:] or ['veyra_qml_ui','veyra_xbox_tests','veyra_capture_compressed_tests','veyra_scene_tests',+ 'veyra_live_timing_tests','veyra_qml_quick_tests','veyra_ui_i18n_tests','veyra_effect_chain_tests',+ 'veyra_repair_contract_tests','veyra_preset_library_tests','veyra_repair_preset_tests',+ 'veyra_nr_temporal_gpu_tests','veyra_nr_correction_gpu_tests','veyra_effect_availability_tests',+ 'veyra_vfg_settings_tests','veyra_capture_audio_tests']+assert all(t.replace('_','').isalnum() for t in targets)+cmd=TMP/'build.cmd'+cmd.write_text('@echo off\nchcp 65001 >nul\ncall "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat" >nul 2>&1\nif errorlevel 1 exit /b 4\n"%TASK_CMAKE%" --preset x64-release -S "%TASK_ROOT%" -B "%TASK_BUILD%" -C "%TASK_TMP%\\dependencies.cmake"\nif errorlevel 1 exit /b 5\n"%TASK_CMAKE%" --build "%TASK_BUILD%" --parallel 6 --target '+' '.join(targets)+'\nexit /b %errorlevel%\n',encoding='ascii')+env=os.environ.copy();env.update(TEMP=str(TMP),TMP=str(TMP),VSLANG='1033',TASK_ROOT=str(ROOT),TASK_BUILD=str(BUILD),TASK_TMP=str(TMP),+ TASK_CMAKE='C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe')+with LOG.open('x',encoding='utf8') as out:+ try:rc=subprocess.run(['cmd.exe','/d','/c',str(cmd)],cwd=ROOT,env=env,stdout=out,stderr=subprocess.STDOUT,timeout=890).returncode+ except subprocess.TimeoutExpired:rc=124+receipt={'exit':rc,'log':str(LOG),'targets':targets,'sourceHead':subprocess.check_output(['git','-C',str(ROOT),'rev-parse','HEAD'],text=True).strip(),+ 'dependencyCacheSha256':hashlib.sha256(cache.read_bytes()).hexdigest()}+LOG.with_suffix('.json').write_text(json.dumps(receipt,ensure_ascii=False,indent=2),encoding='utf8')+print('BUILD',rc,LOG);print('\n'.join(LOG.read_text(encoding='utf8',errors='replace').splitlines()[-18:]))+subprocess.run(guard,check=True);raise SystemExit(rc)diff --git a/scripts/acceptance/list-preset-flow-cold.py b/scripts/acceptance/list-preset-flow-cold.pynew file mode 100644index 00000000..a0ace7ff--- /dev/null+++ b/scripts/acceptance/list-preset-flow-cold.py@@ -0,0 +1,67 @@+from pathlib import Path, PurePosixPath+import ctypes, hashlib, json, os, stat, subprocess, time, zipfile++BASE=Path('E:/项目/Veyra'); TASK='list-preset-flow-20261006'+PACK=BASE/'test-packages'/TASK; LOG=BASE/'logs'/TASK+receipt=json.loads((PACK/'DELIVERY.json').read_text(encoding='utf8'))+results=[]+for row in receipt:+ vendor=row['vendor']; destination=BASE/'verify'/TASK/vendor+ assert destination.resolve().is_relative_to((BASE/'verify'/TASK).resolve()) and not destination.exists()+ archive=Path(row['archive']); assert hashlib.sha256(archive.read_bytes()).hexdigest()==row['archiveSha256']+ with zipfile.ZipFile(archive) as z:+ assert len(z.infolist())<5000 and sum(i.file_size for i in z.infolist())<5*1024**3+ for entry in z.infolist():+ path=PurePosixPath(entry.filename)+ assert not path.is_absolute() and '..' not in path.parts and ':' not in entry.filename+ assert not stat.S_ISLNK(entry.external_attr>>16)+ assert (destination/entry.filename).resolve().is_relative_to(destination.resolve())+ z.extractall(destination)+ app=destination/Path(row['candidate']).name+ manifest=json.loads((app/'package-manifest.json').read_text(encoding='utf8'))+ for item in manifest['files']:+ assert hashlib.sha256((app/item['path']).read_bytes()).hexdigest()==item['sha256'],item['path']+ out=BASE/'tests'/TASK/('cold-'+vendor); tmp=BASE/'tmp'/TASK/('cold-'+vendor)+ for p in (out,tmp):p.mkdir(parents=True,exist_ok=False)+ engine=LOG/('cold-'+vendor+'-engine.log'); console=LOG/('cold-'+vendor+'.log')+ env={k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_','QT_','QSG_'))}+ windows=Path(env['WINDIR'])+ env.update(TEMP=str(tmp),TMP=str(tmp),CUDA_CACHE_PATH=str(tmp/'cuda-cache'),VEYRA_LOG_FILE=str(engine),+ QML_DISABLE_DISK_CACHE='1',QT_FORCE_STDERR_LOGGING='1',+ PATH=os.pathsep.join(map(str,(windows/'System32',windows,windows/'System32/Wbem'))))+ args=[str(app/'veyra_qml_ui.exe'),'--data-dir',str(out/'profile'),'--page','pro','--size','1280x800',+ '--obs-game-capture','--exit-after','8000',str(BASE/'tests/field-fixes-20261005/media/fx-embedded.mkv')]+ begin=time.monotonic(); modules=[]+ with console.open('xb') as log:+ process=subprocess.Popen(args,cwd=app,env=env,stdout=log,stderr=subprocess.STDOUT)+ try:+ time.sleep(3)+ kernel=ctypes.WinDLL('kernel32',use_last_error=True); psapi=ctypes.WinDLL('psapi',use_last_error=True)+ kernel.OpenProcess.argtypes=[ctypes.c_ulong,ctypes.c_int,ctypes.c_ulong];kernel.OpenProcess.restype=ctypes.c_void_p+ kernel.CloseHandle.argtypes=[ctypes.c_void_p]+ psapi.EnumProcessModulesEx.argtypes=[ctypes.c_void_p,ctypes.POINTER(ctypes.c_void_p),ctypes.c_ulong,ctypes.POINTER(ctypes.c_ulong),ctypes.c_ulong]+ psapi.GetModuleFileNameExW.argtypes=[ctypes.c_void_p,ctypes.c_void_p,ctypes.c_wchar_p,ctypes.c_ulong]+ handle=kernel.OpenProcess(0x0410,False,process.pid);assert handle+ try:+ items=(ctypes.c_void_p*512)(); needed=ctypes.c_ulong()+ assert psapi.EnumProcessModulesEx(handle,items,ctypes.sizeof(items),ctypes.byref(needed),3)+ for i in range(min(512,needed.value//ctypes.sizeof(ctypes.c_void_p))):+ buffer=ctypes.create_unicode_buffer(32768)+ if psapi.GetModuleFileNameExW(handle,items[i],buffer,len(buffer)):+ path=Path(buffer.value)+ if path.name.startswith(('Qt6','avcodec-','avformat-','avutil-','swscale-','swresample-')):+ assert path.resolve().is_relative_to(app.resolve()),str(path)+ modules.append(str(path))+ finally:kernel.CloseHandle(handle)+ rc=process.wait(timeout=50)+ except BaseException:+ process.kill();process.wait(timeout=10);raise+ text=engine.read_text(encoding='utf8',errors='replace')+'\n'+console.read_text(encoding='utf8',errors='replace')+ bad=[line for line in text.splitlines() if any(word in line for word in ('[ERROR]','[FATAL]','ReferenceError:','TypeError:','no root object'))]+ assert rc==0 and not bad and len(modules)>10 and 'track ready events=5' in text and 'fonts configured container=1' in text,bad[:12]+ result={'vendor':vendor,'passed':True,'exit':rc,'seconds':round(time.monotonic()-begin,3),'app':str(app),+ 'args':args,'archiveSha256':row['archiveSha256'],'executableSha256':row['exeSha256'],+ 'ownQtAndCodecModulePaths':modules,'console':str(console),'engine':str(engine)}+ results.append(result);print('COLD ZIP START PASS',vendor,len(modules),'modules from extracted app',flush=True)+ (LOG/'cold-verify-results.json').write_text(json.dumps(results,ensure_ascii=False,indent=2)+'\n',encoding='utf8')+subprocess.run(['py','-3.11','-B','scripts/acceptance/list-preset-flow-control.py'],cwd=BASE/'worktrees'/TASK,check=True)diff --git a/scripts/acceptance/list-preset-flow-control.py b/scripts/acceptance/list-preset-flow-control.pynew file mode 100644index 00000000..6aec0715--- /dev/null+++ b/scripts/acceptance/list-preset-flow-control.py@@ -0,0 +1,31 @@+from pathlib import Path+import hashlib,json,subprocess+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='list-preset-flow-20261006';ARCH=BASE/'archives'/TASK+def git(root,*args):return subprocess.check_output(['git','-c','core.safecrlf=false','-C',str(root),*args],stderr=subprocess.PIPE)+def sha(data):return hashlib.sha256(data).hexdigest()+raw=(ARCH/'start.json').read_bytes();assert sha(raw)==(ARCH/'start.sha256').read_text().strip();start=json.loads(raw)+assert ROOT.resolve()==Path(start['root']).resolve() and git(ROOT,'branch','--show-current').decode().strip()==start['branch']+assert git(ROOT,'merge-base','HEAD',start['codeBase']).decode().strip()==start['codeBase']+allowed={'AGENTS.md','README.md','README_CN.md','i18n/catalog.json','include/veyra/engine/PresetLibrary.h','src/engine/PresetLibrary.cpp',+ 'include/veyra/ui/QmlPlayerBridge.h','src/ui/QmlPlayerBridge.cpp','qml/Veyra/ProPage.qml','qml/Veyra/DialogHost.qml',+ 'tests/unit/PresetLibraryTests.cpp','docs/WORKLOG.md','docs/CURRENT_STATUS.md','docs/RELEASE_NOTES_2.0.4.md',+ 'docs/LIST_PRESET_FLOW_PLAN_2026-10-06.md','docs/LIST_PRESET_FLOW_ACCEPTANCE_2026-10-06.md',+ 'scripts/acceptance/list-preset-flow-control.py','scripts/acceptance/list-preset-flow-build.py','scripts/acceptance/list-preset-flow-tests.py',+ 'scripts/acceptance/list-preset-flow-ui.qml','scripts/acceptance/list-preset-flow-package.py','scripts/acceptance/list-preset-flow-audit.py',+ 'scripts/acceptance/list-preset-flow-cold.py'}+changed=set(git(ROOT,'diff','--name-only',start['codeBase']).decode('utf8').splitlines())+changed.update(p for p in git(ROOT,'ls-files','--others','--exclude-standard','-z').decode('utf8').split('\0') if p)+assert changed<=allowed,sorted(changed-allowed)+assert not any(Path(p).suffix.lower() in {'.dll','.exe','.lib','.pdb','.onnx','.f16','.f32','.hsaco','.ptx','.addon64','.whl'} for p in changed)+for r in start['worktrees']:+ path=Path(r['path'])+ if path.resolve()==Path(start['mainPath']).resolve():+ receipt=ARCH/'main-merge.json';expected=json.loads(receipt.read_text(encoding='utf8'))['mainAfter'] if receipt.exists() else start['mainBefore']+ assert git(path,'rev-parse','HEAD').decode().strip()==expected and not git(path,'status','--porcelain').strip();continue+ assert git(path,'rev-parse','HEAD').decode().strip()==r['head'],str(path)+ for args,key in [(('status','--porcelain=v1','--untracked-files=all'),'statusSha256'),(('diff','--binary'),'workingDiffSha256'),(('diff','--cached','--binary'),'indexDiffSha256')]:assert sha(git(path,*args))==r[key],str(path)+ for rel,digest in r['files'].items():+ p=path/rel;assert (p.is_file() and sha(p.read_bytes())==digest) if digest else not p.exists(),str(p)+for name,digest in start['protectedPackages'].items():+ with Path(name).open('rb') as stream:assert hashlib.file_digest(stream,'sha256').hexdigest()==digest,name+print('LIST PRESET GUARD PASS',len(changed),'paths;',len(start['worktrees'])-1,'other checkouts and previous packages unchanged')diff --git a/scripts/acceptance/list-preset-flow-package.py b/scripts/acceptance/list-preset-flow-package.pynew file mode 100644index 00000000..1ec83253--- /dev/null+++ b/scripts/acceptance/list-preset-flow-package.py@@ -0,0 +1,123 @@+"""Create the two 2.0.4 candidates from audited payload lists and one production EXE."""+from pathlib import Path+import hashlib,json,shutil,subprocess,sys,zipfile+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='list-preset-flow-20261006';VERSION='2.0.4'+PACK=BASE/'test-packages'/TASK;BUILD=BASE/'build'/TASK;LOG=BASE/'logs'/TASK;ARCH=BASE/'archives'/TASK+mode=sys.argv[1];assert mode in ('stage','refresh','finalize')+label=sys.argv[2] if len(sys.argv)>2 else mode+assert label.replace('-','').isalnum()+guard=[sys.executable,'-B',str(ROOT/'scripts/acceptance/list-preset-flow-control.py')]+subprocess.run(guard,check=True)+def sha(p):+ with p.open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()+def save(p,obj):p.write_text(json.dumps(obj,ensure_ascii=False,indent=2)+'\n',encoding='utf8')+def git(*args):return subprocess.check_output(['git','-C',str(ROOT),*args],encoding='utf8',stderr=subprocess.PIPE).strip()+def private(rel):return any(part.startswith('user-data-') for part in Path(rel).parts) or rel.startswith(('logs/','tmp/','outputs/','screenshots/','profile/'))+def component(rel):return rel.startswith(('runtime/','runtime_local/','models/','licenses/')) or Path(rel).suffix.lower()=='.dll' or rel in ('release-runtime-manifest.json','vfg-runtime-manifest.json')+head=git('rev-parse','HEAD');dirty=bool(git('status','--porcelain'))+sourcezip=PACK/f'Veyra-{VERSION}-veyra-source.zip'+if mode=='finalize':+ assert not dirty,'Validated source must be committed before final packaging'+ frozen=json.loads((LOG/'tested-inputs.json').read_text(encoding='utf8'))+ assert frozen['executableSha256']==sha(BUILD/'veyra_qml_ui.exe')+ for rel,digest in frozen['productInputs'].items():assert sha(ROOT/rel)==digest,'Tested product changed: '+rel+ for name,digest in frozen['testReceipts'].items():assert sha(LOG/(name+'.json'))==digest,'Test receipt changed: '+name+ merge=json.loads((ARCH/'main-merge.json').read_text(encoding='utf8'))+ main=Path(merge['mainPath'])+ assert subprocess.check_output(['git','-C',str(main),'diff','--name-only',head,'HEAD'],text=True).strip()==''+ names=['preset3','chain1','repair1','legacy1','i18n1','qml1','ui3','uirestore1','hot1','nrexport2','nrrestore1','smokeAMD1','smokeNVIDIA1','smokeNative1']+ for name in names:+ result=json.loads((LOG/(name+'.json')).read_text(encoding='utf8'));assert result['passed'],name+ if name.startswith(('ui','hot','nr','smoke')):assert result['exeSha256']==sha(BUILD/'veyra_qml_ui.exe'),name+ assert not sourcezip.exists()+ files=[f for f in subprocess.check_output(['git','-C',str(ROOT),'ls-files','-z']).decode('utf8').split('\0') if f]+ with zipfile.ZipFile(sourcezip,'x',zipfile.ZIP_DEFLATED,compresslevel=6) as z:+ for rel in sorted(files):+ assert not rel.startswith(('runtime/','runtime_local/','third_party_local/','models/'))+ assert Path(rel).suffix.lower() not in ('.dll','.exe','.lib','.pdb','.addon64','.onnx','.bin','.hsaco','.ptx','.f16','.f32')+ z.write(ROOT/rel,arcname=f'Veyra-{VERSION}-source/'+rel)+ with zipfile.ZipFile(sourcezip) as z:+ assert z.testzip() is None+ for rel in files:assert hashlib.sha256(z.read(f'Veyra-{VERSION}-source/'+rel)).hexdigest()==sha(ROOT/rel)+ bundle=ARCH/'source-final.bundle';assert not bundle.exists()+ subprocess.run(['git','-C',str(ROOT),'bundle','create',str(bundle),'HEAD'],check=True)+ with (LOG/'source-final-verify.log').open('xb') as out:subprocess.run(['git','-C',str(ROOT),'bundle','verify',str(bundle)],stdout=out,stderr=subprocess.STDOUT,check=True)+delivery=[]+for vendor in ('AMD','NVIDIA'):+ source=BASE/'test-packages/release-2.0.4-20261005'/f'Veyra-2.0.4-{vendor}-win64-portable'+ app=PACK/f'Veyra-{VERSION}-{vendor}-win64-portable'+ manifest=json.loads((source/'package-manifest.json').read_text(encoding='utf8'))+ sourcepaths=[];immutable={}+ for row in manifest['files']:+ rel=row['path'];p=source/rel+ assert not private(rel) and p.resolve().is_relative_to(source.resolve())+ assert p.is_file() and p.stat().st_size==row['size'] and sha(p)==row['sha256'],str(p)+ sourcepaths.append(rel)+ if component(rel):immutable[rel]=row['sha256']+ if mode=='stage':+ assert not app.exists();app.mkdir(parents=True)+ for rel in sourcepaths:+ target=app/rel;target.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(source/rel,target)+ assert app.is_dir()+ # The export subprocess writes under its runtime even when the parent log+ # is redirected. Preserve only this task's candidate logs outside the pack.+ workerlogs=app/'logs'+ if workerlogs.exists():+ target=LOG/'candidate-worker-logs'/(vendor+'-'+label)+ assert workerlogs.resolve().is_relative_to(PACK.resolve()) and not workerlogs.is_symlink()+ assert target.resolve().is_relative_to(LOG.resolve()) and not target.exists()+ assert all(p.is_file() and not p.is_symlink() and p.name.startswith('export-worker-') and p.suffix=='.log' for p in workerlogs.iterdir())+ target.parent.mkdir(parents=True,exist_ok=True)+ preserved=[{'file':p.name,'sha256':sha(p)} for p in workerlogs.iterdir()]+ shutil.move(str(workerlogs),str(target))+ save(target.with_suffix('.json'),{'from':str(workerlogs),'to':str(target),'files':preserved})+ if mode in ('stage','refresh'):+ shutil.copy2(BUILD/'veyra_qml_ui.exe',app/'veyra_qml_ui.exe')+ shutil.copytree(ROOT/'qml',app/'qml',dirs_exist_ok=True)+ shutil.copytree(BUILD/'shaders',app/'shaders',dirs_exist_ok=True)+ for name in ('README.md','README_CN.md','README_EN.md','THIRD_PARTY_NOTICES.md'):shutil.copy2(ROOT/name,app/name)+ for name in ('RELEASE_2.0.4_PLAN_2026-10-05.md','RELEASE_2.0.4_ACCEPTANCE_2026-10-05.md','RELEASE_NOTES_2.0.4.md','BRANCH_MAP_2026-10-05.md','LIST_PRESET_FLOW_PLAN_2026-10-06.md','LIST_PRESET_FLOW_ACCEPTANCE_2026-10-06.md'):+ p=ROOT/'docs'/name+ if p.is_file():shutil.copy2(p,app/'docs'/name)+ (app/'TEST_2.0.4.md').write_text('Veyra 2.0.4 本地测试候选 / local test candidate\n\n'+ '整合 NR 强度5及三风格自动/手动调控、Xbox解码错误恢复、Claude UI修复、性能/计时/AMD NR/字幕及此前本地修复。'+ '公开版本仍为2.0.3,本包用于发布前测试。请先在新目录解压,不复制旧配置目录或混装DLL。\n\n'+ '重点复测:真实Xbox补帧热切换、采集60帧及后台播放、RX9000 NR、列表预设的光流与内容节奏保存/恢复。'+ '本机RTX5070短测不能代替对应显卡或主机实测,软件解码回退可能增加CPU与延迟;默认GPU优先级为实时,旧选择保留。\n\n'+ '详见docs/RELEASE_NOTES_2.0.4.md和docs/RELEASE_2.0.4_ACCEPTANCE_2026-10-05.md。\n',encoding='utf8')+ assert sha(app/'veyra_qml_ui.exe')==sha(BUILD/'veyra_qml_ui.exe')+ for p in (ROOT/'qml').rglob('*'):+ if p.is_file():assert sha(app/'qml'/p.relative_to(ROOT/'qml'))==sha(p)+ for rel,digest in immutable.items():assert sha(app/rel)==digest,rel+ expected=set(sourcepaths)|{'package-manifest.json','TEST_2.0.4.md',+ 'docs/RELEASE_2.0.4_PLAN_2026-10-05.md','docs/RELEASE_2.0.4_ACCEPTANCE_2026-10-05.md','docs/RELEASE_NOTES_2.0.4.md','docs/BRANCH_MAP_2026-10-05.md','docs/LIST_PRESET_FLOW_PLAN_2026-10-06.md','docs/LIST_PRESET_FLOW_ACCEPTANCE_2026-10-06.md'}+ expected.update('qml/'+p.relative_to(ROOT/'qml').as_posix() for p in (ROOT/'qml').rglob('*') if p.is_file())+ expected.update('shaders/'+p.relative_to(BUILD/'shaders').as_posix() for p in (BUILD/'shaders').rglob('*') if p.is_file())+ actual={p.relative_to(app).as_posix() for p in app.rglob('*') if p.is_file()}+ assert not actual-expected,sorted(actual-expected)+ assert not any(private(rel) or (app/rel).is_symlink() or Path(rel).suffix.lower() in ('.pdb','.lib','.addon64','.log','.dmp','.pyc','.whl') for rel in actual)+ records=[{'path':rel,'size':(app/rel).stat().st_size,'sha256':sha(app/rel)} for rel in sorted(actual-{'package-manifest.json'})]+ manifest.update(version=VERSION,candidate=VERSION,displayVersion=VERSION,sourceCommit=head,sourceArchiveCommit=head,+ baseCommit=head,worktreeDirty=dirty,localOnly=True,releaseReady=False,executableSha256=sha(app/'veyra_qml_ui.exe'),+ validationRecord='docs/LIST_PRESET_FLOW_ACCEPTANCE_2026-10-06.md',files=records,+ hardwareValidation='RTX5070 local regression only; actual Xbox/RX9070XT, RX9000 NR, RTX20/30/40 and affected capture card remain unverified')+ if mode=='finalize':manifest['correspondingSource'].update(application='../'+sourcezip.name,applicationSha256=sha(sourcezip),displayVersionOverride='-DVEYRA_DISPLAY_VERSION=2.0.4')+ save(app/'package-manifest.json',manifest)+ receipt={'vendor':vendor,'candidate':str(app),'exeSha256':sha(app/'veyra_qml_ui.exe'),'fileCount':len(records)+1,+ 'unchangedComponentCount':len(immutable),'sourceCommit':head,'mainCommit':json.loads((ARCH/'main-merge.json').read_text(encoding='utf8'))['mainAfter'] if (ARCH/'main-merge.json').exists() else None}+ subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/list-preset-flow-audit.py'),str(app),vendor,label+'-'+vendor],check=True)+ if mode=='finalize':+ archive=PACK/(app.name+'.zip');assert not archive.exists()+ print('ARCHIVE',vendor,flush=True)+ with zipfile.ZipFile(archive,'x',zipfile.ZIP_DEFLATED,compresslevel=6) as z:+ for rel in sorted(actual):z.write(app/rel,arcname=app.name+'/'+rel)+ with zipfile.ZipFile(archive) as z:+ assert z.testzip() is None+ for row in records:assert hashlib.sha256(z.read(app.name+'/'+row['path'])).hexdigest()==row['sha256']+ assert hashlib.sha256(z.read(app.name+'/package-manifest.json')).hexdigest()==sha(app/'package-manifest.json')+ receipt.update(archive=str(archive),archiveBytes=archive.stat().st_size,archiveSha256=sha(archive),+ sourceZip=str(sourcezip),sourceZipSha256=sha(sourcezip),packageManifestSha256=sha(app/'package-manifest.json'),zipCrcAndAllPayloadHashesPassed=True)+ delivery.append(receipt);print(json.dumps(receipt,ensure_ascii=False),flush=True)+save(LOG/('packages-'+label+'.json'),delivery)+if mode=='finalize':save(PACK/'DELIVERY.json',delivery)+subprocess.run(guard,check=True)diff --git a/scripts/acceptance/list-preset-flow-tests.py b/scripts/acceptance/list-preset-flow-tests.pynew file mode 100644index 00000000..5e96400e--- /dev/null+++ b/scripts/acceptance/list-preset-flow-tests.py@@ -0,0 +1,264 @@+"""2.0.4 regression using the existing field-test fixtures; no live Xbox login."""+from pathlib import Path+import hashlib, json, os, re, shutil, subprocess, sys, time++ROOT = Path(__file__).resolve().parents[2]+BASE = Path('E:/项目/Veyra'); TASK = 'list-preset-flow-20261006'+label = sys.argv[1]; case = sys.argv[2]+assert label.replace('-', '').isalnum()+if case == 'qml':+ app=BASE/'test-packages'/TASK/'Veyra-2.0.4-NVIDIA-win64-portable'+ qt=Path('C:/veyra-deps/qt-veyra/6.8.3/msvc2022_64')+ out=BASE/'tests'/TASK/label;tmp=BASE/'tmp'/TASK/label;log=BASE/'logs'/TASK/(label+'.log')+ for p in (out,tmp):p.mkdir(parents=True,exist_ok=False)+ for p in app.glob('Qt6*.dll'):shutil.copy2(p,out/p.name)+ for name in ('Qt6Test.dll','Qt6QuickTest.dll'):shutil.copy2(qt/'bin'/name,out/name)+ shutil.copy2(BASE/'build'/TASK/'veyra_qml_quick_tests.exe',out/'veyra_qml_quick_tests.exe')+ shutil.copytree(app/'qml',out/'qml');shutil.copytree(qt/'qml/QtTest',out/'qml/QtTest')+ shutil.copytree(ROOT/'tests/qml/quick',out/'qml-tests')+ env=os.environ.copy();env.update(TEMP=str(tmp),TMP=str(tmp),QML_DISABLE_DISK_CACHE='1',QT_FORCE_STDERR_LOGGING='1',+ QT_QPA_PLATFORM='offscreen',QT_QUICK_BACKEND='software',QT_QUICK_CONTROLS_STYLE='Basic',+ QT_QPA_PLATFORM_PLUGIN_PATH=str(qt/'plugins/platforms'),VEYRA_EXPORT_TEST_ARTIFACTS=str(out/'artifacts'),PATH=str(out)+os.pathsep+str(qt/'bin')+os.pathsep+env.get('PATH',''))+ (out/'artifacts').mkdir()+ args=[str(out/'veyra_qml_quick_tests.exe'),'-input',str(out/'qml-tests')]+ with log.open('xb') as console:+ try:rc=subprocess.run(args,cwd=out,env=env,stdout=console,stderr=subprocess.STDOUT,timeout=290).returncode+ except subprocess.TimeoutExpired:rc=124+ content=log.read_text(encoding='utf8',errors='replace')+ passed=rc==0 and '0 failed' in content and 'SliderNumberInput::test_' in content+ log.with_suffix('.json').write_text(json.dumps({'passed':passed,'exit':rc,'args':args,'log':str(log)},ensure_ascii=False,indent=2),encoding='utf8')+ print(content[-5000:]);raise SystemExit(0 if passed else 1)+if case in ('smoke','smoke-native','hot','ui','ui-restore','nr-export','nr-restore'):+ is_smoke=case.startswith('smoke')+ app=Path(sys.argv[3]).resolve()+ assert app.is_relative_to((BASE/'test-packages'/TASK).resolve()) and (app/'veyra_qml_ui.exe').is_file()+ log=BASE/'logs'/TASK/(label+'.log'); engine_log=log.with_name(label+'-engine.log')+ out=BASE/'tests'/TASK/label; tmp=BASE/'tmp'/TASK/label+ for p in (out,tmp):p.mkdir(parents=True,exist_ok=False)+ (out/'screenshots').mkdir()+ guard=[sys.executable,'-B',str(ROOT/'scripts/acceptance/list-preset-flow-control.py')]+ subprocess.run(guard,check=True)+ env={k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_','QT_','QSG_'))}+ windows=Path(env['WINDIR'])+ env.update(TEMP=str(tmp),TMP=str(tmp),CUDA_CACHE_PATH=str(tmp/'cuda-cache'),+ VEYRA_LOG_FILE=str(engine_log),QML_DISABLE_DISK_CACHE='1',QT_FORCE_STDERR_LOGGING='1',+ PATH=os.pathsep.join(map(str,(app,windows/'System32',windows,windows/'System32/Wbem'))))+ args=[str(app/'veyra_qml_ui.exe'),'--data-dir',str(out/'profile'),'--page','pro',+ '--size','1280x900','--obs-game-capture','--exit-after','250000' if case.startswith('nr-') else '8000' if is_smoke else '190000']+ if case=='smoke-native':args.remove('--obs-game-capture')+ main=app/'qml/Veyra/Main.qml'; original=main.read_bytes()+ assert original==(ROOT/'qml/Veyra/Main.qml').read_bytes()+ if is_smoke:+ media=BASE/'tests/field-fixes-20261005/media/fx-embedded.mkv';assert media.is_file()+ args.append(str(media))+ elif case in ('ui','ui-restore','nr-export','nr-restore'):+ is_nr=case.startswith('nr-');restore=case.endswith('restore')+ media=BASE/'tests/release-2.0.4-20261005/nr-fixture.mp4' if is_nr else BASE/'tests/hotfix-2.0.0-20261002/media/gta6-1080p30-60s.mp4'+ assert media.is_file()+ profile_receipt=BASE/'logs'/TASK/('nr-profile.json' if is_nr else 'ui-profile.json')+ if restore:+ profile=Path(json.loads(profile_receipt.read_text(encoding='utf8'))['profile'])+ args[args.index('--data-dir')+1]=str(profile)+ if not is_nr:+ prefs=profile/'qml-preferences.v1.json'+ values=json.loads(prefs.read_text(encoding='utf8'))+ values['contentRate']=2 # Must not override the selected default preset on restart.+ values['fgPresets']=[{'name':'legacy inactive FG entry','flowQuality':99}]+ prefs.write_text(json.dumps(values,ensure_ascii=False,indent=2),encoding='utf8')+ else:profile_receipt.write_text(json.dumps({'profile':str(out/'profile')}),encoding='utf8')+ if is_nr:+ (out/'outputs').mkdir()+ args += ['--export-out',str(out/'outputs')]+ source_file=ROOT/'scripts/acceptance/nr-protection-ui.qml'+ fixture=source_file.read_text(encoding='utf8')+ save_call='veyra.savePresetAs("NR correction manual five",1,false)'+ assert fixture.count(save_call)==1+ fixture=fixture.replace(save_call,'veyra.savePresetAs("NR correction manual five",17,false)')+ anchor=' test.require(veyra.savePresetAs("NR correction manual five",17,false)'+ assert fixture.count(anchor)==1+ fixture=fixture.replace(anchor,' veyra.flowQuality=0;veyra.amdFlowHalf=true;veyra.contentRate=3\n'+anchor)+ fixture=fixture.replace(' veyra.startExport();',+ ' test.require(veyra.selectExportPreset(test.savedIndex),"shared-flow export preset selection");\n'++ ' veyra.flowQuality=2;veyra.amdFlowHalf=false;veyra.contentRate=0;\n'++ ' console.log("LIST_PRESET_FLOW_EXPORT_SELECTED",veyra.exportPresetName);\n'++ ' veyra.startExport();')+ source_file=out/'nr-shared-flow-export.qml';source_file.write_text(fixture,encoding='utf8')++ properties='item.media='+json.dumps(str(media))+';item.evidence='+json.dumps(str(out))+';item.resume='+str(restore).lower()+';item.multi=false;item.visual=false;item.styleFollowup=true'+ else:+ source_file=ROOT/'scripts/acceptance/list-preset-flow-ui.qml'+ properties='item.media='+json.dumps(str(media))+';item.restore='+str(restore).lower()+';item.evidence='+json.dumps(str(out))+';item.dialogHost=dialogs'+ injection='\nLoader { anchors.fill: parent; source: '+json.dumps(source_file.as_uri())+'; onLoaded: { '+properties+' } }\n'+ source=original.decode('utf8');at=source.rfind('}');assert at>0+ main.write_text(source[:at]+injection+source[at:],encoding='utf8')+ else:+ media=BASE/'tests/hotfix-2.0.0-20261002/media/gta6-1080p30-60s.mp4';assert media.is_file()+ injection=r'''+ Timer {+ interval:250;running:true;repeat:true+ property int stage:0+ property int ticks:0+ property int total:0+ property int current:0+ property int readyTicks:0+ property double beforePosition:0+ property double readyPosition:0+ property var cases:["fsr3","xess","dlss","fsr3"]+ function require(ok,why){if(!ok)throw new Error(why)}+ function next(value){stage=value;ticks=0}+ function startCase(){+ beforePosition=veyra.position+ veyra.fgBackendName=cases[current];veyra.fgMultiplier=2;veyra.fgEnabled=true+ readyTicks=0+ next(2)+ }+ onTriggered:{try{+ ++ticks;++total+ require(total<720,"180s bounded deadline stage="+stage)+ require(!veyra.failed,"playback failed "+veyra.statusText)+ if(stage===0){+ if(ticks<8)return+ veyra.muted=true;veyra.nodeMode=0;veyra.nrEnabled=false;veyra.srEnabled=false;veyra.fgEnabled=false+ veyra.openPath(__MEDIA__);next(1)+ }else if(stage===1){+ if(!veyra.running||veyra.applying||veyra.position<.5)return+ startCase()+ }else if(stage===2){+ if(veyra.applying||!veyra.fgActive){readyTicks=0;return}+ if(!readyTicks){readyPosition=veyra.position;readyTicks=1;return}+ if(++readyTicks<16)return+ require(veyra.running&&veyra.fgActive,"FG not active "+cases[current])+ require(veyra.fgBackendName===cases[current]&&veyra.fgMultiplier===2,"backend not applied")+ require(veyra.position>readyPosition+1,"source stopped after ready "+cases[current])+ console.log("STREAM_FIX_FG_CASE",cases[current],veyra.position,veyra.submitFps,veyra.fgProviderText)+ ++current+ if(current<cases.length){startCase();return}+ beforePosition=veyra.position;veyra.fgEnabled=false;next(3)+ }else if(stage===3){+ if(ticks<12||veyra.applying)return+ require(veyra.running&&!veyra.fgActive&&veyra.position>beforePosition+.5,"FG disable stopped playback")+ veyra.nrEnabled=true+ const first=veyra.nrLayers[0].index+ require(veyra.setNrLayerParameter(first,"runtime",3),"original NR selection")+ require(veyra.setNrLayerParameter(first,"style",1),"NR style 1")+ require(veyra.setNrLayerParameter(first,"total",5),"NR strength 5")+ require(veyra.setNrLayerParameter(first,"correctionEnabled",1),"NR protection")+ require(veyra.duplicateNrLayer(first)>=0,"second NR layer")+ const second=veyra.nrLayers[1].index+ require(veyra.setNrLayerParameter(second,"style",2),"second NR style 2")+ require(veyra.setNrLayerParameter(second,"correctionAuto",0),"second manual NR")+ beforePosition=veyra.position;readyTicks=0;next(4)+ }else if(stage===4){+ if(veyra.applying||!veyra.nrActive){readyTicks=0;return}+ if(!readyTicks){readyPosition=veyra.position;readyTicks=1;return}+ if(++readyTicks<16)return+ require(veyra.running&&veyra.nrActive&&veyra.nrLayers.length===2,"two-layer NR inactive")+ require(veyra.position>readyPosition+.5,"NR preview stopped after ready")+ require(veyra.setPreference("screenshotDir",__SCREENSHOTS__),"screenshot directory")+ veyra.takeScreenshot()+ console.log("STREAM_FIX_NR_CASE",JSON.stringify(veyra.nrLayers));next(5)+ }else if(stage===5){+ if(ticks<8)return+ console.log("STREAM_FIX_HOT_PASS");Qt.quit()+ }+ }catch(e){console.error("STREAM_FIX_HOT_FAIL",e.message);Qt.quit()}}+ }+'''.replace('__MEDIA__',json.dumps(str(media))).replace('__SCREENSHOTS__',json.dumps(str(out/'screenshots')))+ source=original.decode('utf8'); at=source.rfind('}');assert at>0+ main.write_text(source[:at]+injection+source[at:],encoding='utf8')+ begin=time.monotonic()+ try:+ with log.open('xb') as console:+ try:rc=subprocess.run(args,cwd=app,env=env,stdout=console,stderr=subprocess.STDOUT,timeout=270).returncode+ except subprocess.TimeoutExpired:rc=124+ finally:main.write_bytes(original)+ console=log.read_text(encoding='utf8',errors='replace')+ text=engine_log.read_text(encoding='utf8',errors='replace') if engine_log.exists() else ''+ bad=[line for line in (text+'\n'+console).splitlines() if any(word in line for word in ('[ERROR]','[FATAL]','ReferenceError:','TypeError:','no root object','STREAM_FIX_HOT_FAIL'))]+ ass=[line for line in text.splitlines() if '[libass]' in line]+ passed=rc==0 and not bad+ if is_smoke:passed=passed and any('track ready events=5' in line for line in ass) and any('fonts configured container=1' in line for line in ass)+ elif case in ('ui','ui-restore','nr-export','nr-restore'):+ marker={'ui':'LIST_PRESET_FLOW_UI_PASS','ui-restore':'LIST_PRESET_FLOW_RESTORE_PASS','nr-export':'NR_CONTROLS_UI_PASS','nr-restore':'NR_CONTROLS_RESTORE_PASS'}[case]+ passed=passed and marker in console and 'LIST_PRESET_FLOW_UI_FAIL' not in console and 'NR_CONTROLS_UI_FAIL' not in console+ if case=='ui':passed=passed and 'LIST_PRESET_FLOW_SCOPE_PASS' in console and bool(list((out/'screenshots').glob('*.png')))+ if case=='ui-restore':passed=passed and json.loads((profile/'qml-preferences.v1.json').read_text(encoding='utf8'))['fgPresets']==values['fgPresets']+ if case=='nr-export':+ worker_text='\n'.join(p.read_text(encoding='utf8',errors='replace') for p in (app/'logs').glob('export-worker-*.log'))+ frozen_export=[line for line in (text+'\n'+worker_text).splitlines() if '[export-frozen]' in line]+ passed=passed and 'LIST_PRESET_FLOW_EXPORT_SELECTED' in console and any('flow=0 content=3 ' in line for line in frozen_export)+ outputs=list((out/'outputs').glob('*.mp4'))+ passed=passed and len(outputs)==1 and len(list((out/'screenshots').glob('*.png')))>=4+ if outputs:+ probe_exe=shutil.which('ffprobe');assert probe_exe,'ffprobe is required'+ probe=json.loads(subprocess.check_output([probe_exe,'-v','error','-count_frames','-show_streams','-of','json',str(outputs[0])],timeout=30))+ stream=next(s for s in probe['streams'] if s['codec_type']=='video')+ passed=passed and stream['codec_name']=='hevc' and int(stream['nb_read_frames'])==60 and (int(stream['width']),int(stream['height']))==(3840,2160)+ (out/'export-probe.json').write_text(json.dumps(probe,indent=2),encoding='utf8')+ else:+ passed=passed and 'STREAM_FIX_HOT_PASS' in console and console.count('STREAM_FIX_FG_CASE')==4 and 'STREAM_FIX_NR_CASE' in console and bool(list((out/'screenshots').glob('*.png')))+ assert main.read_bytes()==original+ result={'passed':passed,'exit':rc,'seconds':round(time.monotonic()-begin,3),'args':args,+ 'exeSha256':hashlib.sha256((app/'veyra_qml_ui.exe').read_bytes()).hexdigest(),+ 'mainQmlSha256':hashlib.sha256(original).hexdigest(),'log':str(log),'engineLog':str(engine_log),+ 'libass':ass[:8],'errors':bad[:20]}+ if case=='nr-export':result['frozenExport']=frozen_export+ log.with_suffix('.json').write_text(json.dumps(result,ensure_ascii=False,indent=2),encoding='utf8')+ print('LOCAL APP',case,'PASS' if passed else 'FAIL',log)+ print('\n'.join(bad[:12] or [line for line in console.splitlines() if any(marker in line for marker in ('STREAM_FIX_','LIST_PRESET_FLOW_','NR_CONTROLS_'))]))+ subprocess.run(guard,check=True)+ raise SystemExit(0 if passed else 1)+BUILD = BASE/'build'/TASK+APP = BASE/'test-packages'/TASK/'Veyra-2.0.4-NVIDIA-win64-portable'+cases = {'xbox': 'veyra_xbox_tests', 'scene': 'veyra_scene_tests',+ 'timing': 'veyra_live_timing_tests', 'codec': 'veyra_capture_compressed_tests',+ 'repair': 'veyra_repair_contract_tests', 'chain': 'veyra_effect_chain_tests',+ 'preset': 'veyra_preset_library_tests', 'legacy': 'veyra_repair_preset_tests',+ 'i18n': 'veyra_ui_i18n_tests', 'hardware': 'veyra_effect_availability_tests',+ 'vfg-settings': 'veyra_vfg_settings_tests', 'audio': 'veyra_capture_audio_tests',+ 'temporal': 'veyra_nr_temporal_gpu_tests', 'correction': 'veyra_nr_correction_gpu_tests',+ 'correction-fp16': 'veyra_nr_correction_gpu_tests'}+assert case in cases+LOG = BASE/'logs'/TASK/(label+'.log'); TMP = BASE/'tmp'/TASK/label+OUT = BASE/'tests'/TASK/label+for p in (LOG.parent, TMP, OUT): p.mkdir(parents=True, exist_ok=True)+guard = [sys.executable, '-B', str(ROOT/'scripts/acceptance/list-preset-flow-control.py')]+subprocess.run(guard, check=True)+exe = BUILD/(cases[case]+'.exe'); assert exe.is_file()+args = [str(exe)]+fixture = None+if case == 'legacy':args.append('presets/legacy-presets.v1')+if case == 'vfg-settings':args.append(str(OUT/'vfg-settings'))+if case == 'audio':args.append('--xbox-float-rtp')+if case.startswith('correction'):+ args += [str(BASE/'tests/nr-strength-protection-20261005/baseline/NrResidualComposite.dxil'),str(OUT/'shader')]+ if case.endswith('fp16'):args.append('--fp16')+if case == 'codec':+ fixture = Path(sys.argv[3]); assert fixture.resolve().is_relative_to(BASE.resolve()) and fixture.is_file()+ # The inherited main(char**) fixture loader is ANSI on Windows. Run from+ # the isolated Unicode directory with an ASCII relative media argument.+ local_fixture = OUT/('input'+fixture.suffix)+ assert not local_fixture.exists()+ shutil.copy2(fixture, local_fixture)+ assert hashlib.sha256(local_fixture.read_bytes()).digest() == hashlib.sha256(fixture.read_bytes()).digest()+ args.append(local_fixture.name)+env = {k:v for k,v in os.environ.items() if not k.upper().startswith('VEYRA_')}+env.update(TEMP=str(TMP), TMP=str(TMP), VEYRA_LOG_FILE=str(OUT/'product.log'),+ PATH=str(APP)+os.pathsep+env.get('PATH', ''))+begin = time.monotonic()+with LOG.open('xb') as log:+ try:+ rc = subprocess.run(args, cwd=OUT, env=env, stdout=log,+ stderr=subprocess.STDOUT, timeout=290).returncode+ except subprocess.TimeoutExpired:+ rc = 124+content = LOG.read_text(encoding='utf8', errors='replace')+passed = rc == 0 and not re.search(r'^(?:FAIL\b|FAILURES\b|SKIP\b)', content, re.MULTILINE)+result = {'passed':passed, 'exit':rc, 'seconds':round(time.monotonic()-begin, 3),+ 'args':args, 'exeSha256':hashlib.sha256(exe.read_bytes()).hexdigest(), 'log':str(LOG)}+if fixture: result['fixtureSha256'] = hashlib.sha256(fixture.read_bytes()).hexdigest()+LOG.with_suffix('.json').write_text(json.dumps(result, ensure_ascii=False, indent=2), encoding='utf8')+lines=[line for line in content.splitlines() if re.match(r'^(?:\[?(?:PASS|FAIL)\b|ALL PASS\b|FAILURES\b|SKIP\b|xbox tests:|SCENE-TESTS:|hardware frames=|software frames=)',line)]+print('\n'.join(lines[-90:])); print('LOCAL TEST', case, 'PASS' if passed else 'FAIL', LOG)+subprocess.run(guard, check=True)+raise SystemExit(0 if passed else 1)diff --git a/scripts/acceptance/list-preset-flow-ui.qml b/scripts/acceptance/list-preset-flow-ui.qmlnew file mode 100644index 00000000..accd1337--- /dev/null+++ b/scripts/acceptance/list-preset-flow-ui.qml@@ -0,0 +1,108 @@+import QtQuick+Item {+ id: test+ property string media: ""+ property string evidence: ""+ property bool restore: false+ property var appWindow: Window.window+ property int phase: 0+ property int ticks: 0+ property double startPosition: 0+ property var savedDialog: null+ property var dialogHost: null+ property bool captured: false+ function require(ok,why) { if (!ok) throw new Error(why) }+ function find(item,name) {+ if(item.objectName===name)return item+ for(const child of item.children||[]){const hit=find(child,name);if(hit)return hit}+ return null+ }+ function scroll(item) {+ if(typeof item.contentY==="number" && item.contentHeight>item.height)return item+ for(const child of item.children||[]){const hit=scroll(child);if(hit)return hit}+ return null+ }+ function flow() { return [veyra.opticalFlowChoice,veyra.flowQuality,veyra.amdFlowHalf,veyra.contentRate] }+ function checkFlow(want) { require(JSON.stringify(flow())===JSON.stringify(want),"flow expected="+JSON.stringify(want)+" got="+JSON.stringify(flow())) }+ function preset(name) { const row=veyra.presets.find(p=>p.name===name);require(row!==undefined,"missing preset "+name);return row }+ function configure(quality,half,cadence) { require(veyra.setOpticalFlowChoice(0),"NVOF selection");veyra.flowQuality=quality;veyra.amdFlowHalf=half;veyra.contentRate=cadence }+ Timer {+ interval:250;running:true;repeat:true+ onTriggered: { try {+ ++test.ticks+ test.require(test.ticks<400,"100s deadline phase="+test.phase)+ test.require(!veyra.failed,"playback failed "+veyra.statusText)+ if(test.phase===0) {+ if(test.ticks<8)return+ test.require(!test.find(test.appWindow.contentItem,"list-fg-presets"),"standalone FG card remains")+ test.require(veyra.fgPresets===undefined&&typeof veyra.saveFgPreset==="undefined","standalone FG API remains")+ if(test.restore) {+ test.checkFlow([0,0,true,5])+ test.require(veyra.defaultPresetIndex===test.preset("204 shared flow").index,"default preset index lost")+ test.configure(2,false,0)+ test.require(veyra.applyPresetIndex(test.preset("204 shared flow").index),"restart unified apply")+ test.checkFlow([0,0,true,5])+ console.log("LIST_PRESET_FLOW_RESTORE_PASS",JSON.stringify(test.flow()));Qt.quit();return+ }+ veyra.nodeMode=0;veyra.muted=true;veyra.nrEnabled=false;veyra.srEnabled=false;veyra.fgEnabled=false+ test.configure(0,true,5);test.checkFlow([0,0,true,5])+ test.require(test.dialogHost!==null,"production dialog host missing")+ test.dialogHost.open("save");test.phase=1+ } else if(test.phase===1) {+ const dialog=test.find(test.appWindow.contentItem,"preset-save-dialog")+ if(!dialog)return+ test.savedDialog=dialog+ const part=dialog.parts.find(p=>p.id==="flow")+ test.require(part&&part.meaningful&&part.summary.indexOf("NVIDIA NVOF")>=0&&part.summary.indexOf("60→30")>=0,"shared flow summary missing current values")+ test.require(test.find(dialog,"preset-part-flow")!==null,"shared flow checkbox missing")+ test.find(dialog,"preset-name").text="204 shared flow"+ for(const part of dialog.parts)test.find(dialog,"preset-part-"+part.id).toggled(part.id==="flow")+ const scroller=test.scroll(dialog)+ if(scroller)scroller.contentY=scroller.contentHeight-scroller.height+ test.phase=11+ } else if(test.phase===11) {+ test.require(test.find(test.savedDialog,"preset-part-flow").checked &&+ !test.find(test.savedDialog,"preset-part-chain").checked,"production checkbox did not reflect choices")+ test.appWindow.contentItem.grabToImage(result=>{test.require(result.saveToFile(test.evidence+"/screenshots/unified-flow-save.png"),"save-dialog screenshot");test.captured=true})+ test.phase=2+ } else if(test.phase===2) {+ if(!test.captured)return+ test.savedDialog.actionTriggered("保存预设")+ const row=test.preset("204 shared flow")+ test.require(row.contents===16&&!row.nodeMode,"dialog saved incorrect mask or kind")+ test.require(veyra.exportPreset(row.index,test.evidence+"/shared-flow.v10"),"preset export")+ test.require(veyra.importPreset(test.evidence+"/shared-flow.v10"),"preset import")+ test.configure(2,false,0)+ test.require(veyra.applyPresetIndex(row.index),"unified flow-only preset apply")+ test.checkFlow([0,0,true,5])+ test.require(!veyra.fgEnabled&&!veyra.nrEnabled&&!veyra.srEnabled,"flow-only changed effects")+ test.require(veyra.savePresetAs("204 chain without flow",1,false),"save unselected shared flow")+ test.configure(2,false,3)+ test.require(veyra.applyPresetIndex(test.preset("204 chain without flow").index),"chain-only preset apply")+ test.checkFlow([0,2,false,3])+ veyra.nodeMode=1;test.configure(1,true,2)+ test.require(veyra.savePresetAs("204 node flow",16,true),"node flow save")+ test.configure(2,false,4)+ test.require(veyra.applyPresetIndex(test.preset("204 node flow").index),"node flow apply")+ test.checkFlow([0,1,true,2])+ veyra.nodeMode=0+ test.require(veyra.setDefaultPreset(row.index),"set shared flow startup default")+ test.require(veyra.applyPresetIndex(row.index),"list flow after mode switch")+ test.checkFlow([0,0,true,5])+ console.log("LIST_PRESET_FLOW_SCOPE_PASS",JSON.stringify(veyra.presets))+ // Source cadence is allowed to differ; applying the preset must keep playback progressing.+ test.configure(0,true,0);veyra.openPath(test.media);test.phase=3+ } else if(test.phase===3) {+ if(!veyra.running||veyra.applying||veyra.position<.5)return+ test.startPosition=veyra.position+ test.require(veyra.applyPresetIndex(test.preset("204 shared flow").index),"flow preset during playback")+ test.checkFlow([0,0,true,5]);test.phase=4+ } else if(test.phase===4) {+ if(veyra.applying||veyra.position<test.startPosition+1)return+ test.require(veyra.running,"preset stalled playback")+ console.log("LIST_PRESET_FLOW_UI_PASS",veyra.position,JSON.stringify(test.flow()))+ veyra.stopPlayback();Qt.quit()+ }+ } catch(e) { console.error("LIST_PRESET_FLOW_UI_FAIL",e.message);Qt.quit() } }+ }+}diff --git a/src/engine/PresetLibrary.cpp b/src/engine/PresetLibrary.cppindex fd0064a8..608de604 100644--- a/src/engine/PresetLibrary.cpp+++ b/src/engine/PresetLibrary.cpp@@ -69,6 +69,7 @@ void PresetLibrary::addBuiltins() {bool PresetLibrary::load() {error_.clear();addBuiltins();+ const auto directFlow=std::filesystem::path(path_).concat(L".flow");const auto rootVfg=std::filesystem::path(path_).concat(L".vfg");if(std::filesystem::exists(rootVfg))path_=rootVfg;const auto rootRendering=std::filesystem::path(path_).concat(L".field-render");@@ -84,6 +85,9 @@ bool PresetLibrary::load() {if(std::filesystem::exists(renderingPath))path_=renderingPath;const auto vfgPath=std::filesystem::path(path_).concat(L".vfg");if(std::filesystem::exists(vfgPath))path_=vfgPath;+ const auto flowPath=std::filesystem::path(path_).concat(L".flow");+ if(std::filesystem::exists(directFlow))path_=directFlow;+ else if(std::filesystem::exists(flowPath))path_=flowPath;if (!std::filesystem::exists(path_)) return true;std::error_code ec;const auto size = std::filesystem::file_size(path_, ec);@@ -177,8 +181,9 @@ bool PresetLibrary::save() {std::wstring checkedDefault;// Match PresetStore: never replace a valid file with one our reader rejects.if (!parse(data, checked, checkedDefault, error_)) return false;- if(data.starts_with("VEYRA_PRESET_LIBRARY 7")&&!path_.wstring().ends_with(L".vfg"))path_=std::filesystem::path(path_).concat(L".vfg");- if(!path_.wstring().ends_with(L".vfg")){+ if(data.starts_with("VEYRA_PRESET_LIBRARY 10")&&!path_.wstring().ends_with(L".flow"))path_=std::filesystem::path(path_).concat(L".flow");+ if(data.starts_with("VEYRA_PRESET_LIBRARY 7")&&!path_.wstring().ends_with(L".vfg")&&!path_.wstring().ends_with(L".flow"))path_=std::filesystem::path(path_).concat(L".vfg");+ if(!path_.wstring().ends_with(L".vfg")&&!path_.wstring().ends_with(L".flow")){if(data.starts_with("VEYRA_PRESET_LIBRARY 6")&&!path_.wstring().ends_with(L".field-render"))path_=std::filesystem::path(path_).concat(L".field-render");if (std::any_of(entries_.begin(), entries_.end(), [](const auto& e) { return e.nodeConfiguration.has_value(); }) &&!path_.wstring().ends_with(L".field-render")&&!path_.wstring().ends_with(L".p3-editor") && !path_.wstring().ends_with(L".p3-globals"))@@ -282,6 +287,7 @@ const std::optional<size_t> PresetLibrary::defaultIndex() const {}void PresetLibrary::apply(const PresetEntry& entry, EnhancementSettings& settings) {+ const auto keepFlow = PresetFlowSettings::capture(settings);// fromChain() rewrites every stage field, including the ones this preset// does not claim (a colour grade travels inside the chain because the// colour stage is part of it). Keep the unclaimed parts exactly as the@@ -323,6 +329,10 @@ void PresetLibrary::apply(const PresetEntry& entry, EnhancementSettings& settingsettings.audioSync = keepAudioSync;settings.audioOffsetMs = keepAudioOffset;}+ if (entry.flow) {+ if (entry.contents & presetContentMask(PresetContent::Flow)) entry.flow->apply(settings);+ else keepFlow.apply(settings);+ }}ChainValidation PresetLibrary::applyToChain(const PresetEntry& entry, EffectChain& chain,@@ -412,6 +422,7 @@ ChainValidation PresetLibrary::applyToEditor(const PresetEntry& entry, NodeEditoauto& nodes = next->nodes; auto& layout = next->layout;auto values = settings;if (document.globals) document.globals->apply(values);+ const auto keepFlow = PresetFlowSettings::capture(values);if ((entry.contents & presetContentMask(PresetContent::Chain)) && entry.nodeConfiguration) {const auto& saved = *entry.nodeConfiguration;if (saved.editor) *next = *saved.editor;@@ -529,6 +540,10 @@ ChainValidation PresetLibrary::applyToEditor(const PresetEntry& entry, NodeEditoif (end != NodeGraphLayout::Input) return projected;}applyRenderingPreset(entry,values);+ if (entry.flow) {+ if (entry.contents & presetContentMask(PresetContent::Flow)) entry.flow->apply(values);+ else keepFlow.apply(values);+ }if (next->globals || ChainGlobalSettings::capture(values) != ChainGlobalSettings::capture(settings))next->globals = ChainGlobalSettings::capture(values);auto contract = std::make_unique<ChainConfiguration>(ChainConfiguration::capture(*runtime, values));@@ -589,7 +604,8 @@ std::string PresetLibrary::encodeEntries(const std::vector<PresetEntry>& entriesconst bool correctionExtended=std::any_of(entries_.begin(),entries_.end(),[](const auto& e){for(unsigned i=0;i<e.chain.nodeCount;++i)if(e.chain.nodes[i].nr.residual.correction.extendedControls())return true;return false;});- const int version=std::max(minimumVersion, correctionExtended?9:correction?8:vfg?7:rendering?6:globals?5:editor?4:layerSizes?3:multi?2:1);+ const bool flow=std::any_of(entries_.begin(),entries_.end(),[](const auto& e){return e.flow.has_value()||(e.contents&presetContentMask(PresetContent::Flow));});+ const int version=std::max(minimumVersion, 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)) << ' '@@ -635,6 +651,10 @@ std::string PresetLibrary::encodeEntries(const std::vector<PresetEntry>& entrieso<<' '<<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);}}+ if(version>=10){+ o<<' '<<e.flow.has_value();+ if(e.flow){const auto& f=*e.flow;o<<' '<<int(f.backend)<<' '<<int(f.quality)<<' '<<f.amdHalfResolution<<' '<<int(f.content);}+ }o << '\n';}return o.str();@@ -649,7 +669,7 @@ bool PresetLibrary::parse(const std::string& data, std::vector<PresetEntry>& outstd::string magic, quoted;int version = 0;size_t count = 0;- if (!(in >> magic >> version) || magic != "VEYRA_PRESET_LIBRARY" || version < 1 || version > 9) { error = L"预设库格式或版本不支持"; return false; }+ if (!(in >> magic >> version) || magic != "VEYRA_PRESET_LIBRARY" || version < 1 || version > 10) { error = L"预设库格式或版本不支持"; return false; }if (!(in >> std::quoted(quoted) >> count) || count > 64) { error = L"预设库条目数非法"; return false; }def = wide(quoted);for (size_t i = 0; i < count; ++i) {@@ -659,6 +679,7 @@ bool PresetLibrary::parse(const std::string& data, std::vector<PresetEntry>& outuint32_t nodeCount = 0;if (!(in >> std::quoted(name) >> std::quoted(note) >> kind >> builtin >> e.contents >> e.fg.multiplier >> fgBackend >> audioSync >> e.audioOffsetMs >> nodeCount >> chainMode >> e.chain.fgMultiplier >> strict)) { error = L"预设库头部字段损坏"; return false; }if (kind < 0 || kind > 1 || chainMode < 0 || chainMode > 1 || strict < 0 || strict > 1 ||+ (e.contents & ~(version>=10?kPresetAllContent:kPresetLegacyContent)) ||nodeCount > kMaxChainNodes || e.fg.multiplier < 1 || e.fg.multiplier > (version>=7?8u:6u)) { error = L"预设库字段超出范围"; return false; }if(version>=7&&!(in>>e.fg.vfgQuality)){error=L"预设库 VFG 质量字段损坏";return false;}if(fgBackend<0||fgBackend>(version>=7?4:3)){error=L"预设库补帧后端无效";return false;}@@ -751,6 +772,18 @@ bool PresetLibrary::parse(const std::string& data, std::vector<PresetEntry>& outif(!readRendering(in,g,version>=7))return false;e.globals=g;}}+ if(version>=10){+ int present=0;+ if(!(in>>present)||present<0||present>1){error=L"预设光流字段损坏";return false;}+ if(present){+ int backend,quality,half,content;+ if(!(in>>backend>>quality>>half>>content)||half<0||half>1){error=L"预设光流字段损坏";return false;}+ PresetFlowSettings f{OpticalFlowBackend(backend),FlowQuality(quality),half!=0,ContentRate(content)};+ EnhancementSettings contract;f.apply(contract);+ if(!contract.validate().empty()){error=L"预设光流或内容节奏无效";return false;}+ e.flow=f;+ }+ }out.push_back(std::move(e));}in >> std::ws;diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cppindex ca36c071..6995d0cc 100644--- a/src/ui/QmlPlayerBridge.cpp+++ b/src/ui/QmlPlayerBridge.cpp@@ -757,6 +757,7 @@ bool prepareStartupPreset(const engine::PresetEntry& entry, engine::ChainSession}settings.audioSync = draftSettings.audioSync;settings.audioOffsetMs = draftSettings.audioOffsetMs;+ settings.content = draftSettings.content;configuration = engine::ChainConfiguration::capture(runtime, settings);configuration.editor = std::make_shared<engine::NodeEditorDocument>(std::move(document));}@@ -1044,6 +1045,7 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesystrestoreError = tr("模式会话未被引擎接受,保留初始状态");}}+ bool defaultFlowApplied = false;if (!restoreError.isEmpty()) {veyra::log::error("ui-session", restoreError.toStdString());QTimer::singleShot(0, this, [this, restoreError] { emit notice(restoreError, true); });@@ -1070,6 +1072,12 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesystimpl_->restoreConfiguration(candidate.configurations[size_t(candidate.active)]);impl_->revalidate();impl_->options = engine::PlayerOptions::from(settings, engine::runtimeOrder(impl_->activeRuntime()));+ defaultFlowApplied = entry.flow.has_value() &&+ (entry.contents & engine::presetContentMask(engine::PresetContent::Flow));+ if (defaultFlowApplied) {+ impl_->prefs[QStringLiteral("contentRate")] = int(settings.content);+ if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "default preset content cadence not saved");+ }if (candidate != before && !impl_->facade.saveChainSession(candidate))error = tr("默认预设已应用,但会话保存失败:") + uiText(impl_->facade.error());else impl_->savedSession = candidate;@@ -1093,7 +1101,7 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesystconst int ms = p.value(QStringLiteral("audioOffsetMs")).toInt();if (ms >= -250 && ms <= 250 && s.audioOffsetMs != ms) { s.audioOffsetMs = ms; changed = true; }}- if (p.contains(QStringLiteral("contentRate"))) {+ if (!defaultFlowApplied && p.contains(QStringLiteral("contentRate"))) {const int rate = p.value(QStringLiteral("contentRate")).toInt();if (rate >= 0 && rate <= int(engine::ContentRate::Capture60To30) && int(s.content) != rate) { s.content = static_cast<engine::ContentRate>(rate); changed = true; }}@@ -5622,6 +5630,10 @@ bool QmlPlayerBridge::applyPresetIndex(int index) {}impl_->selectedNr = selectedNr;impl_->selectedColour = selectedColour;+ if (entry.flow && (entry.contents & engine::presetContentMask(engine::PresetContent::Flow))) {+ impl_->prefs[QStringLiteral("contentRate")] = int(this->settings().content);+ if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "preset content cadence not saved");+ }emit settingsChanged();emit chainChanged();return true;@@ -5683,6 +5695,7 @@ bool QmlPlayerBridge::savePresetAs(const QString& name, int contentsMask, bool nentry.fg.vfgQuality = impl_->draftGlobals.vfgQuality;entry.globals=impl_->draftGlobals;}+ entry.flow = engine::PresetFlowSettings::capture(settings());const bool ok = impl_->facade.savePreset(entry, false);if (ok) emit presetsChanged();else emit notice(tr("保存预设失败: %1").arg(uiText(impl_->facade.error())), true);@@ -5740,6 +5753,16 @@ QVariantList QmlPlayerBridge::presetSaveParts() const {add("audio", tr("声音"),s.audioOffsetMs != 0 ? tr("偏移 %1 ms").arg(s.audioOffsetMs) : tr("默认"),s.audioOffsetMs != 0);+ const QStringList flowNames{QStringLiteral("NVIDIA NVOF"), tr("AMD 光流"), QStringLiteral("GPU DIS")};+ const QStringList qualityNames{tr("性能"), tr("平衡"), tr("质量")};+ const QStringList cadenceNames{tr("采用源时间戳"), tr("自动识别内容节奏"), tr("识别 30fps 内容"),+ tr("识别 50fps 内容"), tr("识别 60fps 内容"), tr("采集 60→30(PS5 30 帧)")};+ QString flowSummary = flowNames.value(int(s.opticalFlowBackend)) + QStringLiteral(" · ") ++ qualityNames.value(int(s.flow)) + QStringLiteral(" · ") + cadenceNames.value(int(s.content));+ if (s.opticalFlowBackend == engine::OpticalFlowBackend::AmdFidelityFx && s.amdFlowHalfResolution)+ flowSummary += QStringLiteral(" · ") + tr("半分辨率");+ add("flow", tr("光流与内容节奏"), flowSummary,+ engine::PresetFlowSettings::capture(s) != engine::PresetFlowSettings{});return out;}@@ -6086,117 +6109,12 @@ void QmlPlayerBridge::setContentRate(int value) {if (int(s.content) == value) return;s.content = static_cast<engine::ContentRate>(value);if (!impl_->commit(std::move(s))) { emit notice(tr("引擎未接受内容节奏,原设置保留"), true); return; }- // A player setting, not part of either chain: kept in the shell preferences.+ // Shared cadence stays in shell preferences and can be included in presets.impl_->prefs[QStringLiteral("contentRate")] = value;if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "content cadence not saved");emit settingsChanged();}-// --- 补帧预设 -------------------------------------------------------------------// The 补帧 tab saved by name in the shell preferences (field request 2026-10-05),-// apart from the whole-chain presets. Applying one goes through the tab's own-// setters, so every value meets the same availability checks and notices as a-// click on that control would.-QVariantList QmlPlayerBridge::fgPresets() const {- QVariantList out;- const auto saved=impl_->prefs.value(QStringLiteral("fgPresets")).toList();- const auto backends=fgBackendChoices();- for(int i=0;i<saved.size();++i){- const auto entry=saved[i].toMap();- const int multiplier=entry.value(QStringLiteral("multiplier"),1).toInt();- QString backend=entry.value(QStringLiteral("backend")).toString();- for(const auto& choice:backends)- if(choice.toMap().value(QStringLiteral("id")).toString()==backend)backend=choice.toMap().value(QStringLiteral("label")).toString();- out<<QVariantMap{{"index",i},{"name",entry.value(QStringLiteral("name")).toString()},- {"note",multiplier>1?QStringLiteral("%1X · %2").arg(multiplier).arg(backend):tr("补帧关闭")}};- }- return out;-}-bool QmlPlayerBridge::saveFgPreset(const QString& name, bool replace) {- const QString trimmed=name.trimmed();- if(trimmed.isEmpty()||trimmed.size()>48){emit notice(tr("补帧预设名称需为 1–48 个字符"),true);return false;}- auto saved=impl_->prefs.value(QStringLiteral("fgPresets")).toList();- int existing=-1;- for(int i=0;i<saved.size();++i)if(saved[i].toMap().value(QStringLiteral("name")).toString()==trimmed)existing=i;- if(existing>=0&&!replace){emit notice(tr("已存在同名补帧预设"),true);return false;}- if(existing<0&&saved.size()>=32){emit notice(tr("补帧预设最多保存 32 个"),true);return false;}- const auto s=settings();- const QVariantMap entry{{"name",trimmed},{"backend",fgBackendName()},{"multiplier",fgMultiplier()},- {"vfgQuality",int(s.vfgQuality)},{"motion",int(s.fgMotion)},{"opticalFlow",int(s.opticalFlowBackend)},- {"amdHalf",s.amdFlowHalfResolution},{"flowQuality",int(s.flow)},{"contentRate",int(s.content)},- {"strict",fgStrict()},{"lowQueue",fgLowQueue()}};- if(existing>=0)saved[existing]=entry;else saved<<entry;- const auto previous=impl_->prefs;- impl_->prefs[QStringLiteral("fgPresets")]=saved;- if(!impl_->savePrefs()){impl_->prefs=previous;emit notice(tr("补帧预设保存失败"),true);return false;}- veyra::log::info("ui-fg-preset",std::format("saved name={} backend={} multiplier={} flow={} content={}",trimmed.toStdString(),- fgBackendName().toStdString(),fgMultiplier(),int(s.opticalFlowBackend),int(s.content)));- emit fgPresetsChanged();- emit notice(tr("已保存补帧预设:%1").arg(trimmed),false);- return true;-}-bool QmlPlayerBridge::applyFgPreset(int index) {- const auto saved=impl_->prefs.value(QStringLiteral("fgPresets")).toList();- if(index<0||index>=saved.size()){emit notice(tr("补帧预设不存在"),true);return false;}- const auto p=saved[index].toMap();- const QString backend=p.value(QStringLiteral("backend")).toString();- if(!backend.isEmpty()&&backend!=fgBackendName())setFgBackendName(backend);- const bool backendApplied=backend.isEmpty()||backend==fgBackendName();- if(p.contains(QStringLiteral("vfgQuality")))setVfgQuality(p.value(QStringLiteral("vfgQuality")).toInt());- // A multiplier saved for another backend only follows when that backend did.- const int multiplier=p.value(QStringLiteral("multiplier"),1).toInt();- if(backendApplied){- if(multiplier>1){if(multiplier!=fgMultiplier())setFgMultiplier(std::min(multiplier,fgMaxMultiplier()));}- else if(fgEnabled())setFgEnabled(false);- }- if(p.contains(QStringLiteral("motion"))){- const int motion=p.value(QStringLiteral("motion")).toInt();- auto s=settings();- if(motion>=0&&motion<=int(engine::MotionSource::Automatic)&&int(s.fgMotion)!=motion){- s.fgMotion=engine::MotionSource(motion);- if(impl_->commit(std::move(s)))emit settingsChanged();- }- }- if(p.contains(QStringLiteral("opticalFlow")))setOpticalFlowChoice(p.value(QStringLiteral("opticalFlow")).toInt());- if(p.contains(QStringLiteral("amdHalf")))setAmdFlowHalf(p.value(QStringLiteral("amdHalf")).toBool());- if(p.contains(QStringLiteral("flowQuality")))setFlowQuality(p.value(QStringLiteral("flowQuality")).toInt());- if(p.contains(QStringLiteral("contentRate")))setContentRate(p.value(QStringLiteral("contentRate")).toInt());- if(p.contains(QStringLiteral("strict")))setFgStrict(p.value(QStringLiteral("strict")).toBool());- if(p.contains(QStringLiteral("lowQueue")))setFgLowQueue(p.value(QStringLiteral("lowQueue")).toBool());- // A setter can reject an unavailable or invalid field while the backend- // itself succeeds. Report the resulting state, rather than claiming the- // complete preset was applied solely because its backend was accepted.- const auto applied=settings();- bool complete=backendApplied&&fgMultiplier()==multiplier;- const auto matchesInt=[&](const char* key,int actual){- const auto name=QString::fromLatin1(key);- return !p.contains(name)||p.value(name).toInt()==actual;- };- const auto matchesBool=[&](const char* key,bool actual){- const auto name=QString::fromLatin1(key);- return !p.contains(name)||p.value(name).toBool()==actual;- };- complete=complete&&matchesInt("vfgQuality",int(applied.vfgQuality))- &&matchesInt("motion",int(applied.fgMotion))&&matchesInt("opticalFlow",int(applied.opticalFlowBackend))- &&matchesInt("flowQuality",int(applied.flow))&&matchesInt("contentRate",int(applied.content))- &&matchesBool("amdHalf",applied.amdFlowHalfResolution)&&matchesBool("strict",fgStrict())&&matchesBool("lowQueue",fgLowQueue());- const QString name=p.value(QStringLiteral("name")).toString();- veyra::log::info("ui-fg-preset",std::format("applied name={} backend={} backendApplied={} complete={}",name.toStdString(),backend.toStdString(),backendApplied,complete));- if(complete)emit notice(tr("已应用补帧预设:%1").arg(name),false);- else emit notice(tr("部分补帧设置未被当前显卡或组件接受:%1").arg(name),true);- return complete;-}-bool QmlPlayerBridge::deleteFgPreset(int index) {- auto saved=impl_->prefs.value(QStringLiteral("fgPresets")).toList();- if(index<0||index>=saved.size())return false;- saved.removeAt(index);- const auto previous=impl_->prefs;- impl_->prefs[QStringLiteral("fgPresets")]=saved;- if(!impl_->savePrefs()){impl_->prefs=previous;emit notice(tr("删除补帧预设失败"),true);return false;}- emit fgPresetsChanged();- return true;-}-int QmlPlayerBridge::displaySync() const { return int(impl_->presentation.display); }bool QmlPlayerBridge::fullscreenMemorySafe() const { return !impl_->prefBool("fullscreenMemoryProtection",false)||!impl_->snapshot.vramFullscreenUnsafe; }void QmlPlayerBridge::setPresentationFullscreen(bool value) {diff --git a/tests/unit/PresetLibraryTests.cpp b/tests/unit/PresetLibraryTests.cppindex dfa3acc2..cb3e64dc 100644--- a/tests/unit/PresetLibraryTests.cpp+++ b/tests/unit/PresetLibraryTests.cpp@@ -291,7 +291,7 @@ __declspec(noinline) int testExistingPresets() {entry.audioSync = AudioSyncMode::Manual; entry.audioOffsetMs = 73;for (uint32_t i = 0; i < entry.chain.nodeCount; ++i) entry.chain.nodes[i].viewX = 800 + i * 31.0f;bool masks = true, geometry = true, unrelated = true;- for (uint32_t mask = 0; mask <= kPresetAllContent; ++mask) {+ for (uint32_t mask = 0; mask <= kPresetLegacyContent; ++mask) {entry.contents = mask; auto chain = base; auto settings = baseSettings;auto expected = settings; PresetLibrary::apply(entry, expected);const auto result = PresetLibrary::applyToChain(entry, chain, settings);@@ -341,7 +341,7 @@ __declspec(noinline) int testExistingPresets() {settings.additionalColors == baseSettings.additionalColors,"chain-only keeps every current grade even when saved topology has fewer slots");- entry.contents = kPresetAllContent; entry.kind = ChainMode::List;+ entry.contents = kPresetLegacyContent; entry.kind = ChainMode::List;chain = base; settings = baseSettings;check(!PresetLibrary::applyToChain(entry, chain, settings).accepted && chain == base && settings == baseSettings,"wrong preset mode rejects without mutation");@@ -432,7 +432,7 @@ __declspec(noinline) int testExistingPresets() {entry.name = L"全部";entry.note = L"测试";entry.kind = ChainMode::Node;- entry.contents = kPresetAllContent;+ entry.contents = kPresetLegacyContent;entry.chain = toChain(settings);entry.chain.mode = ChainMode::Node;removeLegacyNodeProtection(entry.chain);@@ -447,7 +447,7 @@ __declspec(noinline) int testExistingPresets() {const auto& loaded = library.entries().back();check(loaded.name == L"全部" && loaded.note == L"测试", "name and note survive");check(loaded.kind == ChainMode::Node && loaded.chain.mode == ChainMode::Node, "the kind survives");- check(loaded.contents == kPresetAllContent, "the content mask survives");+ check(loaded.contents == kPresetLegacyContent, "the content mask survives");check(loaded.chain.nodeCount == entry.chain.nodeCount, "the node count survives");check(loaded.chain.nodes[2].nr.model.style == 2 && loaded.chain.nodes[2].nr.temporal,"per-layer NR parameters survive");@@ -610,7 +610,7 @@ __declspec(noinline) int testExistingPresets() {auto s=sample();s.nrLayerCount=4;s.additionalColorCount=1;s.additionalColors[0].exposure=.7f;for(unsigned i=0;i<4;++i){auto& n=s.nrLayers[i];n.enabled=i!=1;n.sizePolicy=static_cast<veyra::pipeline::NrSizePolicy>(i);n.model.tone=.2f*float(i+1);}- PresetEntry entry;entry.name=L"NR四层尺寸";entry.contents=kPresetAllContent;entry.chain=toChain(s);entry.color=s.color;+ PresetEntry entry;entry.name=L"NR四层尺寸";entry.contents=kPresetLegacyContent;entry.chain=toChain(s);entry.color=s.color;PresetLibrary library(scratch(L"nr-size.v3"));check(library.load()&&library.put(entry)&&library.load(),"NR per-instance library v3 reloads");check(library.entries().back().chain==entry.chain,"v3 preserves every node including multiple grades");@@ -741,7 +741,7 @@ void testEditorPresetParts() {check(!PresetLibrary::applyToEditor(fg, *document, values).accepted && *document == *beforeBad && values == accepted,"editor preset: invalid detached FG multiplier rolls back");PresetEntry whole; whole.kind = ChainMode::Node; whole.chain = original->nodes;- --whole.chain.nodeCount; whole.contents = kPresetAllContent; whole.color = accepted.color;+ --whole.chain.nodeCount; whole.contents = kPresetLegacyContent; whole.color = accepted.color;whole.fg.multiplier = accepted.multiplier;check(PresetLibrary::applyToEditor(whole, *document, values).accepted &&document->layout.project(document->nodes, *runtime).accepted, "editor preset: full replacement accepts incomplete prior editor");@@ -794,7 +794,7 @@ __declspec(noinline) void testEditorGlobalSettings() {check(!session->valid(), "globals: XeSS draft rejects six times even while disconnected");document->nodes.fgMultiplier = 4;auto entry = std::make_unique<PresetEntry>();- entry->name = L"globals"; entry->kind = ChainMode::Node; entry->contents = kPresetAllContent;+ entry->name = L"globals"; entry->kind = ChainMode::Node; entry->contents = kPresetLegacyContent;entry->chain = c.chain; entry->nodeConfiguration = c; entry->fg = {4, FrameGenerationBackend::XeSS};const auto presetPath = scratch(L"editor-global-preset.v1");const auto presetEditor = std::filesystem::path(presetPath).concat(L".p3-editor");@@ -944,7 +944,104 @@ void testNrCorrectionStorage() {invalid.residual.correction={};invalid.residual.correction.autoAmount=-.1f;check(!invalid.validate().empty(),"NR correction: automatic amount range enforced");}+__declspec(noinline) void testFlowStorage() {+ const auto path=scratch(L"shared-flow.v1");+ const auto sidecar=std::filesystem::path(path).concat(L".flow");+ std::filesystem::remove(sidecar);+ PresetLibrary writer(path);writer.setIncludeBuiltins(false);+ PresetEntry old;old.name=L"old chain";old.chain=toChain(sample());+ check(writer.load()&&writer.put(old),"flow storage: seed original legacy library");+ const auto original=readBytes(path);+ PresetEntry entry;entry.name=L"shared flow";entry.chain=toChain(sample());+ entry.contents=presetContentMask(PresetContent::Flow);+ entry.flow=PresetFlowSettings{OpticalFlowBackend::AmdFidelityFx,FlowQuality::Quality,true,ContentRate::Capture60To30};+ check(writer.put(entry),"flow storage: save into unified preset library");+ check(readBytes(path)==original&&readBytes(sidecar).starts_with("VEYRA_PRESET_LIBRARY 10\n"),+ "flow storage: v10 sidecar preserves original library bytes");+ PresetLibrary reader(path);reader.setIncludeBuiltins(false);+ check(reader.load()&&reader.entries().size()==2&&reader.entries()[0]==old&&reader.entries()[1]==entry,+ "flow storage: legacy and shared-flow entries reload together");+ const auto exported=scratch(L"shared-flow-export.v10");+ check(reader.exportEntry(1,exported),"flow storage: export unified preset");+ std::wstring imported;+ check(reader.importFile(exported,imported)&&reader.entries().back().flow==entry.flow&&imported!=entry.name,+ "flow storage: import retains all shared fields and avoids name collision");+ const auto good=readBytes(sidecar);+ auto invalid=entry;invalid.flow->content=ContentRate(99);+ check(!reader.put(invalid,true)&&readBytes(sidecar)==good,"flow storage: invalid cadence cannot overwrite library");+ invalid=entry;invalid.flow->backend=OpticalFlowBackend(99);+ check(!reader.put(invalid,true)&&readBytes(sidecar)==good,"flow storage: invalid backend cannot overwrite library");+ invalid=entry;invalid.flow->quality=FlowQuality(99);+ check(!reader.put(invalid,true)&&readBytes(sidecar)==good,"flow storage: invalid quality cannot overwrite library");+ std::string truncated=readBytes(exported);truncated.erase(truncated.find_last_of(' '));+ {std::ofstream f(exported,std::ios::binary|std::ios::trunc);f<<truncated;}+ check(!reader.importFile(exported,imported)&&readBytes(sidecar)==good,"flow storage: truncated flow tail is rejected");+ check(reader.setDefault(1),"flow storage: default points at shared preset");+ PresetLibrary reload(path);reload.setIncludeBuiltins(false);+ check(reload.load()&&reload.defaultIndex()==1&&reload.entries()[1]==entry,"flow storage: default and fields survive fresh reader");+ for(unsigned variant=0;variant<2;++variant){+ const auto base=scratch((L"flow-migrate-"+std::to_wstring(6+variant)+L".v1").c_str());+ const auto legacyPath=std::filesystem::path(base).concat(variant?L".vfg":L".field-render");+ const auto upgraded=std::filesystem::path(legacyPath).concat(L".flow");+ std::filesystem::remove(legacyPath);std::filesystem::remove(upgraded);+ auto legacy=std::make_unique<PresetEntry>(old);legacy->globals=ChainGlobalSettings{};+ if(variant){legacy->fg={2,FrameGenerationBackend::Vfg,1};legacy->globals->fgBackend=FrameGenerationBackend::Vfg;}+ PresetLibrary prior(base);prior.setIncludeBuiltins(false);+ check(prior.load()&&prior.put(*legacy),"flow migration: create actual v6/v7 sidecar library");+ const auto originalBytes=readBytes(legacyPath);+ check(!originalBytes.empty()&&prior.put(entry)&&readBytes(legacyPath)==originalBytes,+ "flow migration: new shared snapshot preserves v6/v7 sidecar bytes");+ PresetLibrary fresh(base);fresh.setIncludeBuiltins(false);+ check(fresh.load()&&fresh.entries().size()==2&&fresh.entries()[0]==*legacy&&fresh.entries()[1]==entry,+ "flow migration: fresh base-path reader finds upgraded rendering/VFG library");+ }+}+__declspec(noinline) void testFlowApplication() {+ auto source=sample();source.flow=FlowQuality::Quality;source.opticalFlowBackend=OpticalFlowBackend::AmdFidelityFx;+ source.amdFlowHalfResolution=true;source.content=ContentRate::Capture60To30;+ PresetEntry entry;entry.name=L"shared flow";entry.chain=toChain(source);+ entry.color=source.color;entry.globals=ChainGlobalSettings::capture(source);entry.fg={4,FrameGenerationBackend::Dlss,1};+ entry.audioSync=source.audioSync;entry.audioOffsetMs=source.audioOffsetMs;entry.flow=PresetFlowSettings::capture(source);+ for(uint32_t mask=0;mask<=kPresetAllContent;++mask){+ auto target=sample();target.flow=FlowQuality::Performance;target.content=ContentRate::Fps50;+ target.opticalFlowBackend=OpticalFlowBackend::GpuDis;target.amdFlowHalfResolution=false;+ const auto before=PresetFlowSettings::capture(target);entry.contents=mask;+ auto chain=toChain(target);const auto result=PresetLibrary::applyToChain(entry,chain,target);+ check(result.accepted&&PresetFlowSettings::capture(target)==((mask&16)?*entry.flow:before),+ "flow apply: independent scope across all 32 list content masks");+ check(target.exportBitrateMbps==77&&target.captureCompatible,"flow apply: source/export preferences stay intact");+ }+ entry.contents=16;+ for(int backend=0;backend<3;++backend)for(int quality=0;quality<3;++quality)for(int cadence=0;cadence<6;++cadence){+ entry.flow=PresetFlowSettings{OpticalFlowBackend(backend),FlowQuality(quality),backend==1,ContentRate(cadence)};+ auto target=sample();auto expected=target;entry.flow->apply(expected);+ auto chain=toChain(target);const auto originalChain=chain;+ check(PresetLibrary::applyToChain(entry,chain,target).accepted&&target==expected&&chain==originalChain,+ "flow apply: every backend/quality/cadence restores without changing other settings");+ }+ entry.kind=ChainMode::Node;entry.chain.mode=ChainMode::Node;+ removeLegacyNodeProtection(entry.chain);+ entry.flow=PresetFlowSettings::capture(source);+ for(uint32_t mask=0;mask<=kPresetAllContent;++mask){+ auto target=sample();target.flow=FlowQuality::Performance;target.content=ContentRate::Fps50;+ target.opticalFlowBackend=OpticalFlowBackend::GpuDis;+ auto doc=std::make_unique<NodeEditorDocument>();doc->nodes=toChain(target);doc->nodes.mode=ChainMode::Node;+ removeLegacyNodeProtection(doc->nodes);+ check(doc->layout.initialize(doc->nodes).accepted,"flow editor: initialize stable IDs");+ doc->globals=ChainGlobalSettings::capture(target);const auto before=PresetFlowSettings::capture(target);entry.contents=mask;+ check(PresetLibrary::applyToEditor(entry,*doc,target).accepted&&+ PresetFlowSettings::capture(target)==((mask&16)?*entry.flow:before)&&+ doc->globals->flow==target.flow&&doc->globals->opticalFlowBackend==target.opticalFlowBackend,+ "flow editor: independent scope across all 32 node content masks");+ }+ entry.kind=ChainMode::List;entry.chain.mode=ChainMode::List;entry.contents=1;entry.flow.reset();+ auto legacy=sample();PresetLibrary::apply(entry,legacy);+ check(legacy.flow==source.flow&&legacy.opticalFlowBackend==source.opticalFlowBackend&&legacy.content==ContentRate::Transport,+ "flow apply: v1-v9 chain globals retain existing behavior");+}int main() {+ testFlowStorage();+ testFlowApplication();testNrCorrectionStorage();testNrVariants();testRenderingChoices();