Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++

fix: preserve cross-vendor export and synchronize automatic presentation

Veyra Goal Agentef2069f61c1a
diff --git a/AGENTS.md b/AGENTS.md
index 9e615399..7d230a48 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1,5 +1,7 @@
# Veyra 项目 Agent 执行规则
+> **2026-10-06 稳定性/导出/性能回归修复授权**:用户要求一起解决 AMD 补帧选择异常、补帧导出 DLSS 限制、NR 导出 1080p 限制、跨来源撕裂及 2.0.3→2.0.4 性能回退,确认使用当前电脑、NVIDIA 原版 NR、4K 视频输入。按 `docs/STABILITY_EXPORT_PRIORITY_PLAN_2026-10-06.md` 在 E盘 `codex/stability-export-priority-20261006` 从 main `578d63c` 隔离修复共享 graph/presenter/导出冻结与 codec/能力选择/QML及必要构建测试接点;本次具体范围覆盖历史冻结。先运行本轮 `scripts/acceptance/stability-export-priority-control.py`,独立开工基线不可修改;保留25个工作区及已发布包。不得派Agent、压力/竞争负载、修改DLL/模型/驱动/其他应用或用户配置。每个测试≤300秒,构建≤900秒,产物统一E盘。本轮交付本地可测修复包,未授权新的公开发布、贡献者消息或关机;AMD真实HIP推理、物理屏幕扫描与RTX软件测试分别报告。
+
> **2026-10-06 PR #19/#20 审查与适配授权**:用户反馈9000系NR已通过其测试,并要求检查项目PR19、PR20、判断能否合并并做好适配。按 `docs/PR19_PR20_INTEGRATION_PLAN_2026-10-06.md`,从刚交付的 `63ce396` 在 E盘 `codex/pr19-pr20-20261006` 隔离审查/适配HDR输出调优、预设/会话迁移、QML、呈现metadata生命周期、MSVC日志转换和RemotePlay条件编译及必要构建/定向测试。此具体范围覆盖历史冻结,不复活暂缓的PR13/14。验证后允许将可合并PR及已测现场修复整合main,普通推送完成GitHub PR合并状态;保留作者原始提交、其他工作树和原发布资产。不派Agent,不做压力/竞争负载、不改DLL/模型/驱动或用户配置;测试每进程≤300秒,构建≤900秒,产物统一E盘。先运行独立 `scripts/acceptance/pr19-pr20-control.py`,开工start基线禁止修改。本轮无新Release/资产上传/贡献者消息或评论/关机请求。用户RX9000反馈与本机RTX/HDR软件验证分别报告,不外推全部型号或物理HDR实测。
> **2026-10-06 OBS/导出/AMD NR 现场修复授权**:用户提交 logs(14).zip、veyra-qml(30).log 和两张截图,明确要求修复 OBS 兼容模式滚动拖影、视频导出失败及 AMD 开 NR 黑屏,并对照 lmxxf 与 A-ENTROPY 项目。仅在 E:/项目/Veyra/worktrees/obs-export-amdnr-20261006 / codex/obs-export-amdnr-20261006,从 main f8045fb 隔离实施必要启动/QML 绘制、导出冻结协议、共享 AMD NR/codec/互操作、构建和定向验收接点;按 docs/OBS_EXPORT_AMD_NR_PLAN_2026-10-06.md 执行。这些具体接点覆盖历史冻结,其他功能保持。不派 Agent、不做压力或竞争负载;测试每进程≤300秒,构建≤900秒。所有产物 E 盘,先运行 scripts/acceptance/obs-export-amdnr-control.py,独立 start 基线禁止修改。保留 main、其它工作树、用户文件/配置和已发布资产。允许本地修复及候选交付,不包含新公开发布/推送/合并或关机;不修改 proprietary DLL/模型/驱动,不用本机 RTX 测试冒充 RX9070 真推理通过。
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 02658b6b..5dfe3597 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -801,7 +801,7 @@ if(VEYRA_FFMPEG_ROOT AND EXISTS "${VEYRA_FFMPEG_ROOT}/include/libavformat/avform
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/amd-nr-graph-test")
file(WRITE "${CMAKE_BINARY_DIR}/amd-nr-graph-test/EnhanceGraph.cpp" "${_amd_nr_graph}")
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${VEYRA_AMD_NR_TEST_GRAPH_SOURCE}")
- add_executable(veyra_amd_nr_graph_tests tests/integration/LmxxfNrGraphTests.cpp "${CMAKE_BINARY_DIR}/amd-nr-graph-test/EnhanceGraph.cpp")
+ add_executable(veyra_amd_nr_graph_tests tests/integration/LmxxfNrGraphTests.cpp src/engine/EffectChain.cpp "${CMAKE_BINARY_DIR}/amd-nr-graph-test/EnhanceGraph.cpp")
target_compile_features(veyra_amd_nr_graph_tests PRIVATE cxx_std_20)
target_include_directories(veyra_amd_nr_graph_tests PRIVATE $<TARGET_PROPERTY:veyra_pipeline,INCLUDE_DIRECTORIES>)
target_compile_definitions(veyra_amd_nr_graph_tests PRIVATE $<TARGET_PROPERTY:veyra_pipeline,COMPILE_DEFINITIONS>)
diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.md
index 37a257f6..2df3f321 100644
--- a/docs/CURRENT_STATUS.md
+++ b/docs/CURRENT_STATUS.md
@@ -1,5 +1,9 @@
# 当前项目状态 / Current Status
+## 2026-10-07 2.0.4-fix2 本地修复候选
+
+隔离分支 codex/stability-export-priority-20261006 修复跨厂商 FG 入口/导出、AMD NR 视频内部1080p与原尺寸输出,Auto 明确显示同步。真实 FSR/H264/HEVC、列表预设重启、12组呈现合同、GPU像素/复用和冷启动通过;候选 EXE 21e8e89c37d36f2cc43e7c619382185459ba36f76edefd602666050d6a20285b。普通GPU档 NR约6.93ms/60fps,对照2.0.3约6.47ms,仍有约7%性能疑点,未宣称根因已解决。真实AMD离线推理/编码与用户显示撕裂待复测。完整事实与失败见 [本轮报告](STABILITY_EXPORT_PRIORITY_REPORT_2026-10-06.md),本地交付在E:/项目/Veyra/test-packages/stability-export-priority-20261006;ZIP完成以DELIVERY.json为准。未合入main/推送/公开发布,25其他工作树与既有发布文件不变。以下为历史状态。
+
## 2026-10-06 PR19/PR20 适配验收
已合入并普通推送main:功能合并 `357c136`(此前main f8045fb);PR20原历史合并2e3d239。GitHub REST核实PR19/20均closed/merged,原作者head保留为main祖先,合并Git树与实际验证树相同。v2.0.4 Release/tag/正文/资产不变。后续仅记录收尾和清理自有测试重复组件,565产品输入、生产EXE及92验收证据保持;最终main SHA见本轮logs/final-check.json。其他23原工作树原状态保留。
diff --git a/docs/STABILITY_EXPORT_PRIORITY_PLAN_2026-10-06.md b/docs/STABILITY_EXPORT_PRIORITY_PLAN_2026-10-06.md
new file mode 100644
index 00000000..2327b603
--- /dev/null
+++ b/docs/STABILITY_EXPORT_PRIORITY_PLAN_2026-10-06.md
@@ -0,0 +1,19 @@
+# 2.0.4 稳定性、跨厂商导出和性能回归修复
+
+用户本轮明确授权同时解决 AMD 补帧选择/导出失败、4K AMD NR 导出失效、跨来源撕裂和 2.0.3→2.0.4 NR 性能回退疑问。原版 NR、当前电脑、4K 视频输入、内部 1080p 单层为匹配对照。旧 UI-only 冻结不阻止本次明确授权的链路修复。
+
+起点:main `578d63c3a0143429b306e26eeb89137473b4d99f`。隔离分支 `codex/stability-export-priority-20261006`,工作树 `E:/项目/Veyra/worktrees/stability-export-priority-20261006`。保留 25 个现有工作树及其本地改动、已发布 2.0.3/2.0.4 二进制;本轮不公开发布。每次施工先运行本轮 control;不使用旧 UI-only guard 制造授权冲突。
+
+## 排查和实施
+
+1. 追溯补帧后端、倍率和组件能力选择,纠正跨厂商导出被强行替换为 DLSS 的行为。FSR 使用已有应用自有输出纹理;XeSS 若仅有交换链接口,必须明确产品边界,不能伪装为其他后端或吞掉请求。
+2. 区分片源/输出尺寸与 AMD 模型内部输入预算。保留 lmxxf 的实际模型限制,在共享处理图实现可用的内部 NR 处理和原尺寸残差合成;NVIDIA 导出仍保持既有 native 合同。冻结设置、链配置与工作进程必须一致。
+3. 对照 2.0.3/2.0.4 的呈现标志、资源租约、跨队列 fence 和缓冲复用,查出跨来源共同的同步问题;不以增大队列、偷偷丢帧、停音频或调高全局优先级遮盖问题。
+4. 原发布包、同一媒体/运行库/设置/前台状态,串行匹配测量普通 GPU 优先级下的原版 NR 单层 1080p。记录 GPU interval、CPU/提交/等待、实际优先级和驱动信息。分别辨别算法、WDDM 调度和计时口径;增加 HIGH 比较仅用于诊断,不修改其他进程或驱动设置。
+
+## 验证和交付
+
+- 每项问题先保留复现证据,再做最小闭环修复;源码可构建、相关契约测试、真实导出和真实播放通过。每次测试进程 ≤300 秒,构建 ≤900 秒,不并行争抢 GPU。
+- 输出统一位于 `E:/项目/Veyra/{archives,build,tests,logs,tmp,test-packages}/stability-export-priority-20261006`,子进程 TEMP/TMP 单独定向。无运行库/SDK/模型入 Git、无二进制修改。
+- 真实 AMD HIP 推理及实际显示扫描无可用本机证据时单独列明;不得用 RTX 或模拟 AMD 身份测试代替实卡通过。
+- 交付可测本地修复包及 WORKLOG/报告;现有 HDR、OBS 重绘、NR 画面调控与 PR19/20 适配保持。公开发布、群消息、关机不属于本次新指令。
diff --git a/docs/STABILITY_EXPORT_PRIORITY_REPORT_2026-10-06.md b/docs/STABILITY_EXPORT_PRIORITY_REPORT_2026-10-06.md
new file mode 100644
index 00000000..ba635aae
--- /dev/null
+++ b/docs/STABILITY_EXPORT_PRIORITY_REPORT_2026-10-06.md
@@ -0,0 +1,80 @@
+# 2.0.4-fix2 修复与验收记录
+
+开工 2026-10-06,记录完成 2026-10-07(Asia/Taipei)。本地候选,未合入 main、未公开发布。起点 main `578d63c3a0143429b306e26eeb89137473b4d99f`,工作树 `E:/项目/Veyra/worktrees/stability-export-priority-20261006`,分支 `codex/stability-export-priority-20261006`。包含该起点已经合入的 PR19/20 及 fix1。
+
+## 已确认的问题和修复
+
+- **补帧入口错误**:通用“添加补帧”按当前选中的 DLSS 能力判断,缺少 NVIDIA 运行库时,即使 FSR/XeSS 可用也会被禁用。原发布 AMD 包在本机 RTX5070 上真实复现这一缺组件条件:DLSS disabled、FSR/XeSS available、通用项 disabled、添加返回失败;这不是模拟 AMD 实卡。候选版通用项按所有可用后端判断,旧无效选择可以切到可用后端;AMD/Intel 新配置默认 FSR。后端各自的硬件限制保持。
+- **FSR 导出误换 DLSS**:`VideoExportJob.cpp` 强行把跨厂商补帧改成 DLSS,再用 NVIDIA-only 导出检查拒绝 AMD。`git blame` 显示替换语句来自 `6c70eb2b`(09-16),FSR 扩大匹配来自 `4fbc2b02`(10-01),都早于 2.0.3。不能把这一问题归咎于刚合的 PR19/20。现在 FSR 3.1/FSR 4 使用现有共享图的补帧纹理送编码器,保留后端和倍率,不另造播放器/导出循环。FSR 4 ML 的设备/provider 检查不被绕过。
+- **XeSS 导出边界**:当前集成的 XeSS 管理 Present,不暴露可编码补帧纹理。界面和工作进程均明确提示选择 FSR、DLSS 或 VFG,拒绝时编码帧数为 0;不再悄悄改为 DLSS。此次未实现 XeSS 视频补帧导出。
+- **AMD NR 的 4K 导出失效**:旧代码用片源尺寸判模型预算,离线 planner 又把 NR 强制 native。现在冻结全局/每层设置、固定执行计划和工作进程一致:AMD lmxxf 视频导出最高使用内部 1080p,保留原工作/输出尺寸做残差合成、编码;原生模型预算检查仍在。NVIDIA NR 导出继续 native,图片导出的原尺寸预算合同不被扩大。界面说明区分视频与图片。
+- **显示同步**:2.0.3 和发布 2.0.4 的 Auto 均走 `Present(0,0)`;没有证据证明这一标志差异导致了新旧撕裂回归。此次把 Auto 明确改为同步显示(`Present(1,0)`),窗口和无边框全屏一致;手动允许撕裂仍走 `Present(0,ALLOW_TEARING)`。原有同步时队列深度 1 的策略保留,未增大队列。新增交换链/同步切换后的实际 Present 参数日志。提交帧率受屏幕刷新率限制,不能把软件提交率称为物理显示帧率。用户现场的撕裂/运动重建瑕疵尚未直接复现。
+- **GPU 优先级**:查询到请求档位已生效时避免重复写入调度 API,保留用户既定默认实时档和手动选择。仅修改本进程,不修改驱动、全局系统设置或其他进程。此项没有经实测证明提速,不计优化收益。
+
+同步说明依据 [Microsoft Present 接口](https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiswapchain-present) 与 [NVIDIA 交换链建议](https://developer.nvidia.com/blog/advanced-api-performance-swap-chains/)。交换链模式、合成器和驱动设置会影响实际显示路径;本次测试验证 API、像素和生命周期,没有测量面板扫描或端到端延迟。
+
+## 性能疑点:不能宣称完全没有回退
+
+本机 RTX5070,驱动 616.56。同一 M2 4K60 视频,SHA256 `19482f441ee53f8ed35b2b95da343b18d2fce5764181aefb45bb4c32c46fa943`;同一 NVIDIA 原版 NR 310.8.0.0,SHA256 `e16bcf15e16e13f527491cdf7845b2fe6521a738d8f7c9c721866a8496e1fc8e`。单层内部 1080p,风格 0、模型强度 1、总变化 1,自动画面调控/抗闪烁/时域关闭,SR/FG/HDR/调色关闭,硬解自动,窗口 1280×800、声音静音。用户未给出旧测试的全部画质开关,上述是明确的控制条件。
+
+每轮普通播放 35–40 秒,串行,无竞争/压力负载。表中毫秒是**一秒 GPU 平均读数的中位数**,不是逐帧 P95,不是屏幕延迟。优先级数值来自 D3DKMT 查询。Qt active 是界面记录;外部 foregroundOwned 查询与 Qt 状态存在不一致,不能把该查询宣传成完全受控的 Windows 前台证据。显卡时钟和其他系统活动未锁定,日志检测到 NVIDIA Overlay 注入,未修改/关闭用户覆盖层。
+
+| 测量记录 | 请求 GPU 档位 | NR ms | Qt active/观察 | 提交 FPS 中位数 |
+|---|---|---:|---:|---:|
+| released203-normal | 普通 | 5.976 | 33/33 | 60 |
+| released204-normal | 普通 | 6.826 | 5/31 | 60 |
+| released203-normal-explicit | 普通,诊断中显式设置一次 | 6.475 | 27/27 | 60 |
+| released204-normal-focused | 普通 | 6.417 | 25/25 | 60 |
+| released203-normal-focused | 普通 | 6.294 | 25/25 | 60 |
+| candidate-normal-first | 普通,尚未改 Auto 的中间构建 | 6.730 | 25/26 | 60 |
+| released204-high-focused | 高 | 6.422 | 13/26 | 60 |
+| fix2-normal-final | 普通,Auto 同步 | 6.932 | 26/26 | 60 |
+| released203-bracket-final | 普通 | 6.472 | 27/27 | 60 |
+| fix2-tearing-control | 普通,允许撕裂 | 6.803 | 26/26 | 60 |
+
+第一对前台状态差异明显,不能以其约 14% 差值断言算法回退。Qt active 相同的早期对照差约 2%;末轮旧版 6.472 vs 候选 6.932 差 **7.12%**。候选同步/允许撕裂两轮相差约 **1.90%**,因此同步行为不能解释全部差异。单轮和系统状态波动不足以确定因果,但也不能抹掉约 7% 的疑点,或把调高优先级当作已经修复。新包普通档约 6.9ms、60FPS 通过;此条件下没有复现“必须高/实时才能达标”,不等于所有设置/多程序负载已恢复 2.0.3 性能。真正的剩余工作是更严格分离界面 GPU 负载、系统调度和 NR 计时,当前不宣称性能回退根因已解决。
+
+原发布包 EXE:2.0.3 `998d42617e0455523b6f39741ec82206c4685f043794a5235c2853f8c5a98154`;2.0.4 `d01329aa6d9fbd6ac2d1eee294782f4cb9d233490595ed2e3e1a9ea12c16b2d6`。最终候选 EXE `21e8e89c37d36f2cc43e7c619382185459ba36f76edefd602666050d6a20285b`。中间构建和所有失败/无效对照均保留,不挑选最佳一轮冒充固定收益。
+
+## 构建和真实验证
+
+日志根目录 `E:/项目/Veyra/logs/stability-export-priority-20261006`,测试根目录同名 `tests`,构建在 `build/.../standard`。实际运行命令以脚本参数和对应 JSON/console 收据为准;Python 为 `C:/Users/123/AppData/Local/Programs/Python/Python311/python.exe -B`。
+
+| 命令/记录 | 验证内容 | 结果 |
+|---|---|---|
+| stability-export-priority-build.py build-final-product ... | 标准配置,现有 patched FFmpeg、Qt/libass、串流依赖;最终产品 | 通过,EXE 同上 |
+| build-fg-final / build-export-test-final | 新测试最终目标 | 通过;仅测试变动,产品 EXE 不变 |
+| stability-export-priority-tests.py units-final units | 效果链 264、修复契约 246、预设 482、能力 56、呈现时序 78、i18n | 0 失败 |
+| gui-amd-before AMD before / gui-amd-after-fixed AMD catalog | 发布包真实入口错误与修复后选择、Chain+FG+Flow 列表预设 | 旧错误复现;修复通过 |
+| gui-fsr-export-second NVIDIA export | 4K60 输入 FSR2X 窗口/全屏/回窗口,真实 UI 导出 | 120 提交 FPS;720p30 的 60 源帧编码为 120 帧 |
+| gui-fsr-restore NVIDIA restore | 重启恢复 FSR、倍率、启用状态、列表预设和 Flow | 通过 |
+| fsr-no-sr-final fsr-export | 无 NR/SR 的真实 FSR→D3D12 NVENC H.264 | 60 源 +59 生成 +1 保持=120 编码,1280×720 |
+| fsr-sr-nr-first fsr-sr-nr | FSR SR→NVIDIA 原版 native NR→FSR FG→H.264 | 120 编码,2560×1440 |
+| fsr-hevc-final fsr-sr-nr-hevc | 同链 HEVC | 120 编码,2560×1440 |
+| nr-native-stack-final field-stack-hevc | 单独两层原版 NR,预览尺寸/旧汇总字段不同的冻结链 | 60 编码,native 1280×720;参数/链一致 |
+| export-timestamps.json | 四个真实导出文件全部帧解码、PTS 检查 | 120 帧,0–1.983333 秒,严格 60fps,文件时长 2 秒 |
+| xess-reject-final reject-xess | 未暴露纹理后端拒绝 | 明确 XeSS 原因,0 编码、无最终输出,不替换后端 |
+| amd-4k-final graph | 真实共享 GPU 图、恒等提供器;1/2/4 层、时域/reset,另加 4K 输出/内部 1080p | 10 例,0 失败;4K 1/2 层 RGB 最大误差 0,实际 evaluate 3/6 次 |
+| display-third display-sync | 窗口/无边框全屏×低延迟开关×Auto/Vsync/Tearing | 12 例,实际 sync/flags/像素正确,D3D12 错误 0 |
+| fg-pixels-second presentation | 实际 DLSS 4X/6X/4X、resize/reset、独立呈现队列、跳过生成帧时原帧等待、双缓冲复用 | 114/190/114 生成帧,最大 RGB 误差 0,D3D12 错误 0 |
+| stability-export-priority-cold.py cold-loader-paths | AMD/NVIDIA 两包新 profile,Windows-only PATH,实际 loader 模块路径 | 均通过;各 26 个 Qt/FFmpeg 模块来自本包 |
+
+本轮不运行仅支持旧 Win32 的 `scripts/gates/delivery.ps1`,使用实际 QML 入口和以上针对性验证。每个测试进程 ≤300 秒,构建 ≤900 秒。此表不把历史验收算作本轮通过,PR19 HDR 字段/曲线和 OBS fix1 源码未改;不据此宣称物理 HDR、采集设备或 AMD 编码已验收。
+
+## 失败记录和对抗检查
+
+- build-second:新 AMD 4K 测试块误放到引用变量声明前,C2065;调整测试块顺序后 build-third 通过。
+- display-first:测试在原生共享队列未排空时释放 presenter,导致已删除资源和 DEVICE_HUNG。正式引擎相应路径已经 drain;修正测试按正式生命周期执行。display-second 又错误把累计提交数当单例计数;改为前后差值。最终 12 例及生产 GPU 独立呈现测试无错误。原错误不当作用户故障根因。
+- gui-amd-after / gui-fsr-export:夹具先只选 Chain 但断言 FG/Flow 恢复,以及重复添加已有单例 FG;按真实选择范围 21(Chain+FG+Flow)和现有列表修正后通过。
+- fg-pixels-final:夹具传了包内不存在的旧 runtime_local/nvidia 配置路径,NGX 配置缺失;改用实际 runtime/experimental,保留错误日志,最终真实 FG 通过。
+- 首个 fsr-export 夹具用子串 sr 匹配到 fsr,实际包含 SR;该轮保留为 QHD 导出证据,修正为 -sr 匹配后新增无 SR 的成功检查,不冒充先前测试。
+- cold-stage:psutil mapped section 路径记录了先前硬链接别名,造成 NVIDIA 来源误判。使用同一自有进程 EnumProcessModulesEx/GetModuleFileNameExW 的 loader 路径复查,两包来自自身目录。未修改包/DLL 来迎合测试。
+- 增加冻结前的实例上限检查,防止 normalization 掩盖坏交易;NVIDIA native、AMD 模型预算、每层强度/风格、后端/倍率、旧持久化版本、生产不回读像素及有界队列分别复核。
+
+## 交付与未验证项
+
+完整 AMD/NVIDIA 便携包及对应应用源码:`E:/项目/Veyra/test-packages/stability-export-priority-20261006`,文件名 `Veyra-2.0.4-fix2-{AMD,NVIDIA}-win64-portable.zip` 与 `Veyra-2.0.4-fix2-source.zip`。封包收据 `DELIVERY.json` 记录最终源码提交、EXE/ZIP SHA 和逐文件校验;仅收据存在且通过才代表压缩包完成。
+
+全部沿用 fix1 已批准运行组件,AMD/NVIDIA 分别 694/215 项逐文件身份保持。patched FFmpeg 与 libass/Qt 对应依赖源继续使用已发布 2.0.4 的固定 SHA `4eccde6343d66e0511b641aaacc12b999e424738a383fcce268d762abb3dceb9`,不提交 runtime/SDK/模型到源码,不修改任何 proprietary DLL。开工封存的 25 工作树及 14 发布文件继续由本轮 control 核验,main/tag/Release 不变。
+
+**仍未验证/未完成**:真实 AMD HIP 的高分辨率离线推理与 AMD Media Foundation 编码、FSR4 ML 实卡导出、用户显示器上的实际撕裂/VRR/覆盖层、所有来源/设置下的稳定性,以及上述约 7% 性能差的确定根因。用户此前 RX9000 NR 可用反馈保留,不能扩展成此次导出已通过。请在新目录解压测试,不混装旧运行库;AMD 图片超预算与 XeSS FG 导出仍有明确限制。本地候选用于复测,当前不满足宣称所有反馈已根治或直接正式发布的条件。
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index b1ffe258..578e2023 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -8546,3 +8546,16 @@ bootstrap第一次因新checkout CRLF与实测字节不同失败,未把它算
README更新仅当前版本更新/下载/过时状态和社区支持。独立确认英文远端页头与中文页头完整保留、两QR地址/width=220保持;教程主体未重写。Discord API验证c9aREyMj8为Veyra Dlss5/常规,原两QR及Ko-fi官方按钮HTTP200,Ko-fi用户页自动访问403,保留用户给定链接,不冒充页面验证通过。公告586字符,路径releases/.../GROUP_ANNOUNCEMENT.txt。docs/PERF_RELEASE_REPORT_2.0.4_2026-10-06.md列暖创建75.83%、单NR重激活99.01%、暂停编辑89.74%、暂停PID GPU利用率99.51%、最终S4增强区间3.52%及相应限制,拒绝/撤回实验没有计入产品收益。
`py -3.11 -B scripts/package-2.0.4-dependency-source.py` v1因为vcpkg scripts含测试二进制后缀拒绝,partial ZIP保留到archives/.../dependency-source-rejected-v1.zip及SHA收据。过滤测试目录与二进制/工具档案后v2退出0,source tar目录安全/ZIP CRC/全部324载荷SHA通过,8个实际字幕上游源码归档及固定vcpkg30ef65cad9配方/补丁/元数据齐全。最终依赖ZIP598704862bytes,SHA2564eccde6343d66e0511b641aaacc12b999e424738a383fcce268d762abb3dceb9。原2.0.3依赖ZIP原字节嵌入,patched FFmpeg与全部串流/Qt源材料保持。日志logs/.../dependency-source-v2.log及dependency-source.json。
+
+
+## 2026-10-07 2.0.4 稳定性/导出/优先级本地候选
+
+用户要求同时处理 AMD 补帧入口及导出错误、NR 超过 1080p 的导出失效、跨来源撕裂和 2.0.3 性能比较,窗口与全屏都排查。隔离分支 codex/stability-export-priority-20261006,从 main 578d63c 开工;25 个既有工作树及 14 发布文件封存、control 反复通过,不派子 Agent、不运行压力/竞争负载、不公开发布。全部产物在 E:/项目/Veyra/{archives,build,tests,logs,tmp,test-packages}/stability-export-priority-20261006,TEMP/TMP 按子进程定向。
+
+修正通用 FG 能力 gate 和 AMD/Intel 新配置默认;移除强制 FSR/XeSS→DLSS 替换,FSR 用已有共享图编码纹理,XeSS 明确拒绝;AMD 视频 NR 冻结和 planner 内部最高 1080p、输出原尺寸,NVIDIA native 及旧每层参数保持。Auto 显式同步屏幕,低队列既有策略保留;新增实际 Present 换档日志。相同已生效 GPU 优先级不重复设置,不计未经证实的性能收益。
+
+实际命令、所有轮次/失败、限制见 docs/STABILITY_EXPORT_PRIORITY_REPORT_2026-10-06.md。生产 build-final-product 与最终测试目标构建通过,EXE 21e8e89c37d36f2cc43e7c619382185459ba36f76edefd602666050d6a20285b;264 效果链/246 修复契约/482 预设/56 能力/78 时序及 i18n 通过。真实 UI 复现旧 AMD 包 gate,修复后添加/FSR选择/列表预设及重启恢复通过;真实 FSR 4K60 窗口/全屏预览提交 120fps,H264/HEVC 导出 60源+59生成+1保持=120,完整解码及时间戳通过。AMD 恒等 GPU 图 10 例含4K输出/1080内部误差0;显示同步12例、DLSS4X/6X/4X像素与跨队列生命周期误差0/D3D12错误0;两包 Windows-only PATH 冷启动各26包内Qt/FFmpeg模块通过。
+
+性能普通档候选6.932ms/60fps,紧邻2.0.3为6.472ms,相差7.12%;同候选允许撕裂6.803ms,同步对照差1.90%。前台不一致的首轮14%差值作无效因果证据;不能声称没有回退或根因已修复,也未以调高优先级计成功。外部foreground查询与Qt active不一致、覆盖层/时钟未锁定,全部结果保留。AMD实卡离线推理/编码、FSR4、用户扫描撕裂和全设置稳定性未验,不据模拟/软件计数扩展支持。
+
+夹具失败保留:build-second变量声明顺序;display-first未drain即释放导致device hung、second累计计数误用;GUI预设mask/重复单例;FG运行配置路径;FSR子串匹配;cold-stage硬链接mapped路径假阴性。修正后复查,不冒充产品缺陷或抹掉原日志。完整便携候选2.0.4-fix2和源码存于本轮test-packages;最终ZIP/commit/SHA/CRC校验以DELIVERY.json为准,保护main/tag/现有发布资产。
diff --git a/i18n/catalog.json b/i18n/catalog.json
index 134004ed..55ea7213 100644
--- a/i18n/catalog.json
+++ b/i18n/catalog.json
@@ -7780,11 +7780,11 @@
"ja": "表示の同期:垂直同期"
},
{
- "zh": "显示同步:自动 · 防撕裂(不等待垂直同步)",
+ "zh": "显示同步:自动 · 与屏幕同步防撕裂",
"src": "src/engine/VideoPresenter.cpp",
- "zh-TW": "顯示同步:自動 · 防撕裂(不等待垂直同步)",
- "en": "Display sync: auto · tear-free (does not wait for VSync)",
- "ja": "表示の同期:自動 · ティアリング防止(垂直同期を待たない)"
+ "zh-TW": "顯示同步:自動 · 與螢幕同步防撕裂",
+ "en": "Display sync: auto · synchronize with the display to prevent tearing",
+ "ja": "表示の同期:自動 · 画面と同期してティアリングを防止"
},
{
"zh": "显示器",
@@ -9376,11 +9376,11 @@
"ja": "状態:%1"
},
{
- "zh": "独立于低延迟队列 · 自动:不撕裂,也不等待垂直同步",
+ "zh": "自动:与屏幕同步防撕裂 · 提交帧率受屏幕刷新率限制",
"src": "qml/ProPage.qml",
- "zh-TW": "獨立於低延遲佇列 · 自動:不撕裂,也不等待垂直同步",
- "en": "Independent of the low-latency queue · Auto: no tearing, without waiting for VSync",
- "ja": "低遅延キューとは独立 · 自動:ティアリングせず、垂直同期も待たない"
+ "zh-TW": "自動:與螢幕同步防撕裂 · 提交幀率受螢幕更新率限制",
+ "en": "Auto: synchronize with the display to prevent tearing; submitted FPS is limited by the refresh rate",
+ "ja": "自動:画面と同期してティアリングを防止 · 送信 FPS はリフレッシュレートが上限"
},
{
"zh": "生效:{}p / {} fps / {} / 请求 {} Mbps · 实收视频 {:.1f} Mbps",
@@ -13415,11 +13415,11 @@
"ja": "プレビューは縦横比を保ち、小さい入力は拡大しません。画像・動画の書き出しは完全に処理します。"
},
{
- "zh": "预览可降采样到 1080p。AMD NR 图片/视频导出仅接受预算内原生尺寸,暂不支持 4K NR 导出。",
+ "zh": "AMD NR 预览与视频导出最高按内部 1080p 处理,视频保持输出尺寸;图片导出仍需符合模型尺寸预算。",
"src": "qml/NrLayerEditor.qml",
- "zh-TW": "預覽可降採樣到 1080p。AMD NR 圖片/影片匯出僅接受預算內原生尺寸,暫不支援 4K NR 匯出。",
- "en": "Preview can downsample to 1080p. AMD NR image/video export accepts only native sizes within that budget; 4K NR export is currently unsupported.",
- "ja": "プレビューは 1080p まで縮小できます。AMD NR の画像・動画書き出しは画素数制限内のネイティブサイズのみ対応し、4K NR 書き出しは未対応です。"
+ "zh-TW": "AMD NR 預覽與影片匯出最高以內部 1080p 處理,影片保持輸出尺寸;圖片匯出仍需符合模型尺寸預算。",
+ "en": "AMD NR preview and video export use up to internal 1080p processing while keeping the video output size. Image export must still fit the model size budget.",
+ "ja": "AMD NR のプレビューと動画書き出しは内部で最大 1080p まで処理し、動画の出力サイズを維持します。画像書き出しはモデルのサイズ制限内である必要があります。"
},
{
"zh": "预览:SDR 转 HDR 已运行",
@@ -14316,6 +14316,34 @@
"zh-TW": ";預設“即時”,同時執行遊戲或其他重負載程式變慢時可改為“高”或“普通”",
"en": "; Realtime by default. If a game or other heavy program running alongside slows down, choose High or Normal",
"ja": ";既定は「リアルタイム」。同時に動かすゲームや重い処理が遅くなる場合は「高」か「通常」に変更してください"
+ },
+ {
+ "zh": "XeSS 尚未提供可编码的补帧纹理,请为导出选择 FSR、DLSS 或 VFG 补帧",
+ "src": "src/ui/QmlPlayerBridge.cpp",
+ "zh-TW": "XeSS 尚未提供可編碼的補幀紋理,請為匯出選擇 FSR、DLSS 或 VFG 補幀",
+ "en": "XeSS does not expose generated textures for encoding. Select FSR, DLSS or VFG for export.",
+ "ja": "XeSS はエンコード可能な補間テクスチャを公開していません。書き出しには FSR、DLSS または VFG を選択してください。"
+ },
+ {
+ "zh": "AMD NR 使用内部最高 1080p 处理,保留原尺寸合成与导出",
+ "src": "src/engine/VideoExportJob.cpp",
+ "zh-TW": "AMD NR 使用內部最高 1080p 處理,保留原尺寸合成與匯出",
+ "en": "AMD NR uses internal processing up to 1080p and composites and exports at the original output size.",
+ "ja": "AMD NR は内部で最大 1080p まで処理し、元の出力サイズで合成・書き出します。"
+ },
+ {
+ "zh": "当前设备不能执行所选 NR,请选择此显卡可用的 NR 运行库",
+ "src": "src/engine/VideoExportJob.cpp",
+ "zh-TW": "目前裝置無法執行所選 NR,請選擇此顯示卡可用的 NR 執行元件",
+ "en": "This device cannot run the selected NR. Select an NR runtime supported by this GPU.",
+ "ja": "このデバイスでは選択した NR を実行できません。この GPU に対応する NR ランタイムを選択してください。"
+ },
+ {
+ "zh": "当前导出设备不能执行所选补帧后端,未替换后端或降低倍率",
+ "src": "src/engine/VideoExportJob.cpp",
+ "zh-TW": "目前匯出裝置無法執行所選補幀後端,未替換後端或降低倍率",
+ "en": "The export device cannot run the selected frame-generation backend. The backend and multiplier were kept.",
+ "ja": "この書き出しデバイスでは選択した補間バックエンドを実行できません。バックエンドと倍率は保持されています。"
}
]
}
diff --git a/include/veyra/engine/EffectChain.h b/include/veyra/engine/EffectChain.h
index 64c05429..9c100839 100644
--- a/include/veyra/engine/EffectChain.h
+++ b/include/veyra/engine/EffectChain.h
@@ -164,6 +164,7 @@ struct ChainExecutionRequest {
pipeline::SrTarget srTarget = pipeline::SrTarget::Uhd4K;
bool stillImage = false;
bool exportJob = false;
+ bool amdNrExport = false; // bounded internal model input, full-size output
};
struct ChainExecutionStep {
EffectType type = EffectType::NrEnhance;
diff --git a/include/veyra/engine/ExportFeaturePolicy.h b/include/veyra/engine/ExportFeaturePolicy.h
new file mode 100644
index 00000000..f2c04e06
--- /dev/null
+++ b/include/veyra/engine/ExportFeaturePolicy.h
@@ -0,0 +1,28 @@
+#pragma once
+#include "veyra/engine/EffectChain.h"
+
+namespace veyra::engine {
+// The AMD model's admission limit belongs to its INPUT, not the source or
+// encoder output. Offline AMD NR uses the largest supported internal extent
+// and composes its residual into the original working-resolution image.
+constexpr pipeline::NrSizePolicy exportNrSizePolicy(NrRuntime runtime) {
+ return currentNrRuntime(runtime)==NrRuntime::LmxxfAmd
+ ? pipeline::NrSizePolicy::Realtime : pipeline::NrSizePolicy::Native;
+}
+inline EnhancementSettings freezeExportSettings(EnhancementSettings settings) {
+ // Preserve invalid counts for the caller's validation; normalization must
+ // not turn a corrupt settings transaction into an apparently valid one.
+ if(settings.nrLayerCount>settings.nrLayers.size()||settings.additionalColorCount>settings.additionalColors.size())return settings;
+ settings.nrPolicy=exportNrSizePolicy(settings.nrRuntime);
+ for(uint32_t i=0;i<settings.nrLayerCount&&i<settings.nrLayers.size();++i)
+ settings.nrLayers[i].sizePolicy=exportNrSizePolicy(settings.nrLayers[i].runtime);
+ const auto chain=toChain(settings);fromChain(chain,settings);
+ return settings;
+}
+// XeSS owns Present calls and exposes no encoder input texture in this
+// integration. Every other backend writes application-owned graph textures.
+constexpr bool exportFrameGenerationSupported(FrameGenerationBackend backend,bool nvidia) {
+ if(fsrFrameGeneration(backend))return true;
+ return nvidia&&(backend==FrameGenerationBackend::Dlss||backend==FrameGenerationBackend::Vfg);
+}
+}
diff --git a/include/veyra/engine/GraphDescription.h b/include/veyra/engine/GraphDescription.h
index 6946a665..28403849 100644
--- a/include/veyra/engine/GraphDescription.h
+++ b/include/veyra/engine/GraphDescription.h
@@ -1,5 +1,6 @@
#pragma once
#include "veyra/engine/EnhancementSettings.h"
+#include "veyra/engine/ExportFeaturePolicy.h"
#include "veyra/pipeline/EnhanceGraph.h"
#include "veyra/pipeline/ResolutionPlan.h"
@@ -41,7 +42,7 @@ struct StageRequest {
uint32_t fgMultiplier=2;
uint32_t width=0,height=0;
bool stillImage=false; // image preview/processing: no NR-first order
- bool exportJob=false; // offline export: native NR size, no present-sink FG, no NR-first order
+ bool exportJob=false; // native NVIDIA NR, bounded AMD NR, no present-sink FG/NR-first order
bool nvidiaAdapter=true;
bool amdNr=false; // AMD adapter: NR runs on the lmxxf runtime (no NGX)
const ChainRuntimeOrder* nodeOrder=nullptr; // paired with this settings transaction
@@ -50,13 +51,16 @@ struct StageRequest {
// Fills the stage, size and parameter fields of `desc` from `settings`.
// Source-format fields (hdrInput, rgbInput, packedInput, ...), hdrOutput and
// host hooks are left untouched: the caller owns those.
-inline pipeline::ResolutionPlan describeStages(const StageRequest& request,const EnhancementSettings& settings,
+inline pipeline::ResolutionPlan describeStages(const StageRequest& request,const EnhancementSettings& savedSettings,
pipeline::EnhanceGraphDesc& desc) {
desc.fixedExecutionPlan.reset();desc.fixedExecutionPlanError.clear();
desc.runtimeNodeOrder=request.nodeOrder!=nullptr;
- if(settings.nrLayerCount>settings.nrLayers.size()||settings.additionalColorCount>settings.additionalColors.size()){
+ if(savedSettings.nrLayerCount>savedSettings.nrLayers.size()||savedSettings.additionalColorCount>savedSettings.additionalColors.size()){
desc.fixedExecutionPlanError="too many runtime chain instances";return {};
}
+ std::optional<EnhancementSettings> exportSettings;
+ if(request.exportJob)exportSettings=freezeExportSettings(savedSettings);
+ const auto& settings=exportSettings?*exportSettings:savedSettings;
auto chain=toChain(settings);
bool lowLatency=!request.exportJob&&settings.lowLatency&&request.nr;
if(request.nodeOrder){
@@ -73,7 +77,9 @@ inline pipeline::ResolutionPlan describeStages(const StageRequest& request,const
desc.fixedExecutionPlanError="node NR-before-SR offline execution requires ordered dispatcher";return {};
}
}
- const auto policy=request.exportJob?pipeline::NrSizePolicy::Native:settings.nrPolicy;
+ const bool boundedAmd=request.exportJob&&request.amdNr&&
+ currentNrRuntime(settings.nrRuntime)==NrRuntime::LmxxfAmd;
+ const auto policy=request.exportJob?exportNrSizePolicy(settings.nrRuntime):settings.nrPolicy;
if(!pipeline::Extent{request.width,request.height}.valid()||!pipeline::validSrTarget(settings.srTarget)||
!pipeline::validNrSizePolicy(policy)){
// ResolutionPlan::make throws for these inputs. Report the same
@@ -82,7 +88,7 @@ inline pipeline::ResolutionPlan describeStages(const StageRequest& request,const
return {};
}
const auto plan=pipeline::ResolutionPlan::make({request.width,request.height},request.sr,policy,
- request.stillImage||request.exportJob,settings.revision,settings.srTarget,lowLatency);
+ (request.stillImage||request.exportJob)&&!boundedAmd,settings.revision,settings.srTarget,lowLatency);
desc.sourceWidth=request.width;desc.sourceHeight=request.height;
desc.workWidth=plan.base.width;desc.workHeight=plan.base.height;
desc.nrWidth=plan.nr.width;desc.nrHeight=plan.nr.height;
@@ -93,7 +99,9 @@ inline pipeline::ResolutionPlan describeStages(const StageRequest& request,const
desc.enableNvofStandalone=desc.enableNr;
const bool temporalMotion=settings.usesNrTemporal();
desc.enableNvofStandalone=desc.enableNr&&(motionUsesFlow(settings.nrMotion)||temporalMotion);
- desc.enableFg=request.fg&&(request.nvidiaAdapter||(!request.exportJob&&crossVendorFrameGeneration(settings.frameGenerationBackend)));
+ desc.enableFg=request.fg&&(request.exportJob
+ ? exportFrameGenerationSupported(settings.frameGenerationBackend,request.nvidiaAdapter)
+ : request.nvidiaAdapter||crossVendorFrameGeneration(settings.frameGenerationBackend));
desc.fgMultiplier=request.fgMultiplier;
desc.videoSrQuality=settings.videoSrQuality;
describeNrLayers(settings,desc);
@@ -127,7 +135,7 @@ inline pipeline::ResolutionPlan describeStages(const StageRequest& request,const
}
ChainExecutionPlan execution;
const auto validation=compileChainExecutionPlan(chain,{{request.width,request.height},settings.srTarget,
- request.stillImage,request.exportJob},execution);
+ request.stillImage,request.exportJob,boundedAmd},execution);
if(!validation.accepted){desc.fixedExecutionPlanError=validation.message;return plan;}
if(request.nodeOrder){
// Node order owns the first NR stage, even for an ordinary resize or
@@ -145,7 +153,7 @@ inline pipeline::ResolutionPlan describeStages(const StageRequest& request,const
// feature. Active NR extents now come exclusively from the compiled plan.
if(!desc.enableNr)for(const auto size:desc.nrLayersSizePolicy){
desc.nrLayersExtent.push_back(pipeline::ResolutionPlan::make({request.width,request.height},request.sr,
- request.exportJob?pipeline::NrSizePolicy::Native:size,request.stillImage||request.exportJob,
+ request.exportJob?exportNrSizePolicy(settings.nrRuntime):size,(request.stillImage||request.exportJob)&&!boundedAmd,
settings.revision,settings.srTarget,lowLatency).nr);
}
desc.fixedExecutionPlan=execution;
diff --git a/include/veyra/engine/PresentationSettings.h b/include/veyra/engine/PresentationSettings.h
index c46d1595..c3fe5aed 100644
--- a/include/veyra/engine/PresentationSettings.h
+++ b/include/veyra/engine/PresentationSettings.h
@@ -23,13 +23,12 @@ struct PresentationSettings {
bool operator==(const PresentationSettings&) const = default;
bool valid()const{return unsigned(mode)<=2&&unsigned(display)<=2&&unsigned(outputRate)<=2&&std::isfinite(customFps)&&customFps>=1.0&&customFps<=1000.0;}
};
-// Automatic never waits for vertical sync and never requests tearing: a
-// flip-model Present(0, 0) replaces the queued frame at the next refresh.
-// Tearing is only requested when the user explicitly selects it, because a
-// borderless fullscreen window is promoted to independent flip, where
-// DXGI_PRESENT_ALLOW_TEARING really tears (windowed output is composed).
+// Automatic explicitly synchronizes the final swapchain to the display in
+// both windowed and fullscreen playback. Present(0,0) relies on the negotiated
+// compositor/provider path; it must not be sold as a universal tear-free mode.
+// The explicit Tearing choice keeps the unsynchronized path available.
constexpr bool presentationVsync(const PresentationSettings& s) {
- return s.display==DisplaySync::Vsync;
+ return s.display!=DisplaySync::Tearing;
}
constexpr bool presentationTearing(const PresentationSettings& s) {
return s.display==DisplaySync::Tearing;
diff --git a/include/veyra/gfx/PresentSink.h b/include/veyra/gfx/PresentSink.h
index 33db8e1b..5061be23 100644
--- a/include/veyra/gfx/PresentSink.h
+++ b/include/veyra/gfx/PresentSink.h
@@ -155,6 +155,7 @@ private:
uint32_t height_ = 0;
uint64_t presentCount_ = 0;
uint64_t attemptedPresentCount_ = 0;
+ bool presentContractDirty_=true;
uint64_t failedPresentCount_ = 0;
uint32_t scBufferWidth_ = 0;
uint32_t scBufferHeight_ = 0;
diff --git a/qml/Veyra/NrLayerEditor.qml b/qml/Veyra/NrLayerEditor.qml
index cd3a42c4..4f0dda30 100644
--- a/qml/Veyra/NrLayerEditor.qml
+++ b/qml/Veyra/NrLayerEditor.qml
@@ -120,7 +120,7 @@ ColumnLayout {
}
Text {
Layout.fillWidth: true
- text: editor.amdNr ? qsTr("预览可降采样到 1080p。AMD NR 图片/视频导出仅接受预算内原生尺寸,暂不支持 4K NR 导出。")
+ text: editor.amdNr ? qsTr("AMD NR 预览与视频导出最高按内部 1080p 处理,视频保持输出尺寸;图片导出仍需符合模型尺寸预算。")
: qsTr("预览保留比例且不放大小输入;图片/视频导出仍完整处理。")
color: Theme.t3; font.family: Theme.fontUi; font.pixelSize: 11
wrapMode: Text.WordWrap
diff --git a/qml/Veyra/ProPage.qml b/qml/Veyra/ProPage.qml
index c84b79a5..ed720553 100644
--- a/qml/Veyra/ProPage.qml
+++ b/qml/Veyra/ProPage.qml
@@ -123,7 +123,7 @@ VPage {
spacing: 0
VRow {
label: qsTr("显示同步")
- hint: qsTr("独立于低延迟队列 · 自动:不撕裂,也不等待垂直同步")
+ hint: qsTr("自动:与屏幕同步防撕裂 · 提交帧率受屏幕刷新率限制")
VSeg {
objectName: "presentation-display-sync"
options: [{ id: "0", label: qsTr("允许撕裂") }, { id: "1", label: qsTr("垂直同步") }, { id: "2", label: qsTr("自动") }]
diff --git a/scripts/acceptance/stability-export-priority-build.py b/scripts/acceptance/stability-export-priority-build.py
new file mode 100644
index 00000000..50622860
--- /dev/null
+++ b/scripts/acceptance/stability-export-priority-build.py
@@ -0,0 +1,41 @@
+"""Build standard and RemotePlay-off configurations with approved dependencies."""
+from pathlib import Path
+import hashlib,json,os,subprocess,sys
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='stability-export-priority-20261006'
+label=sys.argv[1];assert label.replace('-','').isalnum()
+remote_off='--remote-off' in sys.argv
+BUILD=BASE/'build'/TASK/('remote-off' if remote_off else 'standard')
+TMP=BASE/'tmp'/TASK/('build-off' if remote_off else '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/stability-export-priority-control.py')]
+subprocess.run(guard,check=True)
+settings=[];cache=BASE/'build/list-preset-flow-20261006/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)')
+settings.append('set(VEYRA_DISPLAY_VERSION [[2.0.4-fix2]] CACHE STRING "Local integration" FORCE)')
+settings.append('set(VEYRA_AMD_NR_TEST_GRAPH_SOURCE [['+(ROOT/'src/pipeline/EnhanceGraph.cpp').as_posix()+']] CACHE FILEPATH "Identity diagnostic graph" FORCE)')
+if remote_off:settings.append('set(VEYRA_ENABLE_REMOTEPLAY OFF CACHE BOOL "PR20 build validation" FORCE)')
+(TMP/'dependencies.cmake').write_text('\n'.join(settings),encoding='utf8')
+targets=[t for t in sys.argv[2:] if t!='--remote-off'] or (['veyra_qml_ui'] if remote_off else [
+ 'veyra_qml_ui','veyra_hdr_tuning_tests','veyra_effect_chain_tests','veyra_preset_library_tests','veyra_ui_i18n_tests','veyra_effect_availability_tests',
+ 'veyra_export_workflow_tests','veyra_amd_nr_graph_tests','veyra_lmxxf_nr_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,'remotePlayOff':remote_off,
+ '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()[-13:]))
+subprocess.run(guard,check=True);raise SystemExit(rc)
diff --git a/scripts/acceptance/stability-export-priority-cold.py b/scripts/acceptance/stability-export-priority-cold.py
new file mode 100644
index 00000000..e3704cef
--- /dev/null
+++ b/scripts/acceptance/stability-export-priority-cold.py
@@ -0,0 +1,48 @@
+"""Cold portable starts with package-only Qt/FFmpeg and private profiles."""
+from pathlib import Path
+import os,sys,json,subprocess,time,hashlib,ctypes
+from ctypes import wintypes
+BASE=Path('E:/项目/Veyra');TASK='stability-export-priority-20261006'
+ROOT=Path(__file__).resolve().parents[2]
+label=sys.argv[1];assert label.replace('-','').isalnum()
+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/stability-export-priority-control.py')],check=True)
+results=[]
+api=ctypes.WinDLL('psapi')
+api.EnumProcessModulesEx.argtypes=[wintypes.HANDLE,ctypes.POINTER(wintypes.HMODULE),wintypes.DWORD,ctypes.POINTER(wintypes.DWORD),wintypes.DWORD]
+api.EnumProcessModulesEx.restype=wintypes.BOOL
+api.GetModuleFileNameExW.argtypes=[wintypes.HANDLE,wintypes.HMODULE,wintypes.LPWSTR,wintypes.DWORD]
+api.GetModuleFileNameExW.restype=wintypes.DWORD
+def loaded_modules(process):
+ # Read the loader's paths. Mapped section paths can retain a prior hardlink
+ # alias even though the loader selected this package's DLL correctly.
+ modules=(wintypes.HMODULE*512)();needed=wintypes.DWORD()
+ if not api.EnumProcessModulesEx(int(process._handle),modules,ctypes.sizeof(modules),ctypes.byref(needed),3):return []
+ paths=[]
+ for module in modules[:min(512,needed.value//ctypes.sizeof(wintypes.HMODULE))]:
+ name=ctypes.create_unicode_buffer(32768)
+ if api.GetModuleFileNameExW(int(process._handle),module,name,len(name)):paths.append(name.value)
+ return paths
+for vendor in ('AMD','NVIDIA'):
+ app=BASE/'test-packages'/TASK/f'Veyra-2.0.4-fix2-{vendor}-win64-portable'
+ out=BASE/'tests'/TASK/(label+'-'+vendor);tmp=BASE/'tmp'/TASK/(label+'-'+vendor)
+ for p in (out,tmp):p.mkdir(parents=True,exist_ok=False)
+ logs=BASE/'logs'/TASK;console=logs/(label+'-'+vendor+'.log')
+ env={k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_','QT_','QSG_','QML_'))}
+ env.update(TEMP=str(tmp),TMP=str(tmp),PATH=os.environ['SystemRoot']+'/System32;'+os.environ['SystemRoot'],
+ QML_DISABLE_DISK_CACHE='1',QT_FORCE_STDERR_LOGGING='1',VEYRA_LOG_FILE=str(logs/(label+'-'+vendor+'-engine.log')))
+ args=[str(app/'veyra_qml_ui.exe'),'--data-dir',str(out/'profile'),'--size','1280x800','--exit-after','5000']
+ modules=set();begin=time.monotonic()
+ with console.open('xb') as stream:
+ process=subprocess.Popen(args,cwd=app,env=env,stdout=stream,stderr=subprocess.STDOUT)
+ while process.poll() is None and time.monotonic()-begin<35:
+ modules.update(p for p in loaded_modules(process) if p.lower().endswith('.dll'))
+ time.sleep(.15)
+ if process.poll() is None:process.kill();process.wait(timeout=5);rc=124
+ else:rc=process.returncode
+ body=console.read_text(encoding='utf8',errors='replace')
+ required=[p for p in modules if Path(p).name.lower().startswith(('qt6','avcodec','avformat','avutil','swscale','swresample'))]
+ passed=rc==0 and len(required)>=12 and all(Path(p).resolve().is_relative_to(app.resolve()) for p in required) and not any(x in body for x in ('ReferenceError:','TypeError:','[ERROR]','[FATAL]','failed to load'))
+ results.append(dict(vendor=vendor,passed=passed,exit=rc,seconds=time.monotonic()-begin,exeSha256=hashlib.sha256((app/'veyra_qml_ui.exe').read_bytes()).hexdigest(),packageModules=sorted(required),privateProfile=str(out/'profile')))
+ print(vendor,'PASS' if passed else 'FAIL','modules',len(required),flush=True)
+(BASE/'logs'/TASK/(label+'.json')).write_text(json.dumps(results,ensure_ascii=False,indent=2),encoding='utf8')
+raise SystemExit(0 if all(r['passed'] for r in results) else 1)
diff --git a/scripts/acceptance/stability-export-priority-control.py b/scripts/acceptance/stability-export-priority-control.py
new file mode 100644
index 00000000..05ab473f
--- /dev/null
+++ b/scripts/acceptance/stability-export-priority-control.py
@@ -0,0 +1,33 @@
+"""Protect the immutable opening worktree/package inventory for this repair."""
+from pathlib import Path
+import hashlib,json,subprocess,sys
+ROOT=Path(__file__).resolve().parents[2]
+BASE=Path('E:/项目/Veyra');TASK='stability-export-priority-20261006'
+START=BASE/'archives'/TASK/'start.json'
+def digest(f):
+ with Path(f).open('rb') as stream:return hashlib.file_digest(stream,'sha256').hexdigest()
+assert digest(START)=='a5e44bea4c96f4125ea539aefba424efc3450fadf92c89ccff14b6e2f4a91fff'
+s=json.loads(START.read_text(encoding='utf8'))
+def git(*args,cwd=ROOT):return subprocess.check_output(['git',*args],cwd=cwd,stderr=subprocess.PIPE)
+assert ROOT.resolve()==Path(s['worktree']).resolve()
+assert git('branch','--show-current').decode().strip()==s['branch']
+assert subprocess.run(['git','merge-base','--is-ancestor',s['sourceBase'],'HEAD'],cwd=ROOT).returncode==0
+for e in s['preserved_worktrees']:
+ p=Path(e['path'])
+ assert git('rev-parse','HEAD',cwd=p).decode().strip()==e['head'],str(p)
+ assert git('status','--porcelain=v1','-z','--untracked-files=all',cwd=p).decode('utf8')==e['status'],str(p)
+ for rel,h in e['modified'].items():
+ f=p/rel;assert (digest(f) if f.is_file() else None)==h,str(f)
+allowed={'AGENTS.md','CMakeLists.txt','i18n/catalog.json','docs/WORKLOG.md','docs/CURRENT_STATUS.md',
+ 'docs/STABILITY_EXPORT_PRIORITY_PLAN_2026-10-06.md','docs/STABILITY_EXPORT_PRIORITY_REPORT_2026-10-06.md'}
+prefixes=('src/engine/','include/veyra/engine/','src/gfx/','include/veyra/gfx/',
+ 'src/pipeline/','include/veyra/pipeline/','src/sink/','include/veyra/sink/',
+ 'src/ui/QmlPlayerBridge.cpp','include/veyra/ui/QmlPlayerBridge.h','qml/Veyra/',
+ 'tests/unit/','tests/integration/','tests/qml/','scripts/acceptance/stability-export-priority-')
+changed=set(git('diff','--name-only',s['sourceBase']).decode().splitlines()+git('ls-files','--others','--exclude-standard').decode().splitlines())
+for rel in changed:
+ assert rel in allowed or rel.startswith(prefixes),f'Out of scope: {rel}'
+ assert Path(rel).suffix.lower() not in ('.dll','.lib','.exe','.hsaco','.bin','.onnx','.zip','.7z','.pdb'),rel
+if '--published' in sys.argv:
+ for e in s['published']:assert digest(e['path'])==e['sha256'],e['path']
+print('GUARD PASS',len(s['preserved_worktrees']),'preserved worktrees;',len(changed),'repair paths')
diff --git a/scripts/acceptance/stability-export-priority-package.py b/scripts/acceptance/stability-export-priority-package.py
new file mode 100644
index 00000000..6e31173f
--- /dev/null
+++ b/scripts/acceptance/stability-export-priority-package.py
@@ -0,0 +1,82 @@
+"""Make isolated local candidates, retaining every approved runtime byte."""
+from pathlib import Path
+import hashlib,json,subprocess,sys,shutil,zipfile
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='stability-export-priority-20261006';VERSION='2.0.4-fix2'
+PACK=BASE/'test-packages'/TASK;BUILD=BASE/'build'/TASK/'standard';LOG=BASE/'logs'/TASK;ARCH=BASE/'archives'/TASK
+mode=sys.argv[1];assert mode in ('stage','refresh','finalize')
+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/stability-export-priority-control.py'),'--published'],check=True)
+PACK.mkdir(parents=True,exist_ok=True)
+def sha(p):
+ with p.open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()
+def save(p,v):p.write_text(json.dumps(v,ensure_ascii=False,indent=2)+'\n',encoding='utf8')
+def git(*args):return subprocess.check_output(['git',*args],cwd=ROOT,text=True,encoding='utf8',stderr=subprocess.PIPE).strip()
+head=git('rev-parse','HEAD');dirty=bool(git('status','--porcelain'));sourcezip=PACK/f'Veyra-{VERSION}-source.zip'
+if mode=='finalize':
+ assert not dirty,'Commit the reviewed repair before the final source archive'
+ frozen=json.loads((LOG/'tested-inputs.json').read_text(encoding='utf8'))
+ assert frozen['executableSha256']==sha(BUILD/'veyra_qml_ui.exe')
+ for rel,h in frozen['productInputs'].items():assert sha(ROOT/rel)==h,rel
+ for rel,h in frozen['testReceipts'].items():assert sha(LOG/rel)==h,rel
+ files=git('ls-files').splitlines();assert not sourcezip.exists()
+ with zipfile.ZipFile(sourcezip,'x',zipfile.ZIP_DEFLATED,compresslevel=6) as z:
+ for rel in 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','.f16','.f32','.ptx')
+ z.write(ROOT/rel,arcname='Veyra-'+VERSION+'-source/'+rel)
+ with zipfile.ZipFile(sourcezip) as z:assert z.testzip() is None
+ base=json.loads((ARCH/'start.json').read_text(encoding='utf8'))['sourceBase']
+ subprocess.run(['git','bundle','create',str(ARCH/'repair-final.bundle'),base+'..HEAD'],cwd=ROOT,check=True)
+delivery=[]
+for vendor in ('AMD','NVIDIA'):
+ source=BASE/'test-packages/obs-export-amdnr-20261006'/f'Veyra-2.0.4-fix1-{vendor}-win64-portable'
+ app=PACK/f'Veyra-{VERSION}-{vendor}-win64-portable'
+ original=json.loads((source/'package-manifest.json').read_text(encoding='utf8'));immutable={}
+ if mode=='stage':assert not app.exists();app.mkdir()
+ for row in original['files']:
+ rel=row['path'];p=source/rel;assert p.resolve().is_relative_to(source.resolve()) and not p.is_symlink()
+ assert p.stat().st_size==row['size'] and sha(p)==row['sha256'],rel
+ if mode=='stage':
+ target=app/rel;target.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(p,target)
+ if rel.startswith(('runtime/','runtime_local/','models/','licenses/')) or p.suffix.lower()=='.dll' or rel in ('release-runtime-manifest.json','vfg-runtime-manifest.json'):immutable[rel]=row['sha256']
+ if mode!='finalize':
+ shutil.copy2(BUILD/'veyra_qml_ui.exe',app/'veyra_qml_ui.exe')
+ for folder in ('qml','shaders'):
+ incoming=ROOT/folder if folder=='qml' else BUILD/folder
+ for f in incoming.rglob('*'):
+ if f.is_file():
+ target=app/folder/f.relative_to(incoming);target.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(f,target)
+ for name in ('STABILITY_EXPORT_PRIORITY_PLAN_2026-10-06.md','STABILITY_EXPORT_PRIORITY_REPORT_2026-10-06.md'):
+ if (ROOT/'docs'/name).exists():shutil.copy2(ROOT/'docs'/name,app/'docs'/name)
+ (app/'REPAIR_TEST_2.0.4-fix2.md').write_text(
+ '# Veyra 2.0.4-fix2 本地修复候选\n\n'
+ '请解压到新目录测试。本包沿用已批准的运行库原字节,包含已经合入 main 的 PR19/20 和此前 fix1。尚未公开发布。\n\n'
+ '修复 AMD 通用补帧入口;FSR 视频导出保留 FSR 后端;AMD 视频导出内部最高 1080p NR、原输出尺寸合成编码;XeSS 导出明确提示改选 FSR/DLSS/VFG。\n\n'
+ '自动显示同步在窗口和全屏等待垂直同步防撕裂,提交 FPS 受显示器刷新率限制;仍可手动选择允许撕裂。GPU 优先级避免重复写入已生效档位。\n\n'
+ '实测、性能比较的控制条件和未验证项见 docs/STABILITY_EXPORT_PRIORITY_REPORT_2026-10-06.md。本机为 RTX5070,AMD 4K 合成检查使用恒等提供器,不冒充 AMD HIP/硬件编码验收。\n',encoding='utf8')
+ assert sha(app/'veyra_qml_ui.exe')==sha(BUILD/'veyra_qml_ui.exe')
+ for rel,h in immutable.items():assert sha(app/rel)==h,rel
+ actual={f.relative_to(app).as_posix():f for f in app.rglob('*') if f.is_file()}
+ assert not any(f.is_symlink() or f.suffix.lower() in ('.pdb','.lib','.addon64','.log','.dmp','.pyc','.whl') or n.startswith(('logs/','tmp/','outputs/','profile/','screenshots/','user-data-')) for n,f in actual.items())
+ manifest=dict(original);manifest.update(version=VERSION,displayVersion=VERSION,candidate=VERSION,baseCommit='578d63c3a0143429b306e26eeb89137473b4d99f',sourceCommit=head,sourceArchiveCommit=head,productCodeCommit=head,
+ worktreeDirty=dirty,localOnly=True,releaseReady=False,executableSha256=sha(app/'veyra_qml_ui.exe'),validationRecord='docs/STABILITY_EXPORT_PRIORITY_REPORT_2026-10-06.md',
+ validation='RTX5070 targeted export, presentation and settings checks; details and limitations in the validation record',
+ softwareValidation='See current validation record, not inherited fix1 test results',hardwareValidation='RTX5070; AMD 4K compositor with identity provider; real AMD inference/encoder and user panel tearing unverified',
+ files=[dict(path=n,size=f.stat().st_size,sha256=sha(f)) for n,f in sorted(actual.items()) if n!='package-manifest.json'])
+ manifest['baseReleaseTag']=manifest.pop('releaseTag',None)
+ manifest['baseReleaseUrl']=manifest.pop('releaseUrl',None)
+ if mode=='finalize':
+ manifest['correspondingSource'].update(application='../'+sourcezip.name,applicationSha256=sha(sourcezip),displayVersionOverride='-DVEYRA_DISPLAY_VERSION=2.0.4-fix2')
+ manifest['sourceZipSha256']=sha(sourcezip)
+ save(app/'package-manifest.json',manifest)
+ receipt=dict(vendor=vendor,app=str(app),sourceCommit=head,exeSha256=sha(app/'veyra_qml_ui.exe'),fileCount=len(actual),unchangedComponentCount=len(immutable))
+ if mode=='finalize':
+ archive=PACK/(app.name+'.zip');assert not archive.exists()
+ with zipfile.ZipFile(archive,'x',zipfile.ZIP_DEFLATED,compresslevel=6) as z:
+ for n,f in sorted(actual.items()):z.write(f,arcname=app.name+'/'+n)
+ with zipfile.ZipFile(archive) as z:
+ assert z.testzip() is None
+ for n,f in actual.items():assert hashlib.sha256(z.read(app.name+'/'+n)).hexdigest()==sha(f)
+ receipt.update(archive=str(archive),archiveBytes=archive.stat().st_size,archiveSha256=sha(archive),zipCrcAndAllPayloadHashesPassed=True,sourceZip=str(sourcezip),sourceZipSha256=sha(sourcezip))
+ delivery.append(receipt);print(json.dumps(receipt,ensure_ascii=False),flush=True)
+save(LOG/('packages-'+mode+'.json'),delivery)
+if mode=='finalize':save(PACK/'DELIVERY.json',delivery)
diff --git a/scripts/acceptance/stability-export-priority-perf.py b/scripts/acceptance/stability-export-priority-perf.py
new file mode 100644
index 00000000..1043dbca
--- /dev/null
+++ b/scripts/acceptance/stability-export-priority-perf.py
@@ -0,0 +1,95 @@
+"""Serial released-package A/B at identical original-NR settings; no GPU load generator."""
+from pathlib import Path
+import ctypes,hashlib,json,os,re,shutil,statistics,subprocess,sys,time
+import psutil
+from ctypes import wintypes
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='stability-export-priority-20261006'
+PACKAGES={'203':BASE/'releases/release-2.0.3-20261004/Veyra-2.0.3-NVIDIA-win64-portable',
+ '204':BASE/'releases/publish-2.0.4-20261006/packages/Veyra-2.0.4-NVIDIA-win64-portable',
+ 'fix2':BASE/'test-packages'/TASK/'Veyra-2.0.4-fix2-NVIDIA-win64-portable'}
+MEDIA=BASE/'tests/perf-matrix/media/M2.mkv'
+def sha(f):
+ with Path(f).open('rb') as s:return hashlib.file_digest(s,'sha256').hexdigest()
+def copy(src,dst):
+ if Path(src).suffix.lower() in ('.dll','.bin','.hsaco','.ptx','.onnx','.cubin','.f16'):os.link(src,dst)
+ else:shutil.copy2(src,dst)
+ return dst
+def gpu():
+ p=subprocess.run(['nvidia-smi','--query-gpu=name,driver_version,utilization.gpu,memory.used,clocks.current.graphics,power.draw','--format=csv,noheader,nounits'],capture_output=True,text=True,timeout=8)
+ return p.stdout.strip() if p.returncode==0 else 'query failed '+str(p.returncode)
+def query_priority(proc):
+ gdi=ctypes.WinDLL('gdi32');fn=gdi.D3DKMTGetProcessSchedulingPriorityClass
+ fn.argtypes=[wintypes.HANDLE,ctypes.POINTER(ctypes.c_int)];fn.restype=wintypes.LONG
+ out=ctypes.c_int(-1);status=fn(int(proc._handle),ctypes.byref(out))
+ return {'status':hex(status&0xffffffff),'actual':out.value}
+def set_priority(proc,priority):
+ gdi=ctypes.WinDLL('gdi32');fn=gdi.D3DKMTSetProcessSchedulingPriorityClass
+ fn.argtypes=[wintypes.HANDLE,ctypes.c_int];fn.restype=wintypes.LONG
+ return hex(fn(int(proc._handle),{'normal':2,'high':4,'realtime':5}[priority])&0xffffffff)
+def foreground_pid():
+ user=ctypes.WinDLL('user32');user.GetForegroundWindow.restype=wintypes.HWND
+ user.GetWindowThreadProcessId.argtypes=[wintypes.HWND,ctypes.POINTER(wintypes.DWORD)]
+ pid=wintypes.DWORD();user.GetWindowThreadProcessId(user.GetForegroundWindow(),ctypes.byref(pid));return pid.value
+def focus_owned(proc):
+ user=ctypes.WinDLL('user32');callback=ctypes.WINFUNCTYPE(wintypes.BOOL,wintypes.HWND,wintypes.LPARAM)
+ windows=[]
+ def collect(hwnd,_):
+ pid=wintypes.DWORD();user.GetWindowThreadProcessId(hwnd,ctypes.byref(pid))
+ if pid.value==proc.pid and user.IsWindowVisible(hwnd):windows.append(hwnd)
+ return True
+ user.EnumWindows(callback(collect),0)
+ if windows:user.SetForegroundWindow(windows[0])
+def run(variant,label,priority='normal',seconds=40,test_env=None,explicit=False,display=2):
+ assert label.replace('-','').isalnum() and priority in ('normal','high','realtime')
+ subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/stability-export-priority-control.py')],check=True)
+ if variant in PACKAGES:pkg=PACKAGES[variant]
+ else:pkg=BASE/'tests'/TASK/('candidate-'+variant)
+ app=BASE/'tests'/TASK/('perf-'+label)
+ assert not app.exists();shutil.copytree(pkg,app,copy_function=copy,ignore=shutil.ignore_patterns('*.log','logs','user-data-*','*.dmp','*.pdb'))
+ shutil.copy2(ROOT/'scripts/acceptance/stability-export-priority-perf.qml',app/'qml/Veyra/RegressionPerf.qml')
+ conf={'modern':variant!='203','seconds':seconds,'media':MEDIA.as_posix(),'display':display}
+ main=app/'qml/Veyra/Main.qml';text=main.read_text(encoding='utf8');at=text.rfind('}')
+ text=text[:at]+'\n Loader { source:"RegressionPerf.qml"; onLoaded:item.config='+json.dumps(conf,ensure_ascii=True)+' }\n'+text[at:];main.write_text(text,encoding='utf8')
+ out=BASE/'logs'/TASK/label;profile=BASE/'tests'/TASK/label/'profile';tmp=BASE/'tmp'/TASK/label
+ for p in (out,profile,tmp):p.mkdir(parents=True,exist_ok=False)
+ (profile/'qml-preferences.v1.json').write_text(json.dumps({'overlayCompat':'off','gpuPriority':priority,'decode':'auto'}),encoding='utf8')
+ env=os.environ.copy()
+ for key in tuple(env):
+ if key.upper().startswith(('VEYRA_','QT_QUICK_BACKEND','QSG_')):env.pop(key)
+ env.update(TEMP=str(tmp),TMP=str(tmp),QML_DISABLE_DISK_CACHE='1',QT_FORCE_STDERR_LOGGING='1',VEYRA_LOG_FILE=str(out/'player.log'),VEYRA_VERBOSE_FRAME_LOGS='1')
+ if test_env:env.update(test_env)
+ receipt={'variant':variant,'label':label,'priorityRequested':priority,'mediaSha256':sha(MEDIA),'exeSha256':sha(app/'veyra_qml_ui.exe'),'nrSha256':sha(app/'runtime/experimental/nr-original/nvngx_dlssnr.dll'),'gpuBefore':gpu(),'config':conf,'testEnv':test_env or {}}
+ t=time.monotonic();meters=[]
+ with (out/'console.log').open('xb') as stream:
+ proc=subprocess.Popen([str(app/'veyra_qml_ui.exe'),'--data-dir',str(profile),'--page','pro','--size','1280x800','--exit-after','125000'],cwd=app,env=env,stdout=stream,stderr=subprocess.STDOUT)
+ applied=False
+ try:
+ while proc.poll() is None and time.monotonic()-t<140:
+ elapsed=time.monotonic()-t
+ if 3<elapsed and foreground_pid()!=proc.pid:focus_owned(proc)
+ if explicit and not applied and elapsed>10 and query_priority(proc)['status']=='0x0':
+ receipt['explicitSetStatus']=set_priority(proc,priority);applied=True
+ meters.append({'elapsed':elapsed,'gpu':gpu(),'priority':query_priority(proc),'foregroundOwned':foreground_pid()==proc.pid})
+ time.sleep(1)
+ if proc.poll() is None:proc.kill();proc.wait(timeout=8);rc=124
+ else:rc=proc.returncode
+ finally:
+ if proc.poll() is None:proc.kill();proc.wait(timeout=8)
+ text=(out/'player.log').read_text(encoding='utf8',errors='replace');rows=[];raw=[]
+ for line in text.splitlines():
+ if 'REGRESSION_SAMPLE ' in line:
+ r=json.loads(line.split('REGRESSION_SAMPLE ',1)[1]);
+ if r['ready'] and 10<=r['position']<=48:rows.append(r)
+ if '[player-timing]' in line:raw.append(dict((k,float(v)) for k,v in re.findall(r'(\w+)=(-?\d+(?:\.\d+)?)',line)))
+ names=sorted({r['label'] for row in rows for r in row['stages'] if r['measured']})
+ summary={}
+ for name in names:
+ values=[r['ms'] for row in rows for r in row['stages'] if r['label']==name and r['measured']]
+ summary[name]={'medianOfOneSecondMeans':statistics.median(values),'min':min(values),'max':max(values),'observations':len(values)}
+ passed=rc==0 and 'REGRESSION_PASS' in text and not any(s in text for s in ('REGRESSION_FAIL','ReferenceError:','TypeError:','[ERROR]','[FATAL]')) and len(rows)>=10
+ receipt.update(exitCode=rc,wallSeconds=time.monotonic()-t,passed=passed,summary=summary,foregroundSamples=sum(r['active'] for r in rows),observations=len(rows),medianSubmitFps=statistics.median(r['fps'] for r in rows) if rows else 0)
+ for name,obj in [('result',receipt),('meters',meters),('samples',rows),('raw-timing',raw)]:
+ (out/(name+'.json')).write_text(json.dumps(obj,ensure_ascii=False,indent=2),encoding='utf8')
+ print(json.dumps(receipt,ensure_ascii=False),flush=True)
+ if not passed:print('\n'.join(text.splitlines()[-20:]));raise SystemExit(1)
+if __name__=='__main__':run(*sys.argv[1:4],seconds=int(sys.argv[4]) if len(sys.argv)>4 else 40,explicit='--explicit' in sys.argv,display=0 if '--tearing' in sys.argv else 2)
diff --git a/scripts/acceptance/stability-export-priority-perf.qml b/scripts/acceptance/stability-export-priority-perf.qml
new file mode 100644
index 00000000..7cfb1b2a
--- /dev/null
+++ b/scripts/acceptance/stability-export-priority-perf.qml
@@ -0,0 +1,31 @@
+import QtQuick
+Item {
+ id:probe
+ property var config:({})
+ property var appWindow:Window.window
+ property int ticks:0
+ property double ready:0
+ function require(v,s){if(!v)throw new Error(s)}
+ Connections {target:veyra;function onNotice(text,error){console.log("REGRESSION_NOTICE",text,error)}}
+ Timer {interval:1000;running:true;repeat:true;onTriggered:{try{
+ ++probe.ticks;probe.require(probe.ticks<125,"125s deadline")
+ if(probe.ticks===3){
+ probe.appWindow.width=1280;probe.appWindow.height=800;veyra.nodeMode=0;veyra.muted=true
+ veyra.displaySync=probe.config.display===0?0:2
+ veyra.nrEnabled=false;veyra.srEnabled=false;veyra.fgEnabled=false;veyra.videoHdr=false;veyra.colorEnabled=false;veyra.lowLatency=false
+ if(!veyra.nrLayers.length)veyra.addEffect("nr")
+ probe.require(veyra.nrLayers.length===1,"one NR layer")
+ const n=veyra.nrLayers[0].index
+ for(const p of [["runtime",3],["sizePolicy",0],["style",0],["total",1],["temporal",0],["antiFlicker",0]])
+ probe.require(veyra.setNrLayerParameter(n,p[0],p[1]),p[0])
+ if(probe.config.modern)probe.require(veyra.setNrLayerParameter(n,"correctionEnabled",0),"correction off")
+ veyra.nrEnabled=true
+ console.log("REGRESSION_CONFIG",JSON.stringify({layers:veyra.nrLayers,nr:veyra.nrEnabled,sr:veyra.srEnabled,fg:veyra.fgEnabled,lowLatency:veyra.lowLatency}))
+ veyra.openPath(probe.config.media)
+ }
+ probe.require(!veyra.failed,"engine failed")
+ if(!probe.ready&&veyra.running&&veyra.position>0&&veyra.nrActive)probe.ready=Date.now()
+ console.log("REGRESSION_SAMPLE",JSON.stringify({tick:probe.ticks,active:probe.appWindow.active,ready:probe.ready>0,position:veyra.position,fps:veyra.submitFps,nr:veyra.nrActive,stages:veyra.stageTimings,total:veyra.chainTotalMs,detail:veyra.runStatusDetail}))
+ if(probe.ready&&Date.now()-probe.ready>=probe.config.seconds*1000){console.log("REGRESSION_PASS");Qt.quit()}
+ }catch(e){console.error("REGRESSION_FAIL",e.message);Qt.exit(3)}}}
+}
diff --git a/scripts/acceptance/stability-export-priority-tests.py b/scripts/acceptance/stability-export-priority-tests.py
new file mode 100644
index 00000000..a935c0b4
--- /dev/null
+++ b/scripts/acceptance/stability-export-priority-tests.py
@@ -0,0 +1,54 @@
+"""Serial, bounded GPU checks with immutable approved runtime components."""
+from pathlib import Path
+import os,json,sys,subprocess,shutil,hashlib,time
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='stability-export-priority-20261006'
+label,case=sys.argv[1:3];assert label.replace('-','').isalnum()
+out=BASE/'tests'/TASK/label;tmp=BASE/'tmp'/TASK/label;logs=BASE/'logs'/TASK
+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/stability-export-priority-control.py')],check=True)
+out.mkdir(parents=True,exist_ok=False);tmp.mkdir(parents=True,exist_ok=False)
+app=BASE/'test-packages/obs-export-amdnr-20261006/Veyra-2.0.4-fix1-NVIDIA-win64-portable'
+build=BASE/'build'/TASK/'standard'
+for p in app.glob('*.dll'):shutil.copyfile(p,out/p.name)
+shutil.copytree(build/'shaders',out/'shaders')
+env={k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_','QT_','QSG_'))}
+env.update(TEMP=str(tmp),TMP=str(tmp),VEYRA_LOCAL_DATA_DIR=str(out/'profile'),VEYRA_LOG_FILE=str(logs/(label+'-engine.log')),VEYRA_TEST_EXPORT_DEBUG='1')
+results=[];args=[]
+if case=='units':targets=['veyra_effect_chain_tests','veyra_repair_contract_tests','veyra_preset_library_tests','veyra_ui_i18n_tests','veyra_effect_availability_tests','veyra_live_timing_tests']
+elif case=='graph':
+ targets=['veyra_amd_nr_graph_tests'];d=out/'runtime/amd-nr';d.mkdir(parents=True);(d/'assets').mkdir()
+ shutil.copyfile(build/'lmxxf-test-runtime/LmxxfNrRuntime.dll',d/'LmxxfNrRuntime.dll');(out/'runtime/nvidia').mkdir()
+elif case in ('presentation','display-sync'):
+ targets=['veyra_fg_presentation_tests'];shutil.copytree(app/'runtime',out/'runtime');shutil.copytree(app/'runtime_local',out/'runtime_local')
+ args=[str(out/'pixels'),str(out/'runtime/experimental')]
+ if case=='display-sync':args.append(case)
+else:
+ targets=['veyra_export_workflow_tests'];args=[case,str(BASE/'tests/release-2.0.4-20261005/nr-fixture.mp4'),str(out/'result.mp4')]
+ shutil.copytree(app/'runtime',out/'runtime');shutil.copytree(app/'runtime_local',out/'runtime_local')
+for target in targets:
+ exe=out/(target+'.exe');shutil.copyfile(build/exe.name,exe)
+ log=logs/(label+'-'+target+'.log');begin=time.monotonic()
+ with log.open('xb') as console:
+ try:rc=subprocess.run([str(exe),*args],cwd=out,env=env,stdout=console,stderr=subprocess.STDOUT,timeout=290).returncode
+ except subprocess.TimeoutExpired:rc=124
+ body=log.read_text(encoding='utf8',errors='replace')
+ error_lines=[line for line in body.splitlines() if 'D3D12 ERROR' in line or 'D3D12 CORRUPTION' in line]
+ passed=rc==0 and not error_lines
+ if case=='display-sync':
+ import re
+ sections=re.findall(r'DISPLAY_SYNC_BEGIN full=(\d) lowQueue=(\d) mode=(\d)(.*?)DISPLAY_SYNC_END',body,re.S)
+ passed=passed and len(sections)==12
+ for full,low,mode,section in sections:
+ calls=re.findall(r'\[present-contract\] backend=DXGI sync=(\d) flags=0x([0-9A-F]+) hr=0x([0-9A-F]+)',section)
+ passed=passed and bool(calls) and all(int(sync)==(0 if mode=='0' else 1) and int(flags,16)==(0x200 if mode=='0' else 0) and int(hr,16)==0 for sync,flags,hr in calls)
+ results.append(dict(target=target,exit=rc,passed=passed,seconds=time.monotonic()-begin,exeSHA=hashlib.sha256(exe.read_bytes()).hexdigest(),log=str(log),gpuErrors=error_lines))
+ print(target,rc,'PASS' if passed else 'FAIL',flush=True);print('\n'.join(body.splitlines()[-11:]),flush=True)
+if (out/'result.mp4').exists():
+ probe=json.loads(subprocess.check_output([shutil.which('ffprobe'),'-v','error','-count_frames','-show_streams','-of','json',str(out/'result.mp4')],timeout=30))
+ (out/'ffprobe.json').write_text(json.dumps(probe,indent=2),encoding='utf8')
+ video=next(s for s in probe['streams'] if s['codec_type']=='video')
+ assert int(video['nb_read_frames'])==(120 if case.startswith('fsr-') else {'lifecycle':20,'lifecycle-boundary':2}.get(case,60)),video
+ decoded=subprocess.run([shutil.which('ffmpeg'),'-v','error','-xerror','-i',str(out/'result.mp4'),'-map','0:v:0','-f','null','-'],capture_output=True,timeout=60)
+ assert decoded.returncode==0,decoded.stderr.decode('utf8',errors='replace')
+ results.append(dict(decodedEveryEncodedFrame=True,dimensions=[video['width'],video['height']],frames=int(video['nb_read_frames']),passed=True))
+(logs/(label+'.json')).write_text(json.dumps(results,indent=2),encoding='utf8')
+raise SystemExit(0 if all(x['passed'] for x in results) else 1)
diff --git a/scripts/acceptance/stability-export-priority-ui.py b/scripts/acceptance/stability-export-priority-ui.py
new file mode 100644
index 00000000..0ea0898b
--- /dev/null
+++ b/scripts/acceptance/stability-export-priority-ui.py
@@ -0,0 +1,40 @@
+"""Real QML bridge and isolated portable package; no fake GPU vendor."""
+from pathlib import Path
+import os,sys,json,subprocess,shutil,time,hashlib
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='stability-export-priority-20261006'
+label,vendor,case=sys.argv[1:4];assert label.replace('-','').isalnum() and vendor in ('AMD','NVIDIA')
+out=BASE/'tests'/TASK/label;tmp=BASE/'tmp'/TASK/label;logs=BASE/'logs'/TASK
+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/stability-export-priority-control.py')],check=True)
+out.mkdir(parents=True,exist_ok=False);tmp.mkdir(parents=True,exist_ok=False)
+source=BASE/'releases/publish-2.0.4-20261006/packages'/f'Veyra-2.0.4-{vendor}-win64-portable' if case=='before' else BASE/'test-packages'/TASK/f'Veyra-2.0.4-fix2-{vendor}-win64-portable'
+def copy(a,b):
+ p=Path(a)
+ if p.suffix.lower() in ('.dll','.bin','.hsaco','.onnx','.f16','.f32'):
+ try:os.link(a,b);return b
+ except OSError:pass
+ return shutil.copy2(a,b)
+app=out/'app';shutil.copytree(source,app,copy_function=copy,ignore=shutil.ignore_patterns('*.log','logs','user-data-*','*.dmp','*.pdb'))
+shutil.copy2(ROOT/'scripts/acceptance/stability-export-priority-ui.qml',app/'qml/Veyra/RepairRegression.qml')
+conf=dict(catalogOnly=case in ('before','catalog'),before=case=='before',restore=case=='restore',media=(BASE/'tests/perf-matrix/media/M2.mkv').as_posix(),exportMedia=(BASE/'tests/release-2.0.4-20261005/nr-fixture.mp4').as_posix())
+main=app/'qml/Veyra/Main.qml';text=main.read_text(encoding='utf8');at=text.rfind('}')
+main.write_text(text[:at]+'\nLoader{source:"RepairRegression.qml";onLoaded:item.config='+json.dumps(conf)+'}\n'+text[at:],encoding='utf8')
+env={k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_','QT_','QSG_'))}
+env.update(TEMP=str(tmp),TMP=str(tmp),VEYRA_LOG_FILE=str(logs/(label+'-engine.log')),QML_DISABLE_DISK_CACHE='1',QT_FORCE_STDERR_LOGGING='1')
+(out/'outputs').mkdir()
+profile=BASE/'tests'/TASK/'gui-fsr-export-second/profile' if case=='restore' else out/'profile'
+args=[str(app/'veyra_qml_ui.exe'),'--data-dir',str(profile),'--page','pro','--size','1280x800','--exit-after','250000','--export-out',str(out/'outputs')]
+console=logs/(label+'.log');begin=time.monotonic()
+with console.open('xb') as stream:
+ try:rc=subprocess.run(args,cwd=app,env=env,stdout=stream,stderr=subprocess.STDOUT,timeout=270).returncode
+ except subprocess.TimeoutExpired:rc=124
+body=console.read_text(encoding='utf8',errors='replace')
+passed=rc==0 and ('REPAIR_UI_EXPECTED_OLD' if case=='before' else 'REPAIR_UI_PASS') in body and not any(s in body for s in ('REPAIR_UI_FAIL','ReferenceError:','TypeError:'))
+receipt=dict(passed=passed,exit=rc,seconds=time.monotonic()-begin,case=case,vendorPackage=vendor,actualGpu='RTX5070; missing-NVIDIA-runtime gate reproduction is not AMD hardware validation',exeSHA=hashlib.sha256((app/'veyra_qml_ui.exe').read_bytes()).hexdigest(),config=conf)
+if case=='export':
+ files=list((out/'outputs').glob('*.mp4'));receipt['outputs']=[]
+ for f in files:
+ probe=json.loads(subprocess.check_output([shutil.which('ffprobe'),'-v','error','-count_frames','-show_streams','-of','json',str(f)],timeout=30));v=next(s for s in probe['streams'] if s['codec_type']=='video')
+ receipt['outputs'].append(dict(path=str(f),frames=int(v['nb_read_frames']),width=v['width'],height=v['height'],fps=v['r_frame_rate']))
+ passed=passed and len(files)==1 and receipt['outputs'][0]['frames']==120;receipt['passed']=passed
+(logs/(label+'.json')).write_text(json.dumps(receipt,ensure_ascii=False,indent=2),encoding='utf8')
+print(json.dumps(receipt,ensure_ascii=False));print('\n'.join(body.splitlines()[-12:]));raise SystemExit(0 if passed else 1)
diff --git a/scripts/acceptance/stability-export-priority-ui.qml b/scripts/acceptance/stability-export-priority-ui.qml
new file mode 100644
index 00000000..f79eee4f
--- /dev/null
+++ b/scripts/acceptance/stability-export-priority-ui.qml
@@ -0,0 +1,73 @@
+import QtQuick
+Item {
+ id:test
+ property var config:({})
+ property var appWindow:Window.window
+ property int ticks:0
+ property int phase:0
+ property int readyTick:0
+ property bool exportStarted:false
+ function require(v,s){if(!v)throw new Error(s)}
+ function preset(){const p=veyra.presets.find(p=>p.name==="FSR repair regression");require(p!==undefined,"saved list preset missing");require(veyra.applyPresetIndex(p.index),"apply preset refused")}
+ function saved(){console.log("REPAIR_UI_SAVED",JSON.stringify({backend:veyra.fgBackendName,multiplier:veyra.fgMultiplier,enabled:veyra.fgEnabled,flow:veyra.flowQuality,content:veyra.contentRate}));require(veyra.fgBackendName==="fsr3"&&veyra.fgMultiplier===2&&veyra.fgEnabled,"FSR saved choice");require(veyra.flowQuality===2&&veyra.contentRate===2,"shared flow saved in list preset")}
+ Connections {target:veyra;function onNotice(text,error){console.log("REPAIR_UI_NOTICE",text,error)}}
+ Timer {interval:300;running:true;repeat:true;onTriggered:{try{
+ ++test.ticks;test.require(test.ticks<800,"240s deadline phase="+test.phase)
+ if(test.phase===0){
+ if(test.ticks<10)return
+ if(test.config.restore){
+ test.saved();veyra.flowQuality=0;veyra.contentRate=0;veyra.fgEnabled=false
+ test.preset();test.saved();console.log("REPAIR_UI_PASS");Qt.quit();return
+ }
+ veyra.nodeMode=0;veyra.muted=true;veyra.nrEnabled=false;veyra.srEnabled=false;veyra.fgEnabled=false
+ console.log("REPAIR_UI_CATALOG",JSON.stringify(veyra.fgBackendChoices),JSON.stringify(veyra.effectCatalog))
+ const generic=veyra.effectCatalog.find(p=>p.id==="frame-generation")
+ const dlss=veyra.fgBackendChoices.find(p=>p.id==="dlss")
+ const fsr=veyra.fgBackendChoices.find(p=>p.id==="fsr3")
+ test.require(generic!==undefined&&fsr!==undefined&&!fsr.disabled,"FSR component available")
+ if(test.config.catalogOnly){
+ test.require(dlss.disabled,"missing NVIDIA runtime is required to reproduce old generic-entry gate")
+ const added=veyra.addEffect("frame-generation")
+ if(test.config.before){test.require(generic.disabled&&added<0,"old gate did not reproduce");console.log("REPAIR_UI_EXPECTED_OLD");Qt.quit();return}
+ test.require(!generic.disabled&&added>=0,"generic FG entry must use any available provider")
+ }else{
+ // The fresh NVIDIA list already contains its disabled FG stage.
+ // The missing-runtime package above exercises adding the absent stage.
+ veyra.fgBackendName="dlss";veyra.fgMultiplier=6
+ }
+ veyra.fgBackendName="fsr3";veyra.fgMultiplier=2;veyra.fgEnabled=true
+ veyra.flowQuality=2;veyra.contentRate=2;veyra.fgMotionSource=0
+ test.saved();test.require(veyra.savePresetAs("FSR repair regression",21,false),"save list Chain+FG+Flow preset")
+ veyra.flowQuality=0;veyra.contentRate=0;veyra.fgEnabled=false
+ test.preset();test.saved()
+ if(test.config.catalogOnly){console.log("REPAIR_UI_PASS");Qt.quit();return}
+ veyra.displaySync=2;veyra.outputRateMode=0
+ veyra.openPath(test.config.media);test.phase=1
+ }else if(test.phase===1){
+ test.require(!veyra.failed,"FSR preview failed "+veyra.runStatus)
+ if(!veyra.running||veyra.position<2)return
+ test.require(veyra.fgBackendName==="fsr3"&&veyra.fgEnabled,"live FSR selection rolled back")
+ if(!test.readyTick)test.readyTick=test.ticks
+ console.log("REPAIR_UI_SAMPLE",JSON.stringify({position:veyra.position,fps:veyra.submitFps,backend:veyra.fgBackendName,status:veyra.presentationStatus,detail:veyra.runStatusDetail}))
+ if(test.ticks-test.readyTick<12)return
+ test.appWindow.showFullScreen();test.phase=2;test.readyTick=test.ticks
+ }else if(test.phase===2){
+ test.require(!veyra.failed,"fullscreen preview failed")
+ if(test.ticks-test.readyTick<12)return
+ test.appWindow.showNormal();test.phase=3;test.readyTick=test.ticks
+ }else if(test.phase===3){
+ if(test.ticks-test.readyTick<8)return
+ veyra.exportCompletionSound=false;veyra.exportHevc=false;veyra.exportRateControl=1
+ veyra.addExportFiles([test.config.exportMedia]);test.phase=4
+ }else if(test.phase===4){
+ if(veyra.exportReadyCount<1)return
+ veyra.startExport();test.require(veyra.exportRunning,"FSR GUI export rejected")
+ test.exportStarted=true;test.phase=5
+ }else if(test.phase===5){
+ if(veyra.exportRunning)return
+ test.require(veyra.exportItems.some(p=>p.state==="done"),"FSR GUI export failed "+JSON.stringify(veyra.exportItems))
+ console.log("REPAIR_UI_EXPORT",JSON.stringify(veyra.exportItems));test.saved()
+ console.log("REPAIR_UI_PASS");Qt.quit()
+ }
+ }catch(e){console.error("REPAIR_UI_FAIL",test.phase,e.message);Qt.exit(3)}}}
+}
diff --git a/src/engine/EffectChain.cpp b/src/engine/EffectChain.cpp
index efb17242..784baf9c 100644
--- a/src/engine/EffectChain.cpp
+++ b/src/engine/EffectChain.cpp
@@ -479,9 +479,12 @@ ChainValidation compileChainExecutionPlan(const EffectChain& chain, const ChainE
step.input = step.processing = step.output = cursor;
if (node.type == EffectType::SuperResolution) step.processing = step.output = srExtent;
if (node.type == EffectType::NrEnhance) {
- const auto policy = request.exportJob ? pipeline::NrSizePolicy::Native : node.nr.sizePolicy;
+ const bool boundedAmd=request.exportJob&&request.amdNrExport&&
+ currentNrRuntime(node.nr.runtime)==NrRuntime::LmxxfAmd;
+ const auto policy = boundedAmd?pipeline::NrSizePolicy::Realtime:
+ request.exportJob ? pipeline::NrSizePolicy::Native : node.nr.sizePolicy;
step.processing = pipeline::ResolutionPlan::make(cursor, false, policy,
- request.stillImage || request.exportJob, 0, request.srTarget).nr;
+ (request.stillImage || request.exportJob)&&!boundedAmd, 0, request.srTarget).nr;
}
plan.steps[plan.stepCount++] = step;
cursor = step.output;
diff --git a/src/engine/ExportJobManager.cpp b/src/engine/ExportJobManager.cpp
index 9d8039d5..1b3e6dee 100644
--- a/src/engine/ExportJobManager.cpp
+++ b/src/engine/ExportJobManager.cpp
@@ -1,4 +1,5 @@
#include "veyra/engine/ExportJobManager.h"
+#include "veyra/engine/ExportFeaturePolicy.h"
#include "veyra/engine/EffectChain.h"
#include "veyra/engine/VideoExportJob.h"
#include "veyra/engine/ExportStreams.h"
@@ -135,12 +136,9 @@ bool ExportJobManager::start(const std::wstring& input,const std::wstring& outpu
if(!p_->mapping)return fail(L"无法创建导出通信资源");
p_->shared=static_cast<Shared*>(MapViewOfFile(p_->mapping,FILE_MAP_ALL_ACCESS,0,0,sizeof(Shared)));if(!p_->shared)return fail(L"无法映射导出通信资源");
if(!std::isfinite(trimStartSeconds)||!std::isfinite(trimEndSeconds)||trimStartSeconds<0||trimEndSeconds<0||(trimEndSeconds>0&&trimEndSeconds<=trimStartSeconds))return fail(L"导出剪辑范围无效");
- new(p_->shared) Shared{};auto& s=*p_->shared;s.settings=settings;
- // Export executes every NR at native resolution. The list UI keeps explicit
- // layers even for a single NR, and its legacy summary may be stale. Freeze
- // both representations from the same native chain before crossing processes.
- s.settings.nrPolicy=pipeline::NrSizePolicy::Native;
- for(uint32_t i=0;i<s.settings.nrLayerCount;++i)s.settings.nrLayers[i].sizePolicy=pipeline::NrSizePolicy::Native;
+ new(p_->shared) Shared{};auto& s=*p_->shared;s.settings=freezeExportSettings(settings);
+ // Normalize once before crossing processes. Source/encoder size is unchanged;
+ // only the lmxxf model input has its real 1080p budget.
s.chain=toChain(s.settings);fromChain(s.chain,s.settings);
s.hevc=hevc;s.maxFrames=maxFrames;s.rateControl=uint32_t(rateControl);
s.audioStreamIndex=audioStreamIndex;
@@ -167,7 +165,7 @@ bool ExportJobManager::start(const std::wstring& input,const std::wstring& outpu
p_->snapshot.state=ExportState::Preparing;p_->snapshot.output=output;p_->snapshot.jobId=(GetTickCount64()<<16)^pi.dwProcessId;p_->snapshot.frozenRevision=settings.revision;p_->snapshot.frozen=s.settings;p_->startTick=GetTickCount64();p_->pausedAt=p_->pausedTotal=0;
p_->snapshot.workerPid=pi.dwProcessId;
p_->snapshot.workerLog=std::filesystem::absolute(runtime::logsDirectory()/std::format("export-worker-{}.log",pi.dwProcessId)).wstring();
- log::info("export-worker",std::format("started jobId={} pid={} frozenRevision={} nativeNR=true independentPlayback=true log={}",p_->snapshot.jobId,pi.dwProcessId,settings.revision,std::filesystem::path(p_->snapshot.workerLog).string()));return true;
+ log::info("export-worker",std::format("started jobId={} pid={} frozenRevision={} nrRuntime={} nrPolicy={} backend={} independentPlayback=true log={}",p_->snapshot.jobId,pi.dwProcessId,settings.revision,nrRuntimeName(s.settings.nrRuntime),int(s.settings.nrPolicy),frameGenerationBackendName(s.settings.frameGenerationBackend),std::filesystem::path(p_->snapshot.workerLog).string()));return true;
}
bool ExportJobManager::enqueue(const std::wstring& input,const std::wstring& output,EnhancementSettings settings,bool hevc,unsigned maxFrames,int audioStreamIndex,double trimStartSeconds,double trimEndSeconds,sink::ExportRateControl rateControl){
if(poll().active()||!p_->queue.empty()){p_->queue.push_back({input,output,settings,hevc,maxFrames,audioStreamIndex,trimStartSeconds,trimEndSeconds,rateControl});return true;}
@@ -277,7 +275,7 @@ int runExportWorker(HANDLE mapping){
// Re-deriving one from the other must agree, otherwise the job is refused.
{auto fromChainSettings=s->settings;fromChain(s->chain,fromChainSettings);
if(fromChainSettings!=s->settings)return reject(L"导出任务的效果链与冻结参数不一致");}
- const auto settings=s->settings;log::info("export-frozen",std::format("revision={} nr={} sr={} multiplier={} intensity={} tone={} structure={} skin={} style={} autoMask={} ui={} total={} darken={} brighten={} color={} luminance={} flow={} content={} nativeNR=true",settings.revision,settings.nr,settings.sr,settings.multiplier,settings.model.intensity,settings.model.tone,settings.model.structure,settings.model.skin,settings.model.style,settings.model.autoMask,settings.model.uiCorrection,settings.residual.total,settings.residual.darken,settings.residual.brighten,settings.residual.color,settings.residual.luminance,int(settings.flow),int(settings.content)));std::atomic<bool> cancel=false,done=false;
+ const auto settings=s->settings;log::info("export-frozen",std::format("revision={} nr={} sr={} multiplier={} intensity={} tone={} structure={} skin={} style={} autoMask={} ui={} total={} darken={} brighten={} color={} luminance={} flow={} content={} nrRuntime={} nrPolicy={} backend={}",settings.revision,settings.nr,settings.sr,settings.multiplier,settings.model.intensity,settings.model.tone,settings.model.structure,settings.model.skin,settings.model.style,settings.model.autoMask,settings.model.uiCorrection,settings.residual.total,settings.residual.darken,settings.residual.brighten,settings.residual.color,settings.residual.luminance,int(settings.flow),int(settings.content),int(settings.nrRuntime),int(settings.nrPolicy),frameGenerationBackendName(settings.frameGenerationBackend)));std::atomic<bool> cancel=false,done=false;
std::thread monitor([&]{while(!done){if(InterlockedCompareExchange(&s->cancel,0,0))cancel=true;std::this_thread::sleep_for(std::chrono::milliseconds(10));}});
auto frameBoundary=[&]{
while(!cancel&&InterlockedCompareExchange(&s->pause,0,0)){InterlockedExchange(&s->state,LONG(ExportState::Paused));std::this_thread::sleep_for(std::chrono::milliseconds(20));}
diff --git a/src/engine/VideoExportJob.cpp b/src/engine/VideoExportJob.cpp
index 7c567ec8..3944a0c8 100644
--- a/src/engine/VideoExportJob.cpp
+++ b/src/engine/VideoExportJob.cpp
@@ -32,16 +32,10 @@ bool exportVideo(const std::wstring& input,const std::wstring& output,PlayerOpti
if(!std::isfinite(options.exportStartSeconds)||!std::isfinite(options.exportEndSeconds)||options.exportStartSeconds<0||options.exportEndSeconds<0||(options.exportEndSeconds>0&&options.exportEndSeconds<=options.exportStartSeconds)){progress(0,L"导出剪辑范围无效");return false;}
if(std::filesystem::exists(output)){progress(0,L"目标文件已存在,请使用其他名称");return false;}
if(cancel){progress(0,L"导出已取消");return false;}
- // XeSS still has no exposed output texture. FSR preview now does, but
- // FSR encoder/HDR/cadence acceptance remains a separate task. Preserve the
- // established, explicit DLSS substitution for this release candidate.
std::wstring fgNote;
- if(options.fg&&crossVendorFrameGeneration(options.settings.frameGenerationBackend)){
- const auto requested=options.settings.frameGenerationBackend;
- fgNote=std::format(L"{} 补帧导出尚未验收;本次导出改用 DLSS 补帧 {}X",
- requested==FrameGenerationBackend::XeSS?L"XeSS":requested==FrameGenerationBackend::Fsr4?L"FSR 4":L"FSR 3.1",options.fgMultiplier);
- veyra::log::warn("export",std::format("requested preview backend is not admitted for export requested={} multiplier={}; substituting the in-graph DLSS path",frameGenerationBackendName(requested),options.fgMultiplier));
- options.settings.frameGenerationBackend=FrameGenerationBackend::Dlss;
+ if(options.fg&&presentSinkFrameGeneration(options.settings.frameGenerationBackend)){
+ progress(0,L"XeSS 尚未提供可编码的补帧纹理,请为导出选择 FSR、DLSS 或 VFG 补帧");
+ return false;
}
gfx::D3D12DeviceContext ctx;gfx::CommandSlotRing ring;source::MediaFileSource source;pipeline::EnhanceGraph graph(ctx,ring);
struct CompletionEvent {HANDLE value=nullptr;~CompletionEvent(){if(value)CloseHandle(value);}} completionEvent;
@@ -68,7 +62,7 @@ bool exportVideo(const std::wstring& input,const std::wstring& output,PlayerOpti
// hardware encoder. Features that need NGX/NVOF stay NVIDIA-only and
// are gated below instead of failing the job.
const bool nvidiaAdapter=ctx.adapter().isNvidia;
- if(!nvidiaAdapter)veyra::log::info("export",std::format("adapter={} vendor={}; DLSS NR/SR/FG and NVOF are unavailable, encoder falls back to the system Media Foundation hardware MFT",utf8(ctx.adapter().description),ctx.adapter().vendorIdHex));
+ if(!nvidiaAdapter)veyra::log::info("export",std::format("adapter={} vendor={}; selected AMD NR/FSR runtimes are checked independently of NVIDIA features; encoder uses the system Media Foundation hardware MFT",utf8(ctx.adapter().description),ctx.adapter().vendorIdHex));
source::SourceOpenDesc od;od.path=input;od.preferHardwareDecode=false;if(!source.open(od)){failureReason=source.errorMessage();break;}
auto info=source.info();if(!pipeline::Extent{info.width,info.height}.valid()){progress(0,L"输入尺寸超出GPU单纹理能力");break;}
// The first decoded frame is authoritative when container headers omit
@@ -102,24 +96,23 @@ bool exportVideo(const std::wstring& input,const std::wstring& output,PlayerOpti
gd.captureBitDepth=info.color.pixelFormat==pipeline::SourcePixelFormat::P010?10:info.color.pixelFormat==pipeline::SourcePixelFormat::P016?16:8;
// Adapter gate mirrors the preview rules (EngineController): DLSS NR,
// DLSS SR and the NVOF guidance need an NVIDIA device; AMD FSR
- // upscaling is the only vendor-neutral video SR we ship. Requesting an
- // unavailable feature must degrade the export, never fail it.
+ // upscaling is the vendor-neutral video SR. NR/FG requests must keep
+ // their selected backend and fail clearly when that backend is unavailable.
const bool nvidiaFeatures=nvidiaAdapter;
- // AMD adapters run NR on the lmxxf runtime. Export keeps native size,
- // and that runtime only admits <=1920x1080 pixels (height <=1080).
const bool amdAdapter=ctx.adapter().vendorId==0x1002;
- const bool amdNrExport=amdAdapter&&info.width<=2560&&info.height<=1080&&uint64_t(info.width)*info.height<=1920ull*1080ull;
+ const bool amdNrExport=amdAdapter&&currentNrRuntime(options.settings.nrRuntime)==NrRuntime::LmxxfAmd;
+ if(options.nr&&!nvidiaFeatures&&!amdNrExport){failureReason=L"当前设备不能执行所选 NR,请选择此显卡可用的 NR 运行库";break;}
// One description for the whole job: the stage rules (which SR runs,
// whether NR/FG are available) come from the same place the preview uses.
StageRequest stages;stages.nr=options.nr;stages.sr=options.sr;stages.fg=options.fg;stages.fgMultiplier=options.fgMultiplier;
stages.width=info.width;stages.height=info.height;stages.exportJob=true;stages.nvidiaAdapter=nvidiaAdapter;stages.amdNr=amdNrExport;
const auto plan=describeStages(stages,options.snapshot(),gd);
- if(amdNrExport&&gd.enableNr&&gd.opticalFlowBackend==OpticalFlowBackend::Nvidia)gd.opticalFlowBackend=OpticalFlowBackend::AmdFidelityFx;
+ if(!nvidiaFeatures&&gd.opticalFlowBackend==OpticalFlowBackend::Nvidia)gd.opticalFlowBackend=OpticalFlowBackend::AmdFidelityFx;
const auto resolution=plan;
const bool srAvailable=plan.srApplied&&(nvidiaFeatures||options.settings.videoSrQuality==kVideoSrFsr);
- if(options.nr&&!nvidiaFeatures&&!amdNrExport){
- const wchar_t* note=amdAdapter?L"AMD NR 导出只支持 1080p 以内的片源,本次导出关闭 NR":L"当前显卡不能使用 DLSS NR,本次导出自动关闭 NR";
- fgNote+=fgNote.empty()?std::wstring(note):std::wstring(L";")+note;
+ if(options.nr&&amdNrExport){
+ fgNote=L"AMD NR 使用内部最高 1080p 处理,保留原尺寸合成与导出";
+ veyra::log::info("export-nr",std::format("runtime=lmxxf source={}x{} output={}x{} internal={}x{} layers={}",info.width,info.height,gd.workWidth,gd.workHeight,gd.nrWidth,gd.nrHeight,gd.nrLayersExtent.size()));
}
if(options.sr&&!srAvailable)fgNote+=fgNote.empty()?L"当前显卡不能使用所选超分,本次导出关闭超分":L";当前显卡不能使用所选超分,本次导出关闭超分";
if(!nvidiaFeatures&&srAvailable)fgNote+=fgNote.empty()?L"本次导出使用 AMD FSR 超分":L";本次导出使用 AMD FSR 超分";
@@ -139,11 +132,13 @@ bool exportVideo(const std::wstring& input,const std::wstring& output,PlayerOpti
fgFailure=graph.failedBackend()==FailedBackend::Fg;
graph.shutdown();
};
- if(options.fg&&!nvidiaFeatures){failureReason=L"当前导出设备不能执行所请求的 DLSS 补帧,未降低倍率";break;}
+ if(options.fg&&!exportFrameGenerationSupported(options.settings.frameGenerationBackend,nvidiaFeatures)){
+ failureReason=L"当前导出设备不能执行所选补帧后端,未替换后端或降低倍率";break;
+ }
if(options.fg){
startGraph(true,options.fgMultiplier);
if(!graphReady&&fgFailure){
- failureReason=std::format(L"DLSS {}X 补帧初始化失败,未降低倍率;请查看任务诊断日志",options.fgMultiplier);
+ failureReason=std::format(L"{} {}X 补帧初始化失败,未替换后端或降低倍率;请查看任务诊断日志",std::wstring(frameGenerationBackendName(options.settings.frameGenerationBackend).begin(),frameGenerationBackendName(options.settings.frameGenerationBackend).end()),options.fgMultiplier);
}
} else startGraph(false,1);
if(!graphReady){if(failureReason.empty())failureReason=L"增强管线初始化失败,请查看诊断";break;}
diff --git a/src/engine/VideoPresenter.cpp b/src/engine/VideoPresenter.cpp
index 9362025c..7456cc99 100644
--- a/src/engine/VideoPresenter.cpp
+++ b/src/engine/VideoPresenter.cpp
@@ -370,7 +370,7 @@ PresentationSettings VideoPresenter::configurePresentation(gfx::D3D12DeviceConte
}
const bool vsync=presentationVsync(requested),tearing=presentationTearing(requested);
providerOwnedPresentation_=xessActive();
- const std::wstring sync=vsync?L"显示同步:垂直同步":tearing?L"显示同步:允许撕裂":L"显示同步:自动 · 防撕裂(不等待垂直同步)";
+ const std::wstring sync=requested.display==DisplaySync::Automatic?L"显示同步:自动 · 与屏幕同步防撕裂":vsync?L"显示同步:垂直同步":L"显示同步:允许撕裂";
if(!reflexDisabled){effective.enabled=false;sink_.configurePacing(false,vsync,tearing);status=L"Reflex 驱动状态撤销失败;低延迟队列已停用 · "+sync;return effective;}
if(xessActive()){
// The provider owns Present for its generated frames, so neither the
diff --git a/src/gfx/GpuSchedulingPriority.cpp b/src/gfx/GpuSchedulingPriority.cpp
index ba204579..c64bd00c 100644
--- a/src/gfx/GpuSchedulingPriority.cpp
+++ b/src/gfx/GpuSchedulingPriority.cpp
@@ -32,6 +32,11 @@ void applyLocked(){
// WDDM has no process scheduling record before the first GPU context.
publish(uint32_t(query)==0xC000000Du?GpuPriorityState::Pending:GpuPriorityState::Rejected,-1,uint32_t(query));return;
}
+ // Query first and avoid a redundant scheduler call when the requested
+ // class is already in effect, including after a device reopen.
+ if(before==int(current.requested)){
+ publish(GpuPriorityState::Applied,before,0);return;
+ }
auto set=api.set(GetCurrentProcess(),int(current.requested));
auto verify=api.get(GetCurrentProcess(),&after);
// Realtime is the default (field request 2026-10-05). Where Windows refuses it
diff --git a/src/gfx/PresentSink.cpp b/src/gfx/PresentSink.cpp
index 2e0a5c19..f25c5299 100644
--- a/src/gfx/PresentSink.cpp
+++ b/src/gfx/PresentSink.cpp
@@ -158,6 +158,7 @@ bool PresentSink::initialize(ID3D12Device* device, ID3D12CommandQueue* queue,
queue_ = queue;
shutdownCalled_ = false;
desc_ = desc;
+ presentContractDirty_=true;
width_ = desc.width;
height_ = desc.height;
if (!device_ || !queue_ || (desc.targetWindow && !IsWindow(desc.targetWindow))) {
@@ -398,8 +399,10 @@ bool PresentSink::present(Status& status)
if(!beforeOk){xessFailed_=true;status=Status::WindowFailure;return false;}
const HRESULT hr = swapChain_->Present(syncInterval, flags);
presentTiming_.callMs=split();presentTiming_.result=hr;
- if(attemptedPresentCount_<=3||attemptedPresentCount_%120==0)
+ if(presentContractDirty_||attemptedPresentCount_<=3||attemptedPresentCount_%120==0){
log::info("present-contract",std::format("backend={} sync={} flags=0x{:X} hr=0x{:X}",xess_?"XeSS":"DXGI",syncInterval,flags,unsigned(hr)));
+ presentContractDirty_=false;
+ }
if (SUCCEEDED(hr)) {
++presentCount_;
backBufferIndex_ = swapChain_->GetCurrentBackBufferIndex();
@@ -480,6 +483,7 @@ PresentSink::FrameStatisticsDelta PresentSink::sampleFrameStatistics(){
}
bool PresentSink::configurePacing(bool enabled,bool vsync,bool tearing){
+ if(desc_.vsync!=vsync||desc_.tearing!=tearing)presentContractDirty_=true;
// XeSS owns pacing, but its proxy accepts DXGI VSync independently.
// Do not install another latency waiter on the provider swap chain.
if(xess_){pacing_=false;capacityAcquired_=false;desc_.vsync=xess_&&vsync;desc_.tearing=tearing;log::info("pacing",std::format("provider={} applicationWait=0 vsync={} tearing={}","XeSS",desc_.vsync,desc_.tearing));return !enabled;}
diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cpp
index 9c01f7fc..04e200bf 100644
--- a/src/ui/QmlPlayerBridge.cpp
+++ b/src/ui/QmlPlayerBridge.cpp
@@ -491,7 +491,11 @@ struct QmlPlayerBridge::Impl {
if(FAILED(adapter->GetDesc1(&desc))||(desc.Flags&DXGI_ADAPTER_FLAG_SOFTWARE))continue;
auto initial=facade.pendingSettings();
initial.nrRuntime=desc.VendorId==0x1002?engine::NrRuntime::LmxxfAmd:ngx::preferSfNr(desc.VendorId,desc.Description)?engine::NrRuntime::Ampere:engine::NrRuntime::Original;
- if(desc.VendorId==0x1002){initial.opticalFlowBackend=engine::OpticalFlowBackend::AmdFidelityFx;initial.videoSrQuality=engine::kVideoSrFsr;}
+ if(desc.VendorId==0x1002||desc.VendorId==0x8086){
+ initial.opticalFlowBackend=engine::OpticalFlowBackend::AmdFidelityFx;
+ initial.videoSrQuality=engine::kVideoSrFsr;
+ initial.frameGenerationBackend=engine::FrameGenerationBackend::Fsr;
+ }
facade.setPending(initial);
veyra::log::info("nr-default",std::format("adapter={} selected={}",utf8Of(std::wstring(desc.Description)).toStdString(),engine::nrRuntimeName(initial.nrRuntime)));
break;
@@ -556,6 +560,10 @@ struct QmlPlayerBridge::Impl {
error = QObject::tr("导出设置无效:%1").arg(why);
return std::nullopt;
}
+ if(settings.multiplier>1&&engine::presentSinkFrameGeneration(settings.frameGenerationBackend)){
+ error=QObject::tr("XeSS 尚未提供可编码的补帧纹理,请为导出选择 FSR、DLSS 或 VFG 补帧");
+ return std::nullopt;
+ }
return settings;
}
@@ -4385,7 +4393,11 @@ QVariantList QmlPlayerBridge::effectCatalog() const {
item["mustBeLast"] = info.mustBeLast;
item["justBeforeLast"] = info.justBeforeLast;
item["experimental"] = info.experimental;
- const auto cap = effectAvailability(utf8Of(info.id));
+ auto cap = effectAvailability(utf8Of(info.id));
+ if(info.type==engine::EffectType::FrameGeneration)
+ for(const auto& choice:fgBackendChoices())if(!choice.toMap().value("disabled").toBool()){
+ cap=QVariantMap{{"available",true},{"reason",QString{}}};break;
+ }
item["disabled"] = !cap.value("available").toBool();
item["note"] = cap.value("reason");
out << item;
@@ -5284,6 +5296,15 @@ void QmlPlayerBridge::openSubtitleDialog() { emit navigate(QStringLiteral("subti
// RTX Video HDR where the pipeline cannot honour them is refused with a reason,
// not silently dropped.
int QmlPlayerBridge::addEffect(const QString& type) {
+ // The generic list entry means "add an available FG stage". A saved,
+ // disabled NVIDIA choice must not make FSR/XeSS impossible to add on AMD.
+ if(type==QLatin1String("frame-generation")&&
+ !effectAvailability(type).value("available").toBool()){
+ for(const auto& choice:fgBackendChoices()){
+ const auto row=choice.toMap();if(row.value("disabled").toBool())continue;
+ return addEffect(row.value("id").toString()+QStringLiteral("-fg"));
+ }
+ }
const auto cap = effectAvailability(type);
if (!cap.value("available").toBool()) { emit notice(cap.value("reason").toString(), true); return -1; }
const bool fgType=type==QLatin1String("dlss-fg")||type==QLatin1String("xess-fg")||
diff --git a/tests/integration/ExportWorkflowTests.cpp b/tests/integration/ExportWorkflowTests.cpp
index d975fa95..fdc69f42 100644
--- a/tests/integration/ExportWorkflowTests.cpp
+++ b/tests/integration/ExportWorkflowTests.cpp
@@ -35,6 +35,15 @@ int wmain(int argc,wchar_t** argv){
media.container=mode.find(L"mkv")!=std::wstring::npos?ExportContainer::Matroska:ExportContainer::Mp4;
media.audio.policy=ExportTrackPolicy::All;media.subtitles.policy=ExportTrackPolicy::All;
const bool hevc=mode.find(L"hevc")!=std::wstring::npos;
+ const bool fsr=mode.find(L"fsr-")==0;
+ const bool rejectXess=mode==L"reject-xess";
+ if(fsr||rejectXess){
+ settings.frameGenerationBackend=rejectXess?FrameGenerationBackend::XeSS:FrameGenerationBackend::Fsr;
+ settings.multiplier=2;
+ settings.fgMotion=MotionSource::Zero;
+ if(mode.find(L"-sr")!=std::wstring::npos){settings.sr=true;settings.videoSrQuality=kVideoSrFsr;settings.srTarget=veyra::pipeline::SrTarget::Qhd;}
+ if(mode.find(L"nr")!=std::wstring::npos){settings.nr=true;settings.nrRuntime=NrRuntime::NvidiaOriginal;settings.nrMotion=MotionSource::Zero;}
+ }
// The real QML list stores explicit layers with preview resolution and
// stale legacy summary fields. Exercise the actual child process, not
// just a settings/chain round trip.
@@ -139,7 +148,7 @@ int wmain(int argc,wchar_t** argv){
// "reject": the user picked every subtitle track by hand, so a track
// the container cannot hold must fail the export. "skip": the default
// "all tracks" policy leaves it out and says so in the result.
- if(mode.find(L"reject")!=std::wstring::npos){
+ if(mode.find(L"reject")!=std::wstring::npos&&!rejectXess){
std::atomic<bool> stop{false};const auto info=ExportStreams::probe(input,ExportMediaOptions{},0,0,stop);
media.subtitles.policy=ExportTrackPolicy::Selected;media.subtitles.count=0;
for(const auto& t:info.tracks)if(t.subtitle&&media.subtitles.count<media.subtitles.indices.size())media.subtitles.indices[media.subtitles.count++]=t.index;
@@ -150,6 +159,16 @@ int wmain(int argc,wchar_t** argv){
std::wcout<<L"state="<<int(s.state)<<L" encoded="<<s.encoded<<L" message="<<s.message<<L"\n";
if(mode.find(L"reject")!=std::wstring::npos){require(s.state==ExportState::Failed,"incompatible source was not rejected");require(!std::filesystem::exists(output),"rejection produced final file");require(!s.message.empty(),"failure reason missing");}
else require(s.state==ExportState::Succeeded,"export failed");
+ if(rejectXess){
+ require(s.message.find(L"XeSS")!=std::wstring::npos&&s.message.find(L"FSR")!=std::wstring::npos,"XeSS rejection lost its backend-specific reason");
+ require(s.encoded==0,"unsupported XeSS wrote frames");
+ }
+ if(fsr){
+ require(s.sourceFrames==60&&s.encoded==120,"FSR did not encode every source frame at 2X");
+ require(s.generated>0,"FSR never produced a valid generated frame");
+ require(s.frozen.frameGenerationBackend==FrameGenerationBackend::Fsr,"FSR frozen job changed backend");
+ std::wcout<<L"FSR_TEXTURE_EXPORT source="<<s.sourceFrames<<L" encoded="<<s.encoded<<L" validGenerated="<<s.generated<<L" holds="<<s.holds<<L"\n";
+ }
if(mode.find(L"skip")!=std::wstring::npos)require(s.message.find(L"未保留")!=std::wstring::npos,"skipped tracks not reported");
}
passed=true;
diff --git a/tests/integration/FgPresentationTests.cpp b/tests/integration/FgPresentationTests.cpp
index fc786c3e..42ac2b91 100644
--- a/tests/integration/FgPresentationTests.cpp
+++ b/tests/integration/FgPresentationTests.cpp
@@ -15,7 +15,8 @@ extern "C" {
int wmain(int argc,wchar_t** argv){
using namespace veyra;
if((argc<2||argc>4)||FAILED(CoInitializeEx(nullptr,COINIT_MULTITHREADED)))return 2;
- const bool temporal=argc==4;
+ const bool displaySync=argc==4&&std::wstring_view(argv[3])==L"display-sync";
+ const bool temporal=argc==4&&!displaySync;
const bool exact=temporal&&std::wstring_view(argv[3])==L"temporal-exact";
if(temporal&&!exact&&std::wstring_view(argv[3])!=L"temporal")return 2;
const auto runtimePath=argc>=3?std::filesystem::absolute(argv[2]):std::filesystem::path(VEYRA_PROJECT_ROOT)/"runtime_local/nvidia";
@@ -31,14 +32,56 @@ int wmain(int argc,wchar_t** argv){
if(frame){frame->format=AV_PIX_FMT_RGBA;frame->width=640;frame->height=360;frame->color_range=AVCOL_RANGE_JPEG;frame->color_trc=AVCOL_TRC_IEC61966_2_1;}
ok=ok&&frame&&av_frame_get_buffer(frame,32)>=0;
unsigned cycle=0;
+ if(displaySync){
+ // Real windowed and borderless-fullscreen swapchains, including both
+ // latency-queue settings. The runner checks actual Present flags in
+ // addition to the pure settings contract; panel scanout is not measured.
+ MONITORINFO monitor{sizeof(MONITORINFO)};
+ ok=ok&&GetMonitorInfoW(MonitorFromWindow(window,MONITOR_DEFAULTTONEAREST),&monitor);
+ for(bool full:{false,true})for(bool lowQueue:{false,true})for(auto mode:{engine::DisplaySync::Automatic,engine::DisplaySync::Vsync,engine::DisplaySync::Tearing}){
+ if(!ok)break;
+ const int w=full?monitor.rcMonitor.right-monitor.rcMonitor.left:640;
+ const int h=full?monitor.rcMonitor.bottom-monitor.rcMonitor.top:360;
+ SetWindowPos(window,nullptr,full?monitor.rcMonitor.left:0,full?monitor.rcMonitor.top:0,w,h,SWP_NOZORDER|SWP_NOACTIVATE);
+ ShowWindow(window,SW_SHOWNOACTIVATE);
+ pipeline::EnhanceGraphDesc desc;desc.sourceWidth=desc.workWidth=640;desc.sourceHeight=desc.workHeight=360;
+ desc.enableNr=desc.enableSr=desc.enableFg=false;desc.rgbInput=true;desc.runtimeAbsPath=runtimePath.wstring();
+ ok=graph.initialize(desc)&&presenter.open(ctx,window,graph)&&graph.createViews();
+ engine::PresentationSettings requested;requested.fullscreen=full;requested.enabled=lowQueue;requested.display=mode;
+ std::wstring text;const auto applied=presenter.configurePresentation(ctx,requested,false,text);
+ ok=ok&&applied.display==mode&&applied.enabled==lowQueue;
+ const auto beforeSubmitted=presenter.submittedCount();
+ std::cout<<"DISPLAY_SYNC_BEGIN full="<<full<<" lowQueue="<<lowQueue<<" mode="<<unsigned(mode)<<std::endl;
+ for(unsigned f=0;ok&&f<6;++f){
+ for(unsigned y=0;y<360;++y)for(unsigned x=0;x<640;++x){auto* p=frame->data[0]+size_t(y)*frame->linesize[0]+x*4;p[0]=60+f*10;p[1]=110;p[2]=180;p[3]=255;}
+ pipeline::EnhanceGraph::FrameOutputs out;
+ ok=graph.process(frame,f*33.333,f==0||f==3,out,f+1)&&presenter.present(ctx,ring,graph,out.videoSlot,false,false);
+ if(f==1&&ok){
+ sink::RgbaImage actual,expected;
+ ok=presenter.readPresentedFrameForTest(ctx,ring,actual)&&sink::readRgba8(ctx,ring,graph.videoFrameResource(out.videoSlot),expected);
+ ok=ok&&actual.width==unsigned(w)&&actual.height==unsigned(h)&&!expected.pixels.empty();
+ // The fullscreen monitor may have a different aspect
+ // ratio; inspect the image centre, excluding letterboxing.
+ if(ok)for(unsigned y=actual.height*3/8;y<actual.height*5/8;++y)for(unsigned x=actual.width*3/8;x<actual.width*5/8;++x)
+ for(unsigned c=0;c<3;++c)if(std::abs(int(actual.pixels[(size_t(y)*actual.width+x)*4+c])-int(expected.pixels[c]))>2)ok=false;
+ }
+ }
+ ok=ok&&presenter.submittedCount()==beforeSubmitted+6;
+ // Native presentation uses the producer ring. Match the engine's
+ // drain-before-rebuild contract before releasing presenter passes.
+ ok=ring.drainQueue()&&ok;graph.shutdown();presenter.close();
+ std::cout<<"DISPLAY_SYNC_END full="<<full<<" lowQueue="<<lowQueue<<" mode="<<unsigned(mode)<<" pass="<<ok<<std::endl;
+ }
+ }
for(unsigned multiplier:{4u,6u,4u}){
- if(temporal)break;
+ if(temporal||displaySync)break;
if(!ok)break;
++cycle;
pipeline::EnhanceGraphDesc desc;desc.sourceWidth=desc.workWidth=640;desc.sourceHeight=desc.workHeight=360;
desc.enableNr=desc.enableSr=false;desc.enableFg=desc.rgbInput=true;desc.fgMultiplier=multiplier;
desc.runtimeAbsPath=runtimePath.wstring();
ok=graph.initialize(desc)&&presenter.open(ctx,window,graph)&&graph.createViews();
+ if(ok){engine::PresentationSettings requested;std::wstring text;presenter.configurePresentation(ctx,requested,true,text);ShowWindow(window,SW_SHOWNOACTIVATE);}
if(ok&&cycle==1){
// A producer allocator stall must not be reported as private
// presentation-ring service. Release the GPU wait from the CPU.
diff --git a/tests/integration/LmxxfNrGraphTests.cpp b/tests/integration/LmxxfNrGraphTests.cpp
index 0f095ef9..d2707a55 100644
--- a/tests/integration/LmxxfNrGraphTests.cpp
+++ b/tests/integration/LmxxfNrGraphTests.cpp
@@ -5,6 +5,7 @@
#include "veyra/gfx/D3D12DeviceContext.h"
#include "veyra/gfx/CommandSlotRing.h"
#include "veyra/sink/ImageExportSink.h"
+#include "veyra/engine/GraphDescription.h"
#include <iostream>
#include <filesystem>
#include <algorithm>
@@ -54,6 +55,43 @@ int main(){
std::cout<<"AMD_GRAPH_IDENTITY layers="<<layers<<" temporal="<<temporal
<<" maxCodeDifference="<<maximum<<" rgbSum="<<rgbSum<<" pass="<<ok<<'\n';
}
+ // Real export planner + full-resolution residual compositor. A small
+ // identity fixture alone cannot detect a 4K output being truncated to the
+ // neural model's internal 1080p budget.
+ av_frame_free(&frame);frame=av_frame_alloc();
+ frame->format=AV_PIX_FMT_RGBA;frame->width=3840;frame->height=2160;
+ if(av_frame_get_buffer(frame,32)<0)return 2;
+ for(int y=0;y<frame->height;++y)for(int x=0;x<frame->width;++x){
+ auto* p=frame->data[0]+y*frame->linesize[0]+x*4;
+ p[0]=uint8_t(24+(x/24)%192);p[1]=uint8_t(32+(y/16)%176);p[2]=uint8_t(220-(x/32+y/24)%192);p[3]=255;
+ }
+ reference={};
+ for(unsigned layers:{0u,1u,2u}){
+ engine::EnhancementSettings settings;settings.nr=layers>0;settings.sr=false;settings.multiplier=1;
+ settings.nrRuntime=engine::NrRuntime::LmxxfAmd;settings.nrMotion=engine::MotionSource::Zero;
+ settings.nrLayerCount=layers;
+ for(unsigned n=0;n<layers;++n){settings.nrLayers[n].enabled=true;settings.nrLayers[n].runtime=engine::NrRuntime::LmxxfAmd;settings.nrLayers[n].sizePolicy=pipeline::NrSizePolicy::Native;}
+ engine::StageRequest request;request.nr=settings.nr;request.width=3840;request.height=2160;
+ request.exportJob=true;request.nvidiaAdapter=false;request.amdNr=true;
+ pipeline::EnhanceGraphDesc gd;const auto plan=engine::describeStages(request,settings,gd);
+ gd.rgbInput=true;gd.runtimeAbsPath=std::filesystem::absolute("runtime/nvidia").wstring();
+ bool ok=plan.base==pipeline::Extent{3840,2160}&&gd.nrWidth<=1920&&gd.nrHeight<=1080;
+ for(const auto extent:gd.nrLayersExtent)ok=ok&&extent.width<=1920&&extent.height<=1080;
+ pipeline::EnhanceGraph graph(ctx,ring);ok=ok&&graph.initialize(gd)&&graph.createViews();
+ unsigned maximum=0;uint64_t evaluated=0;
+ for(unsigned f=0;ok&&f<3;++f){
+ pipeline::EnhanceGraph::FrameOutputs out;sink::RgbaImage image;
+ ok=graph.process(frame,f*33.333,f==0||f==2,out,f+1)&&sink::readRgba8(ctx,ring,graph.videoFrameResource(out.videoSlot),image);
+ if(ok&&!layers&&f==0)reference=image;
+ ok=ok&&image.width==3840&&image.height==2160&&image.pixels.size()==reference.pixels.size();
+ if(ok)for(size_t p=0;p<image.pixels.size();++p)if(p%4!=3)maximum=std::max(maximum,unsigned(std::abs(int(image.pixels[p])-int(reference.pixels[p]))));
+ ok=ok&&maximum<=1;
+ }
+ evaluated=graph.metrics().nrEvaluateCount;ok=ok&&evaluated==uint64_t(layers)*3;
+ ring.drainQueue();graph.shutdown();++checks;failures+=!ok;
+ std::cout<<"AMD_EXPORT_4K_IDENTITY layers="<<layers<<" output=3840x2160 internal="<<gd.nrWidth<<'x'<<gd.nrHeight
+ <<" evaluated="<<evaluated<<" maxCodeDifference="<<maximum<<" pass="<<ok<<'\n';
+ }
uint32_t removed=0;if(!ctx.checkDeviceAlive(removed))++failures;
av_frame_free(&frame);CoUninitialize();
std::cout<<"Shared AMD composition GPU test: "<<checks<<" cases, "<<failures<<" failures. Not HIP inference.\n";
diff --git a/tests/unit/EffectChainTests.cpp b/tests/unit/EffectChainTests.cpp
index 62863790..5cf75dde 100644
--- a/tests/unit/EffectChainTests.cpp
+++ b/tests/unit/EffectChainTests.cpp
@@ -977,6 +977,31 @@ void testPerLayerAntiFlickerSnapshot(){
}
}
int main() {
+ {
+ using namespace veyra;using namespace veyra::engine;
+ for(const auto source:{pipeline::Extent{3840,2160},pipeline::Extent{2560,1440},pipeline::Extent{3840,1600}}){
+ EnhancementSettings s;s.nr=true;s.nrRuntime=NrRuntime::LmxxfAmd;s.nrLayerCount=2;
+ for(auto& n:s.nrLayers){n.enabled=true;n.runtime=NrRuntime::LmxxfAmd;n.sizePolicy=pipeline::NrSizePolicy::Native;}
+ s.nrLayers[0].model.style=1;s.nrLayers[1].model.style=2;s.nrLayers[1].residual.total=5;
+ const auto frozen=freezeExportSettings(s);auto restored=frozen;fromChain(toChain(frozen),restored);
+ check(restored==frozen&&frozen.nrLayers[1].residual.total==5,"AMD export freeze round-trip retains controls and worker contract");
+ StageRequest r;r.nr=true;r.exportJob=true;r.nvidiaAdapter=false;r.amdNr=true;r.width=source.width;r.height=source.height;
+ pipeline::EnhanceGraphDesc d;const auto plan=describeStages(r,frozen,d);
+ check(d.enableNr&&plan.output==source&&d.workWidth==source.width&&d.workHeight==source.height,"high-resolution AMD export keeps native output and enabled NR");
+ check(d.nrLayersExtent.size()==2&&std::all_of(d.nrLayersExtent.begin(),d.nrLayersExtent.end(),[](auto e){return e.height<=1080&&uint64_t(e.width)*e.height<=1920ull*1080;}),"every offline AMD model input fits the actual budget");
+ check(d.validateFixedExecutionPlan().empty()&&d.nrLayersSizePolicy[0]==pipeline::NrSizePolicy::Realtime,"bounded AMD processing matches the fixed shared execution plan");
+ s.nrRuntime=NrRuntime::NvidiaOriginal;for(auto& n:s.nrLayers)n.runtime=s.nrRuntime;
+ r.nvidiaAdapter=true;r.amdNr=false;describeStages(r,s,d);
+ check(d.nrLayersExtent[0]==source&&d.nrLayersExtent[1]==source,"NVIDIA export preserves native NR input dimensions");
+ }
+ for(auto backend:{FrameGenerationBackend::Dlss,FrameGenerationBackend::Vfg,FrameGenerationBackend::XeSS,FrameGenerationBackend::Fsr,FrameGenerationBackend::Fsr4}){
+ EnhancementSettings s;s.nr=s.sr=false;s.frameGenerationBackend=backend;s.multiplier=2;
+ StageRequest r;r.fg=true;r.fgMultiplier=2;r.exportJob=true;r.nvidiaAdapter=false;r.width=1920;r.height=1080;
+ pipeline::EnhanceGraphDesc d;describeStages(r,s,d);
+ check(d.frameGenerationBackend==backend&&d.fgMultiplier==2,"offline planning never substitutes DLSS or silently changes multiplier");
+ check(d.enableFg==fsrFrameGeneration(backend),"cross-vendor export admits actual FSR textures, rejects NVIDIA-only and present-sink stages");
+ }
+ }
testPerLayerAntiFlickerSnapshot();
testNrCorrectionDescription();
std::setvbuf(stdout,nullptr,_IONBF,0);
diff --git a/tests/unit/RepairContractTests.cpp b/tests/unit/RepairContractTests.cpp
index 2be797fa..93902c83 100644
--- a/tests/unit/RepairContractTests.cpp
+++ b/tests/unit/RepairContractTests.cpp
@@ -61,7 +61,7 @@ int main(){
check(std::wstring_view(engine::ngxFailureHint(0xBAD00001)).find(L"不支持")!=std::wstring_view::npos,"NGX FeatureNotSupported has a distinct visible reason");
for(bool lowQueue:{false,true})for(bool fullscreen:{false,true})for(auto sync:{engine::DisplaySync::Tearing,engine::DisplaySync::Vsync,engine::DisplaySync::Automatic}) {
engine::PresentationSettings s;s.enabled=lowQueue;s.fullscreen=fullscreen;s.display=sync;
- check(engine::presentationVsync(s)==(sync==engine::DisplaySync::Vsync)&&engine::presentationTearing(s)==(sync==engine::DisplaySync::Tearing),"VSync and tearing only when explicitly selected; Automatic is neither, windowed or fullscreen");
+ check(engine::presentationVsync(s)==(sync!=engine::DisplaySync::Tearing)&&engine::presentationTearing(s)==(sync==engine::DisplaySync::Tearing),"Automatic synchronizes windowed/fullscreen independently of low queue; only explicit Tearing is unsynchronized");
}
{
source::AudioInputRecovery retry;retry.reset(1000);