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: repair software UI repaint, export snapshots and AMD NR composition

Veyra Goal Agentf543449db2c4
diff --git a/AGENTS.md b/AGENTS.md
index 8e080807..69429edc 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1,5 +1,7 @@
# Veyra 项目 Agent 执行规则
+> **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 真推理通过。
+
> **2026-10-06 正式发布授权**:用户明确要求发布2.0.4到Likely7/Veyra-NRVideo,README替换2.0.3更新内容,其余主体保持;新增Discord `https://discord.gg/c9aREyMj8` 与Ko-fi `https://ko-fi.com/likely7`,保留原微信群及微信赞助二维码各width=220;Release详述优化、实测数据与限制,完成后提供1000字以内群公告并关机。本轮允许必要发布文档/打包/源码归档、main合并、推送、v2.0.4标签与Release资产上传和正式发布。按docs/PUBLISH_2.0.4_PLAN_2026-10-06.md执行;沿用已验收程序及运行组件原字节,不扩改引擎、不派子Agent、不做压力测试。发布核实后才能安排关机;公告只交付用户,不代发群。本条覆盖此前本地候选的“不发布/不关机”限制。
> **2026-10-06 列表预设纠偏**:用户明确不要独立补帧预设,要求图示光流/估算质量/内容节奏进入已有列表预设,并重新打包2.0.4。按docs/LIST_PRESET_FLOW_PLAN_2026-10-06.md在E盘codex/list-preset-flow-20261006实施必要PresetLibrary/bridge/QML/翻译/定向测试/本地main续修与打包;保留旧包/原工作区及用户配置,不替换运行库。新guard list-preset-flow-control.py使用独立不可变基线。此具体修复覆盖这些接点历史冻结;不推送/公开发布,不派Agent/压力测试/关机,沿用≤300秒测试与≤900秒构建。
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ad27eb79..f76995cc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -791,6 +791,22 @@ if(VEYRA_FFMPEG_ROOT AND EXISTS "${VEYRA_FFMPEG_ROOT}/include/libavformat/avform
add_executable(veyra_export_frame_pool_tests tests/integration/ExportFramePoolTests.cpp)
add_executable(veyra_export_worker_failure_tests tests/integration/ExportWorkerFailureTests.cpp)
add_executable(veyra_export_workflow_tests tests/integration/ExportWorkflowTests.cpp)
+ # Diagnostic-only graph variant: an identity-copy C ABI provider is admitted
+ # on the actual test adapter. Production graph and hardware policy are unchanged.
+ set(VEYRA_AMD_NR_TEST_GRAPH_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/src/pipeline/EnhanceGraph.cpp" CACHE FILEPATH "Graph snapshot for AMD identity regression only")
+ file(READ "${VEYRA_AMD_NR_TEST_GRAPH_SOURCE}" _amd_nr_graph)
+ string(REPLACE "ring_.queue(),context_.adapter().vendorId) || !instance->amd->admits"
+ "ring_.queue(),0x1002 /* identity fixture only */) || !instance->amd->admits" _amd_nr_graph "${_amd_nr_graph}")
+ 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")
+ 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>)
+ target_compile_options(veyra_amd_nr_graph_tests PRIVATE /utf-8 /WX-)
+ target_link_libraries(veyra_amd_nr_graph_tests PRIVATE veyra_pipeline veyra_sinks)
+ add_dependencies(veyra_amd_nr_graph_tests veyra_lmxxf_fake_runtime)
target_compile_features(veyra_export_workflow_tests PRIVATE cxx_std_20)
target_compile_options(veyra_export_workflow_tests PRIVATE /utf-8)
target_link_libraries(veyra_export_workflow_tests PRIVATE veyra_engine)
diff --git a/apps/veyra-qml/main.cpp b/apps/veyra-qml/main.cpp
index 4f6462ff..03a9e04d 100644
--- a/apps/veyra-qml/main.cpp
+++ b/apps/veyra-qml/main.cpp
@@ -501,6 +501,13 @@ static int runApplication(int argc, char** argv, QString& restartProgram, QStrin
const bool overlayCompat = !obsGameCapture && overlayCompatAuto
&& (rivaTuner || overlayCompatRestart) && !forcedRenderer[0];
const bool softwareUi = obsGameCapture || overlayCompat;
+ if (softwareUi) {
+ // Partial software damage updates can leave transformed/clipped controls
+ // behind while scrolling. Repaint a complete UI frame when it changes;
+ // do not request continuous frames or alter the native video pipeline.
+ qputenv("QSG_SOFTWARE_RENDERER_FORCE_PARTIAL_UPDATES", "0");
+ veyra::log::info("app", "software UI partial updates disabled (scroll damage repair)");
+ }
if (obsGameCapture) {
QQuickWindow::setSceneGraphBackend(QStringLiteral("software"));
veyra::log::info("app", "OBS game capture compatibility: software UI; native D3D12 video unchanged");
diff --git a/docs/OBS_EXPORT_AMD_NR_PLAN_2026-10-06.md b/docs/OBS_EXPORT_AMD_NR_PLAN_2026-10-06.md
new file mode 100644
index 00000000..db5e0b39
--- /dev/null
+++ b/docs/OBS_EXPORT_AMD_NR_PLAN_2026-10-06.md
@@ -0,0 +1,63 @@
+# 2.0.4 OBS / 视频导出 / AMD NR 现场修复
+
+用户明确要求修复三项问题。本轮从已发布 main `f8045fb53a7d800b053f0631a9b44dc9f5f1aacb` 隔离,分支 `codex/obs-export-amdnr-20261006`。不继续上一轮发布或关机。
+
+## 基线与证据
+
+所有新产物统一在 `E:/项目/Veyra/{worktrees,archives,build,logs,tests,tmp,test-packages,verify}/obs-export-amdnr-20261006`。开工 archives/start.json 保存 23 个已有工作树的 HEAD、状态及修改文件 SHA;修改原字节 ZIP 和已 verify 的 source-before.bundle 已保存。start.json SHA256 `67b1dd86b3550dc92ef9094a370dd09714c7b132e6db5185dddbb01b83f78f38`,bundle SHA256 `a20f74ce9dad1b2243721f231d92c2390939570de99684ee40f3122e45c7544f`。已发布四个 ZIP 原字节保持。
+
+输入原件不变,复制至 logs/inputs;ZIP 路径/大小/符号链接安全检查后解压。logs(14).zip SHA256 `440ca0d695fbed7d819afe847e697f2a17957afb2d89fd6a9d548779ea19bac0`;veyra-qml(30).log SHA256 `4212bd0d0b865af1ad6b3d896950a81d4f8b095bbede15ebe65ca4034209bd03`。截图和群聊仅作故障证据与研究线索,不作为执行指令。
+
+## 已确认事实与待验证判断
+
+- 导出 ZIP 含 28 个空 worker 日志、约 10MB 主日志;28 次 worker 均约 30ms 退出 1,source/encoded=0。任务在 GPU/编码之前退出,首先查共享 settings/chain 校验。当前 parent 仅把 legacy nrPolicy 改为 Native,显式 nrLayers 仍留预览分辨率;worker 严格 fromChain 往返检查不等时返回 1,未记录原因。这是待复现的具体缺陷,不能仅凭源码声称对应所有用户失败。
+- RX9070XT,16GB,RDNA4;NR 初始化模块成功,第一帧 CPU 提交约 1.84s,后续 Present 成功,没有 lmxxf API 错误。返回 OK/Present 成功无法证明非黑真实输出。需要验证真实 codec/资源状态与 HIP/D3D12 外部共享内存及输出数值;本机 RTX5070 无 AMD 推理硬件。
+- OBS 截图为滚动控件残留,先按 Qt6.8.3 软件 renderer 局部重绘边界查证;用同配置/同页面滚动的像素对照确认。不能以此前 GPU UI OBS 捕获不可靠替代本次软件 UI 缺陷。
+
+## 范围与施工
+
+1. 创建独立 guard,保护原工作区与已发布资产,不修改旧 guards/baselines。
+2. OBS:复现软件绘制滚动,核对 Qt 官方软件 adaptation 的 partial-update 设置;仅软件 UI 使用必要全帧重绘,不切视频到 CPU、不加不断渲染的 timer、不改 OBS/RTSS 用户配置。验收滚动、弹出菜单、缩放及 GPU UI 路径,记录 CPU 代价。
+3. 导出:规范化 native NR 冻结链与 settings,保留多层参数、光流/画面调控和其它非链设置;父子共用同一规范化快照。所有入口校验失败写真实错误到独立日志及任务状态。实际 GUI 单/多 NR、关 NR、NR+SR、原生4K短导出和取消重试,不以单元快照替代真实 worker。
+4. AMD:固定两个上游源码提交及许可证;现有 lmxxf `78f548749e74824327b8458c57be31a1df78376a` 与最新源码对照,A-ENTROPY `46f59c58fbb1de21180d74131349c595e9fc5d93` 为 RDNA3 参考。优先修当前9070运行路径,不凭群聊宣称20–40/全部AMD支持。源码复用标注来源;不加载 ReShade/add-on,不磁盘 patch DLL/模型,不盲下载未知 NVIDIA 文件。先真实 D3D12 codec/状态与有界失败恢复测试,再提供 AMD 实卡候选;API 成功和 identity provider 只证明各自契约。
+5. 必要产品构建、针对性回归、同源码 vendor 本地候选及 runtime/PE/manifest 检查。测试≤300s/进程,构建≤900s;子进程 TEMP/TMP 定向 E 盘。本机验证与 RX9070 实卡缺口分别报告。
+
+## 当前进度
+
+产品修复与本地验证已经开展,原始失败和夹具错误均保留。本轮只提供本地候选,不发布、不关机。下列证据取代开工时尚未验证的判断,不改变原始日志。
+
+### AMD 黑屏的确定缺陷
+
+`EnhanceGraph::compositeNrLayer` 原先以 NVIDIA NGX feature handle 非空作为执行条件。lmxxf AMD 实例只有 ready context,没有 NGX handle,因此无条件跳过共享残差/时域合成,消费者使用的 fullTarget 未写入。改为 NGX handle 或 ready AMD context 任一存在时执行,共享同一合成器,所有 NR 层生效;没有改驱动、DLL、权重或增加正常路径的像素回读、CPU fence 等待。首次 enqueue 的公开 GetStatus 现在记录实际后端诊断。
+
+固定上游来源:现有 MIT lmxxf `78f548749e74824327b8458c57be31a1df78376a` 保留;最新公开源码 `359d6b3d7e4772ccf278daf63afa158bfa496fab`(2026-10-06)对照后无需为了本宿主缺陷替换运行库。A-ENTROPY GPLv3 `46f59c58fbb1de21180d74131349c595e9fc5d93` 的 README 是 RX7900XTX/gfx1100 测试事实,其 backend 需要另一套 `dlssnr_amd_pass1.dll` 与 `dlssnr_on_amd_weights.bin`、固定 ABI/offset,不是把 NVIDIA 原件改名即可替换的方案。该项目指出底层命令不执行仍推进 fence 或跨 adapter 共享错误会黑图,但 Veyra 没有采用其 private-offset trampoline/D3D11 互操作,不能把不同根因混为一谈。本轮没有复制该项目代码、不引入新私有二进制,不宣称 RDNA2/3 全支持。
+
+来源:[lmxxf](https://github.com/lmxxf/dlss5-on-amd-9070xt-porting/tree/359d6b3d7e4772ccf278daf63afa158bfa496fab)、[A-ENTROPY](https://github.com/A-ENTROPY/magpie-dlss5-amd/tree/46f59c58fbb1de21180d74131349c595e9fc5d93)。
+
+`amd-graph-before-v2` 用基线 Graph 和 D3D12 恒等拷贝 C ABI provider 实际复现:关闭 NR 对照正常,1/2/4 层 × 时域开/关共六个 NR 场景 RGB sum 全 0、最大 code 差 210。`amd-graph-after-v1` 同输入、同 shader、同真实 RTX5070 D3D12 设备下 7/7,通过全部像素对照,六个 NR 场景最大 code 差 0,每场景 8 帧,帧 0/4 reset。测试专用 Graph 只对恒等 provider 改 adapter admission 常量,生产硬件判断不变。它证明共享合成、层间消费、降尺寸和 reset,不执行 HIP 神经模型,不是 RX9070XT 实卡验收。
+
+### 视频导出
+
+父进程现在将所有显式 NR 层切成 Native,从同一链生成规范化 settings,再发送统一快照;规范化时保留非链参数。补上 `toChain/fromChain` 遗漏的每层与 legacy antiFlicker 档位,避免改冻结构时丢失 Static/FlowPlus。worker 在映射和校验前打开独立日志,映射/协议/参数/链不一致均记录具体原因,并按现有 messageLock 规则更新可用的任务状态。
+
+`export-before-v1` 真实已发布 EXE:关 NR、单层 NR 各完成 60 帧,两层 NR 在约 30ms、source/encoded=0、worker 日志空退出,与用户日志对应。`export-after-v1` 修复版真实 QML 界面四次(关 NR、单 NR、双 NR 不同风格、NR+4K 超分)均成功,每个完整 60 帧;后三次选择了预览 480p,但导出使用 Native,两个 NR 的独立自动调控风格 1/2 在 worker build 记录中保留。最后完整输出 3840×2160;未拿 1280 输入冒充原生4K输入测试。
+
+`field-stack-after-v2` 独立实际子进程完成两层 NR/不同风格、FlowPlus 与 Static 时域、Realtime/P720 预览参数转 Native 的 60 帧输出。单元 EffectChain/PresetLibrary/i18n 通过,lmxxf ABI/identity 62/62 通过(含失败/reset;非 AMD 推理)。生产收尾构建 build-final-v4 已完成,后续与最终 EXE 的对应验证单独记录。
+
+### OBS 软件 UI
+
+Qt 官方 6.8 软件 adaptation 支持 `QSG_SOFTWARE_RENDERER_FORCE_PARTIAL_UPDATES=0` 禁用局部更新。现将其仅用于 OBS game capture / RTSS software UI,画面变化时全 UI 重绘;未加连续渲染 timer,不改原生 D3D12 视频链或用户 OBS/RTSS 配置。[Qt 官方文档](https://doc.qt.io/qt-6.8/qtquick-visualcanvas-adaptations-software.html)。
+
+本机旧版暂未重现用户拖影,不能写成已经复现/根因完全证实。obs-before-v1 普通滚动和 obs-fractional-before-v4 展开 NR 参数、125% DPI 滚动返回均无残留。最终 EXE 的 obs-normal-after-v1 / obs-fractional-after-v1 两例通过:各 10 张真实自有窗口 GDI 截图,3 个返回原位截图 RGB 差 >8 的像素计数都为 0,100% 与 125% inspector 分别 199656 / 312080 像素;partial updates 日志确认关闭。旧/新 125% 各约 25 秒,进程 CPU 时间单轮 3.046875 / 3.421875 秒,增加 0.375 秒;100% 修复版 2.328125 秒。仅作 CPU 绘制代价观察,不当作性能收益或多机器普遍结论。截图已查看,现场 OBS 拖影仍待用户设备复测。
+
+### 夹具失败的处置
+
+保留原始日志/JSON,不覆盖为通过:graph-before-v1 未携带 shaders 导致所有场景失败,补齐同 build shaders 后 v2 才得到有效黑图对照;export-before-v1 首版汇总错误要求零文件,实际前两例成功而第三例失败,需另出按真实阶段重新审计的 JSON;field-stack-after-v1 测试设置的 legacy runtime 未与显式层一致,被合法 validate 拒绝,修正测试自身共享 runtime 后 v2 成功;obs-fractional-before-v2 在页面切换完成前查找控件失败,改为等待页面及展开动画,v3 完成;v3 inspector crop 缺少 QT_SCALE_FACTOR,v4 按逻辑/物理窗口比例更正,其原图和旧回执仍保留。初始 rg 路径/通配和 gh slurp+jq 命令错误没有计为产品测试。
+
+worker-mapping-reject-v1 用零 handle,被主程序命令行防错提前返回 2,尚未进入 worker,不能计入 worker 日志验收;v2 改为非零无效 handle,实际 MapViewOfFile 失败 Win32=6,exit1,独立 worker 日志有真实原因。
+
+### 最终产品验证与候选
+
+最终 EXE SHA256 `5f76d8f0edec9e7ed16a6fa0a9124205d0fdd285126623cfef3efd7691372250`,显示版本 `2.0.4-fix1`。`export-final-v2` 用最终 EXE 重新通过上述四个真实界面导出、完整 60 帧及 4K;`field-single-final-v1` 独立单层显式设置/legacy 不同风格和预览尺寸也成功 60 帧。`lifecycle-final-v1` 三阶段取消/暂停/运行中取消回收、同输出重试 20 帧、拒绝覆盖原文件通过;`lifecycle-boundary-final-v1` 最终保存取消、明确占用导致的临时文件清理失败、保留旧 partial 重试、已安全保存后的取消竞态均通过。未删除测试保护的用户/外部 partial。各测试进程远低于 300 秒,没有压力或 GPU 竞争测试。
+
+`obs-export-amdnr-evidence.py` 冻结 466 个产品输入与 15 份成功/预期失败回执,`tested-inputs.json` 保存 SHA;`export-before-audit-v2.json` 按原日志核对 0/1 成功、2 失败,旧错误 receipt 原字节不改。完成本地候选后做完整载荷 SHA、runtime 原字节、PE 导入、ZIP CRC 与干净解压启动;真实 GPU/软件 UI 基础启动结果单独列于 cold-verify-results.json,不拿基础启动冒充 HIP/实卡成功。
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index cb136bd6..688d7e2a 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -8483,6 +8483,22 @@ Run takeover-20261005T061823Z-1ad4ac;logs/tests/tmp/archives 全在 E:/项目/
`verify-merge.py pre-docs` 初次失败仅因桌面status默认折叠两个未追踪目录,而归档采用逐文件枚举;原失败JSON保留。修正为同样 --untracked-files=all后,`pre-docs-v2` exit0,两个目标工作树清洁,桌面HEAD/状态/未提交字节及其余14个工作树HEAD/状态/全部逐文件SHA保持。没有删除、移动或改变桌面文件。
main后续仅更新AGENTS/CURRENT_STATUS/FIELD_FIXES/WORKLOG/本轮合并记录并提交,最后执行 `verify-merge.py final` 和合并后增量bundle核验,结果/最终main提交写入本轮logs与archives JSON。没有新产品改动或重新构建;依据刚才接管时实际通过的build-6、五测试、1578包载荷及七阶段真实播放计时,合并保持同一产品Git源码。没有push/Release/压力测试/用户配置变更/分支删除/旧UI删除;AMD/用户后台卡顿/暂停后新接OBS/其他RTX与主观画质缺口仍保留,等用户后续具体修复要求。
+## 2026-10-06 OBS 拖影 / 导出入口失败 / AMD NR 黑屏隔离修复
+
+用户提供 logs(14).zip、veyra-qml(30).log 与截图,授权三项现场修复及核对 lmxxf/A-ENTROPY。从已发布 main f8045fb 开独立 `codex/obs-export-amdnr-20261006`;源码 worktrees 与 archives/build/tests/logs/tmp/test-packages/verify 全在 E:/项目/Veyra 对应任务目录。保存 23 个原工作树 HEAD/status/既有修改 SHA、修改原字节 ZIP、source-before.bundle(已 verify)和四个已发布 ZIP SHA;新增 guard 没有改旧 baseline。没有 merge/push/Release/关机/子Agent/竞争负载授权,均未执行。
+
+修复三个最小闭环:软件 UI 开启时 Qt partial-updates=0,变化时完整重绘;导出显式各 NR 层 Native、统一 chain/settings 冻结、保留每层 Static/FlowPlus 并提前打开 worker 日志;共享合成器接受 ready lmxxf context,避免把 AMD 的空 NGX handle 误判为禁用而使用未写 fullTarget。新增首次 enqueue 后端状态日志,运行库/权重/驱动原字节保持。来源固定 lmxxf 78f5487(当前)/359d6b3(公开最新)与 A-ENTROPY46f59c5;后者需要另一套 RDNA3 二进制/权重,未移植 private-offset/D3D11 路径,未扩大支持硬件范围。
+
+命令均在本轮工作树:`py -3.11 -B scripts/acceptance/obs-export-amdnr-build.py build-final-v4` exit0;`obs-export-amdnr-tests.py amd-graph-before-v2 graph-before` 关闭 NR 对照正常、六 NR 场景全黑(sum0),同夹具 after-v1 graph-after 7/7、最大像素 code 差0;这是 RTX5070 上恒等 C ABI GPU provider 和真实共享图/shader,非 HIP 神经推理。units-after-v1 的 EffectChain/PresetLibrary/i18n 全0;abi-after-v1 62/62(身份、reset、失效处理),非 AMD 硬件验收。
+
+实际界面 `obs-export-amdnr-ui.py export-before-v1 export before` 在双层 NR 复现约30ms/零帧/空日志,前两例各60帧;最终 `export-final-v2 export after` 关NR/单层/双层风格1+2/NR+4K全部成功,每项60帧,最后3840×2160。独立 field-single-final-v1/field-stack-after-v2 真实 worker 将 Realtime/P720 预览设置规范化 Native,保留独立抗闪烁档位。lifecycle-final-v1 / lifecycle-boundary-final-v1 取消回收、重试20帧、拒绝覆盖、保存边界/锁住partial/晚取消竞态通过;所有进程<300s。worker-mapping-reject-v2 返回1并记录 MapViewOfFile Win32=6。
+
+OBS 最终 100%/125% 展开 NR 参数各10张真实窗口 GDI图、3张返回原位 inspector 与起始 RGB >8 像素差全部0,partial updates disabled 日志确认。已查看截图;旧版本机同场景也没拖影,因此不能声称重现了现场缺陷或实卡已通过。约25秒125%滚动旧/新CPU总时间3.046875/3.421875秒,单轮增加0.375秒,非普遍性能结论。真实OBS现场与RX9070XT推理仍须用户复测。
+
+保留夹具失败:before graph缺shaders、baseline导出首版错误要求0文件(实际0/1成功、2失败)、field-stack首版runtime与legacy不一致、OBS页面未完成前查卡片、fractional首版crop未含缩放、mapping0被命令行防错拒绝。只修夹具后出新日志,不改旧receipt为通过;export-before-audit-v2重审原记录。首次诊断命令路径/slurp+jq错误不算产品结果。
+
+最终EXE SHA5f76d8f0edec9e7ed16a6fa0a9124205d0fdd285126623cfef3efd7691372250,显示2.0.4-fix1;`obs-export-amdnr-evidence.py` exit0 冻结466产品输入/15回执。后续制作本地AMD/NVIDIA候选及对应源码、逐文件/运行库/PE/ZIP/干净启动与最后保全审计,真实结果在本轮日志/DELIVERY.json记载;未测项不冒充通过。详 `docs/OBS_EXPORT_AMD_NR_PLAN_2026-10-06.md`。
+
## 2026-10-06 2.0.4 正式发布完成
执行package-v1完整生成正式AMD/NVIDIA、应用源码、依赖源码及SHA256SUMS,全部CRC/逐文件SHA、runtime原字节/PE闭包/显卡分包通过;source-final.bundle验证通过。EXE仍d01329aa6d9fbd6ac2d1eee294782f4cb9d233490595ed2e3e1a9ea12c16b2d6,PE2.0.4.0。cold-v1两包新解压隔离profile、Windows-only PATH启动分别9.937/9.578秒正常退出、各26个Qt/FFmpeg模块由包内加载,ASS5事件/字体附件正常;原功能验收对应同一473生产输入,不重复无关GPU测试。包路径、5项大小/SHA详PUBLISH_2.0.4_PLAN第2节及logs/.../assets.json、stage-AMD/NVIDIA.json、cold-verify-results.json。
diff --git a/include/veyra/pipeline/LmxxfNrBackend.h b/include/veyra/pipeline/LmxxfNrBackend.h
index 5567b81a..577c745a 100644
--- a/include/veyra/pipeline/LmxxfNrBackend.h
+++ b/include/veyra/pipeline/LmxxfNrBackend.h
@@ -32,7 +32,7 @@ private:
void* context_ = nullptr;
ID3D12CommandQueue* queue_ = nullptr; // graph owns it and outlives the adapter
uint64_t session_ = 0;
- bool enqueued_ = false, outputsRecorded_ = false;
+ bool enqueued_ = false, outputsRecorded_ = false, diagnosticsLogged_ = false;
std::string error_;
};
}
diff --git a/scripts/acceptance/obs-export-amdnr-audit.py b/scripts/acceptance/obs-export-amdnr-audit.py
new file mode 100644
index 00000000..830bcda5
--- /dev/null
+++ b/scripts/acceptance/obs-export-amdnr-audit.py
@@ -0,0 +1,52 @@
+"""Independent complete payload hashes, vendor boundaries and PE import closure."""
+import hashlib, json, os, sys
+from pathlib import Path
+import pefile
+
+BASE=Path('E:/项目/Veyra'); TASK='obs-export-amdnr-20261006'
+app=Path(sys.argv[1]).resolve(); flavor=sys.argv[2]; label=sys.argv[3]
+assert app.is_relative_to(BASE.resolve()) and flavor in ('NVIDIA','AMD')
+out=BASE/'logs'/TASK/(label+'.json'); assert not out.exists()
+manifest=json.loads((app/'package-manifest.json').read_text(encoding='utf8'))
+names={f.relative_to(app).as_posix():f for f in app.rglob('*') if f.is_file()}
+expected={r['path'] for r in manifest['files']}|{'package-manifest.json'}
+assert set(names)==expected, {'unexpected':list(set(names)-expected),'missing':list(expected-set(names))}
+for row in manifest['files']:
+ f=names[row['path']]
+ with f.open('rb') as stream: sha=hashlib.file_digest(stream,'sha256').hexdigest()
+ assert f.stat().st_size==row['size'] and sha==row['sha256'],row['path']
+assert not any(f.suffix.lower() in ('.pdb','.lib','.pyd','.whl','.addon64') for f in names.values())
+drivers={'nvcuda.dll','nvopticalflow64.dll','amdhip64.dll','amdhip64_6.dll','amdhip64_7.dll'}
+assert not drivers & {f.name.lower() for f in names.values()}
+if flavor=='NVIDIA':
+ assert not any(n.startswith('runtime/amd-nr/') for n in names)
+ vfg={f.name for n,f in names.items() if n.startswith('runtime/nvidia-vfg/')}
+ assert vfg=={'NVVideoEffects.dll','nvVFXVideoFrameGeneration.dll','NVCVImage.dll','cudart64_12.dll','nvngxruntime.dll'},vfg
+else:
+ assert not any(f.name.lower().startswith(('nvngx','nvvideoeffects','cudart','npp','nvcv')) for f in names.values())
+ assert 'runtime/amd-nr/LmxxfNrRuntime.dll' in names
+fsr={f.name for n,f in names.items() if n.startswith('runtime_local/amd/fidelityfx/')}
+assert fsr=={'amd_fidelityfx_loader_dx12.dll','amd_fidelityfx_upscaler_dx12.dll','amd_fidelityfx_framegeneration_dx12.dll'}
+runtime=json.loads((app/'release-runtime-manifest.json').read_text(encoding='utf8'))
+assert runtime==json.loads((app/'runtime/experimental/release-runtime-manifest.json').read_text(encoding='utf8'))
+assert {n for n,f in names.items() if n.startswith(('runtime/','runtime_local/')) and f.suffix.lower() not in ('.json','.md','.txt')} <= {r['path'] for r in runtime['files']}
+packaged={f.name.lower() for f in names.values() if f.suffix.lower()=='.dll'}
+system=Path(os.environ['WINDIR'])/'System32'; imports=[]; missing=[]
+for name,f in names.items():
+ if f.suffix.lower() not in ('.dll','.exe'):continue
+ pe=pefile.PE(str(f),fast_load=True)
+ pe.parse_data_directories(directories=[pefile.DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_IMPORT'],pefile.DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT']])
+ direct=[i.dll.decode().lower() for i in getattr(pe,'DIRECTORY_ENTRY_IMPORT',[])]
+ delay=[i.dll.decode().lower() for i in getattr(pe,'DIRECTORY_ENTRY_DELAY_IMPORT',[])]
+ pe.close()
+ assert not any(n.startswith('npp') for n in direct+delay),(name,direct,delay)
+ for dll in direct+delay:
+ if dll in packaged or dll.startswith(('api-ms-','ext-ms-')) or (system/dll).is_file():continue
+ missing.append({'file':name,'dependency':dll,'delay':dll in delay})
+ imports.append({'file':name,'direct':direct,'delay':delay})
+assert not missing,missing
+result=dict(flavor=flavor,app=str(app),payloadFiles=len(manifest['files']),payloadBytes=sum(r['size'] for r in manifest['files']),
+ sourceCommit=manifest.get('baseCommit'),releaseReady=manifest.get('releaseReady'),runtimeFiles=len(runtime['files']),
+ peFiles=len(imports),imports=imports,missing=missing,fsrException=True)
+out.write_text(json.dumps(result,ensure_ascii=False,indent=2),encoding='utf8')
+print('PACKAGE AUDIT PASS',flavor,result['payloadFiles'],result['payloadBytes'],out,flush=True)
diff --git a/scripts/acceptance/obs-export-amdnr-build.py b/scripts/acceptance/obs-export-amdnr-build.py
new file mode 100644
index 00000000..ff7faccd
--- /dev/null
+++ b/scripts/acceptance/obs-export-amdnr-build.py
@@ -0,0 +1,43 @@
+"""Build merged production and regression targets without replacing dependencies."""
+from pathlib import Path
+import hashlib,json,os,subprocess,sys
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='obs-export-amdnr-20261006'
+label=sys.argv[1];assert label.replace('-','').isalnum()
+BUILD=BASE/'build'/TASK;TMP=BASE/'tmp'/TASK/'build';LOG=BASE/'logs'/TASK/(label+'.log')
+for p in (BUILD,TMP,LOG.parent):p.mkdir(parents=True,exist_ok=True)
+guard=[sys.executable,'-B',str(ROOT/'scripts/acceptance/obs-export-amdnr-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)')
+assert any('VEYRA_LIBASS_ROOT' in line for line in settings)
+settings.append('set(VEYRA_DISPLAY_VERSION [[2.0.4-fix1]] CACHE STRING "2.0.4 test candidate" FORCE)')
+(TMP/'dependencies.cmake').write_text('\n'.join(settings),encoding='utf8')
+before='--before' in sys.argv
+if before:
+ snapshot=TMP/'EnhanceGraph-before.cpp'
+ snapshot.write_bytes(subprocess.check_output(['git','show','f8045fb:src/pipeline/EnhanceGraph.cpp'],cwd=ROOT))
+else:snapshot=ROOT/'src/pipeline/EnhanceGraph.cpp'
+with (TMP/'dependencies.cmake').open('a',encoding='utf8') as f:
+ f.write('\nset(VEYRA_AMD_NR_TEST_GRAPH_SOURCE [['+snapshot.as_posix()+']] CACHE FILEPATH "Identity test graph snapshot" FORCE)\n')
+targets=[t for t in sys.argv[2:] if t!='--before'] or ['veyra_qml_ui','veyra_export_workflow_tests',
+ 'veyra_export_worker_failure_tests','veyra_amd_nr_graph_tests','veyra_lmxxf_nr_tests',
+ 'veyra_effect_chain_tests','veyra_ui_i18n_tests','veyra_preset_library_tests']
+assert all(t.replace('_','').isalnum() for t in targets)
+cmd=TMP/'build.cmd'
+cmd.write_text('@echo off\nchcp 65001 >nul\ncall "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat" >nul 2>&1\nif errorlevel 1 exit /b 4\n"%TASK_CMAKE%" --preset x64-release -S "%TASK_ROOT%" -B "%TASK_BUILD%" -C "%TASK_TMP%\\dependencies.cmake"\nif errorlevel 1 exit /b 5\n"%TASK_CMAKE%" --build "%TASK_BUILD%" --parallel 6 --target '+' '.join(targets)+'\nexit /b %errorlevel%\n',encoding='ascii')
+env=os.environ.copy();env.update(TEMP=str(TMP),TMP=str(TMP),VSLANG='1033',TASK_ROOT=str(ROOT),TASK_BUILD=str(BUILD),TASK_TMP=str(TMP),
+ TASK_CMAKE='C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe')
+with LOG.open('x',encoding='utf8') as out:
+ try:rc=subprocess.run(['cmd.exe','/d','/c',str(cmd)],cwd=ROOT,env=env,stdout=out,stderr=subprocess.STDOUT,timeout=890).returncode
+ except subprocess.TimeoutExpired:rc=124
+receipt={'exit':rc,'log':str(LOG),'targets':targets,'sourceHead':subprocess.check_output(['git','-C',str(ROOT),'rev-parse','HEAD'],text=True).strip(),
+ 'dependencyCacheSha256':hashlib.sha256(cache.read_bytes()).hexdigest()}
+LOG.with_suffix('.json').write_text(json.dumps(receipt,ensure_ascii=False,indent=2),encoding='utf8')
+print('BUILD',rc,LOG);print('\n'.join(LOG.read_text(encoding='utf8',errors='replace').splitlines()[-18:]))
+subprocess.run(guard,check=True);raise SystemExit(rc)
diff --git a/scripts/acceptance/obs-export-amdnr-cold.py b/scripts/acceptance/obs-export-amdnr-cold.py
new file mode 100644
index 00000000..dbe39f85
--- /dev/null
+++ b/scripts/acceptance/obs-export-amdnr-cold.py
@@ -0,0 +1,67 @@
+from pathlib import Path, PurePosixPath
+import ctypes, hashlib, json, os, stat, subprocess, time, zipfile
+
+BASE=Path('E:/项目/Veyra'); TASK='obs-export-amdnr-20261006'
+PACK=BASE/'test-packages'/TASK; LOG=BASE/'logs'/TASK
+receipt=json.loads((PACK/'DELIVERY.json').read_text(encoding='utf8'))
+results=[]
+for row in receipt:
+ vendor=row['vendor']; destination=BASE/'verify'/TASK/vendor
+ assert destination.resolve().is_relative_to((BASE/'verify'/TASK).resolve()) and not destination.exists()
+ archive=Path(row['archive']); assert hashlib.sha256(archive.read_bytes()).hexdigest()==row['archiveSha256']
+ with zipfile.ZipFile(archive) as z:
+ assert len(z.infolist())<5000 and sum(i.file_size for i in z.infolist())<5*1024**3
+ for entry in z.infolist():
+ path=PurePosixPath(entry.filename)
+ assert not path.is_absolute() and '..' not in path.parts and ':' not in entry.filename
+ assert not stat.S_ISLNK(entry.external_attr>>16)
+ assert (destination/entry.filename).resolve().is_relative_to(destination.resolve())
+ z.extractall(destination)
+ app=destination/Path(row['app']).name
+ manifest=json.loads((app/'package-manifest.json').read_text(encoding='utf8'))
+ for item in manifest['files']:
+ assert hashlib.sha256((app/item['path']).read_bytes()).hexdigest()==item['sha256'],item['path']
+ out=BASE/'tests'/TASK/('cold-'+vendor); tmp=BASE/'tmp'/TASK/('cold-'+vendor)
+ for p in (out,tmp):p.mkdir(parents=True,exist_ok=False)
+ engine=LOG/('cold-'+vendor+'-engine.log'); console=LOG/('cold-'+vendor+'.log')
+ env={k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_','QT_','QSG_'))}
+ windows=Path(env['WINDIR'])
+ env.update(TEMP=str(tmp),TMP=str(tmp),CUDA_CACHE_PATH=str(tmp/'cuda-cache'),VEYRA_LOG_FILE=str(engine),
+ QML_DISABLE_DISK_CACHE='1',QT_FORCE_STDERR_LOGGING='1',
+ PATH=os.pathsep.join(map(str,(windows/'System32',windows,windows/'System32/Wbem'))))
+ args=[str(app/'veyra_qml_ui.exe'),'--data-dir',str(out/'profile'),'--page','pro','--size','1280x800',
+ *(['--obs-game-capture'] if vendor=='AMD' else []),'--exit-after','8000',str(BASE/'tests/field-fixes-20261005/media/fx-embedded.mkv')]
+ begin=time.monotonic(); modules=[]
+ with console.open('xb') as log:
+ process=subprocess.Popen(args,cwd=app,env=env,stdout=log,stderr=subprocess.STDOUT)
+ try:
+ time.sleep(3)
+ kernel=ctypes.WinDLL('kernel32',use_last_error=True); psapi=ctypes.WinDLL('psapi',use_last_error=True)
+ kernel.OpenProcess.argtypes=[ctypes.c_ulong,ctypes.c_int,ctypes.c_ulong];kernel.OpenProcess.restype=ctypes.c_void_p
+ kernel.CloseHandle.argtypes=[ctypes.c_void_p]
+ psapi.EnumProcessModulesEx.argtypes=[ctypes.c_void_p,ctypes.POINTER(ctypes.c_void_p),ctypes.c_ulong,ctypes.POINTER(ctypes.c_ulong),ctypes.c_ulong]
+ psapi.GetModuleFileNameExW.argtypes=[ctypes.c_void_p,ctypes.c_void_p,ctypes.c_wchar_p,ctypes.c_ulong]
+ handle=kernel.OpenProcess(0x0410,False,process.pid);assert handle
+ try:
+ items=(ctypes.c_void_p*512)(); needed=ctypes.c_ulong()
+ assert psapi.EnumProcessModulesEx(handle,items,ctypes.sizeof(items),ctypes.byref(needed),3)
+ for i in range(min(512,needed.value//ctypes.sizeof(ctypes.c_void_p))):
+ buffer=ctypes.create_unicode_buffer(32768)
+ if psapi.GetModuleFileNameExW(handle,items[i],buffer,len(buffer)):
+ path=Path(buffer.value)
+ if path.name.startswith(('Qt6','avcodec-','avformat-','avutil-','swscale-','swresample-')):
+ assert path.resolve().is_relative_to(app.resolve()),str(path)
+ modules.append(str(path))
+ finally:kernel.CloseHandle(handle)
+ rc=process.wait(timeout=50)
+ except BaseException:
+ process.kill();process.wait(timeout=10);raise
+ text=engine.read_text(encoding='utf8',errors='replace')+'\n'+console.read_text(encoding='utf8',errors='replace')
+ bad=[line for line in text.splitlines() if any(word in line for word in ('[ERROR]','[FATAL]','ReferenceError:','TypeError:','no root object'))]
+ assert rc==0 and not bad and len(modules)>10 and 'track ready events=5' in text and 'fonts configured container=1' in text,bad[:12]
+ result={'vendor':vendor,'passed':True,'exit':rc,'seconds':round(time.monotonic()-begin,3),'app':str(app),
+ 'args':args,'archiveSha256':row['archiveSha256'],'executableSha256':row['exeSha256'],
+ 'ownQtAndCodecModulePaths':modules,'console':str(console),'engine':str(engine)}
+ results.append(result);print('COLD ZIP START PASS',vendor,len(modules),'modules from extracted app',flush=True)
+ (LOG/'cold-verify-results.json').write_text(json.dumps(results,ensure_ascii=False,indent=2)+'\n',encoding='utf8')
+subprocess.run(['py','-3.11','-B','scripts/acceptance/obs-export-amdnr-control.py','--published'],cwd=BASE/'worktrees'/TASK,check=True)
diff --git a/scripts/acceptance/obs-export-amdnr-control.py b/scripts/acceptance/obs-export-amdnr-control.py
new file mode 100644
index 00000000..d1d794fc
--- /dev/null
+++ b/scripts/acceptance/obs-export-amdnr-control.py
@@ -0,0 +1,37 @@
+"""Independent scope and preservation guard for the three authorized field fixes."""
+from pathlib import Path
+import hashlib, json, subprocess, sys
+ROOT=Path(__file__).resolve().parents[2]
+BASE=Path('E:/项目/Veyra'); TASK='obs-export-amdnr-20261006'
+START=BASE/'archives'/TASK/'start.json'
+assert hashlib.sha256(START.read_bytes()).hexdigest()=='67b1dd86b3550dc92ef9094a370dd09714c7b132e6db5185dddbb01b83f78f38'
+s=json.loads(START.read_text(encoding='utf8'))
+def git(*args,cwd=ROOT):return subprocess.check_output(['git',*args],cwd=cwd)
+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['baseline'],'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 (hashlib.sha256(f.read_bytes()).hexdigest() if f.is_file() else None)==h,str(f)
+allowed={'AGENTS.md','CMakeLists.txt','THIRD_PARTY_NOTICES.md','docs/WORKLOG.md',
+ 'docs/OBS_EXPORT_AMD_NR_PLAN_2026-10-06.md','apps/veyra-qml/main.cpp',
+ 'src/engine/ExportJobManager.cpp','src/engine/EffectChain.cpp','include/veyra/engine/ExportJobManager.h',
+ 'src/pipeline/LmxxfNrBackend.cpp','include/veyra/pipeline/LmxxfNrBackend.h',
+ 'src/pipeline/EnhanceGraph.cpp','include/veyra/pipeline/EnhanceGraph.h',
+ 'src/ui/QmlPlayerBridge.cpp','include/veyra/ui/QmlPlayerBridge.h',
+ 'tests/integration/ExportWorkflowTests.cpp','tests/integration/LmxxfNrTests.cpp',
+ 'tests/integration/LmxxfCodecTests.cpp','tests/integration/LmxxfNrGraphTests.cpp','tests/unit/EffectChainTests.cpp'}
+prefixes=('scripts/acceptance/obs-export-amdnr-','scripts/amd-nr/','third_party/lmxxf/')
+changed=git('diff','--name-only',s['baseline']).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
+for e in s['inputs']:
+ assert hashlib.sha256(Path(e['copy']).read_bytes()).hexdigest()==e['sha256']
+if '--published' in sys.argv:
+ for e in s['published']:assert hashlib.sha256(Path(e['path']).read_bytes()).hexdigest()==e['sha256']
+print('GUARD PASS',len(s['preserved_worktrees']),'preserved worktrees;',len(set(changed)),'authorized paths')
diff --git a/scripts/acceptance/obs-export-amdnr-evidence.py b/scripts/acceptance/obs-export-amdnr-evidence.py
new file mode 100644
index 00000000..f583b434
--- /dev/null
+++ b/scripts/acceptance/obs-export-amdnr-evidence.py
@@ -0,0 +1,36 @@
+"""Freeze tested product inputs and audit preserved negative evidence without rewriting it."""
+from pathlib import Path
+import hashlib,json,subprocess,sys
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='obs-export-amdnr-20261006'
+LOG=BASE/'logs'/TASK;BUILD=BASE/'build'/TASK
+def sha(p):
+ with p.open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()
+def save(p,v):
+ assert not p.exists();p.write_text(json.dumps(v,ensure_ascii=False,indent=2)+'\n',encoding='utf8')
+before=json.loads((LOG/'export-before-v1.json').read_text(encoding='utf8'))
+text=(LOG/'export-before-v1.log').read_text(encoding='utf8',errors='replace')
+assert len(before['exports'])==2 and all(int(x['video']['nb_read_frames'])==60 for x in before['exports'])
+assert text.count('FIELD_EXPORT_DONE')==2 and 'FIELD_EXPORT_STARTED 2 ' in text and 'FIELD_UI_FAIL 22 ' in text
+assert 'source=0 generated=0 holds=0 encoded=0' in text
+save(LOG/'export-before-audit-v2.json',dict(passed=True,expectedNegative=True,
+ originalReceiptSha256=sha(LOG/'export-before-v1.json'),originalLogSha256=sha(LOG/'export-before-v1.log'),
+ explanation='Original assertion expected zero files; actual cases 0/1 succeeded, case 2 (two NR layers) failed before decoding. Original receipt retained unchanged.',
+ completedCases=2,failedCase=2,sourceExeSHA=before['sourceExeSHA']))
+good=['build-final-v4.json','amd-graph-before-v2.json','amd-graph-after-v1.json','units-after-v1.json','abi-after-v1.json',
+ 'field-stack-after-v2.json','field-single-final-v1.json','worker-mapping-reject-v2.json','lifecycle-final-v1.json',
+ 'lifecycle-boundary-final-v1.json','export-final-v2.json','obs-fractional-before-v4.json',
+ 'obs-fractional-after-v1.json','obs-normal-after-v1.json','export-before-audit-v2.json']
+for n in good:
+ r=json.loads((LOG/n).read_text(encoding='utf8'))
+ if isinstance(r,list):assert r and all(x['expectedPass'] for x in r),n
+ elif n.startswith('build'):assert r['exit']==0,n
+ else:assert r['passed'],n
+exe=sha(BUILD/'veyra_qml_ui.exe')
+for n in ['export-final-v2.json','obs-fractional-after-v1.json','obs-normal-after-v1.json']:
+ assert json.loads((LOG/n).read_text(encoding='utf8'))['sourceExeSHA']==exe,n
+assert '7 cases, 0 failures' in (LOG/'amd-graph-after-v1-veyra_amd_nr_graph_tests.log').read_text(encoding='utf8')
+names=subprocess.check_output(['git','ls-files','-z'],cwd=ROOT).decode('utf8').split('\0')
+product=[n for n in names if n and (n.startswith(('apps/','src/','include/','qml/','shaders/')) or n in ('CMakeLists.txt','CMakePresets.json'))]
+save(LOG/'tested-inputs.json',dict(executableSha256=exe,productInputs={n:sha(ROOT/n) for n in product},
+ testReceipts={n:sha(LOG/n) for n in good},localOnly=True,amdHipInferenceVerified=False,affectedObsMachineVerified=False))
+print('EVIDENCE PASS',len(product),'product inputs;',len(good),'receipts; final EXE',exe)
diff --git a/scripts/acceptance/obs-export-amdnr-package.py b/scripts/acceptance/obs-export-amdnr-package.py
new file mode 100644
index 00000000..5e2dad07
--- /dev/null
+++ b/scripts/acceptance/obs-export-amdnr-package.py
@@ -0,0 +1,79 @@
+"""Local candidates only; retain every approved runtime byte and corresponding source."""
+from pathlib import Path
+import hashlib,json,subprocess,sys,shutil,zipfile
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='obs-export-amdnr-20261006';VERSION='2.0.4-fix1'
+PACK=BASE/'test-packages'/TASK;BUILD=BASE/'build'/TASK;LOG=BASE/'logs'/TASK;ARCH=BASE/'archives'/TASK
+mode=sys.argv[1];assert mode in ('stage','finalize')
+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/obs-export-amdnr-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 reviewable local repair before final source snapshot'
+ 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
+ for rel in files:assert hashlib.sha256(z.read('Veyra-'+VERSION+'-source/'+rel)).hexdigest()==sha(ROOT/rel)
+ subprocess.run(['git','bundle','create',str(ARCH/'repair-final.bundle'),'f8045fb..HEAD'],cwd=ROOT,check=True)
+ with (LOG/'repair-final-bundle-verify.log').open('xb') as log:subprocess.run(['git','bundle','verify',str(ARCH/'repair-final.bundle')],cwd=ROOT,stdout=log,stderr=subprocess.STDOUT,check=True)
+delivery=[]
+for vendor in ('AMD','NVIDIA'):
+ source=BASE/'releases/publish-2.0.4-20261006/packages'/f'Veyra-2.0.4-{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=='stage':
+ shutil.copy2(BUILD/'veyra_qml_ui.exe',app/'veyra_qml_ui.exe')
+ for f in (BUILD/'shaders').rglob('*'):
+ if f.is_file():shutil.copy2(f,app/'shaders'/f.relative_to(BUILD/'shaders'))
+ shutil.copy2(ROOT/'docs/OBS_EXPORT_AMD_NR_PLAN_2026-10-06.md',app/'docs/OBS_EXPORT_AMD_NR_PLAN_2026-10-06.md')
+ (app/'REPAIR_TEST_2.0.4-fix1.md').write_text(
+ '# Veyra 2.0.4-fix1 本地修复候选\n\n'
+ '这是独立测试包,尚未合并 main 或发布。请在新目录解压,先不要混装旧 DLL。\n\n'
+ '修复:OBS/RTSS 软件 UI 禁用局部重绘;视频导出统一原生 NR 冻结链与参数、保留独立抗闪烁档位,并记录入口失败原因;AMD NR 修复合成阶段误判 NVIDIA 句柄导致的黑屏。\n\n'
+ '本机 RTX5070:真实界面四种导出(含两层 NR、4K)各 60 帧完整;AMD 合成用 GPU 恒等提供器覆盖 1/2/4 层、时域开关与 reset,绝不是 HIP 神经推理验收。RX9070 实卡仍需复测。\n\n'
+ 'OBS 本机未重现旧版拖影,修复版滚动像素检查通过,现场问题仍需确认。软件 UI 全重绘可能增加 CPU 绘制开销。\n\n'
+ 'AMD 包保留现有 lmxxf 运行库和权重原字节,不宣称 RDNA2/3 已支持。两个参考项目的固定版本与证据见 docs/OBS_EXPORT_AMD_NR_PLAN_2026-10-06.md。\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()}
+ expected={r['path'] for r in original['files']}|{'package-manifest.json','REPAIR_TEST_2.0.4-fix1.md','docs/OBS_EXPORT_AMD_NR_PLAN_2026-10-06.md'}
+ assert set(actual)-{'package-manifest.json'}==expected-{'package-manifest.json'}
+ 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='f8045fb53a7d800b053f0631a9b44dc9f5f1aacb',sourceCommit=head,sourceArchiveCommit=head,
+ worktreeDirty=dirty,localOnly=True,releaseReady=False,executableSha256=sha(app/'veyra_qml_ui.exe'),validationRecord='docs/OBS_EXPORT_AMD_NR_PLAN_2026-10-06.md',
+ hardwareValidation='RTX5070 native export and identity provider only; affected OBS machine and RX9070XT HIP inference 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'])
+ if mode=='finalize':manifest['correspondingSource'].update(application='../'+sourcezip.name,applicationSha256=sha(sourcezip),displayVersionOverride='-DVEYRA_DISPLAY_VERSION=2.0.4-fix1')
+ save(app/'package-manifest.json',manifest)
+ subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/obs-export-amdnr-audit.py'),str(app),vendor,mode+'-'+vendor],check=True)
+ 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/obs-export-amdnr-tests.py b/scripts/acceptance/obs-export-amdnr-tests.py
new file mode 100644
index 00000000..c32596af
--- /dev/null
+++ b/scripts/acceptance/obs-export-amdnr-tests.py
@@ -0,0 +1,45 @@
+"""Bounded real graph / actual worker regressions, never AMD inference claims."""
+from pathlib import Path
+import os,json,sys,subprocess,shutil,hashlib,time
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='obs-export-amdnr-20261006'
+label,case=sys.argv[1:3];out=BASE/'tests'/TASK/label;tmp=BASE/'tmp'/TASK/label;logs=BASE/'logs'/TASK
+out.mkdir(parents=True,exist_ok=False);tmp.mkdir(parents=True,exist_ok=False)
+app=BASE/'releases/publish-2.0.4-20261006/packages/Veyra-2.0.4-NVIDIA-win64-portable';build=BASE/'build'/TASK
+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')))
+results=[]
+if case.startswith('graph'):
+ targets=['veyra_amd_nr_graph_tests'];args=[]
+ 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=='units':targets=['veyra_effect_chain_tests','veyra_preset_library_tests','veyra_ui_i18n_tests'];args=[]
+elif case=='abi':
+ targets=['veyra_lmxxf_nr_tests'];args=[];shutil.copytree(build/'lmxxf-test-runtime',out/'lmxxf-test-runtime')
+elif case=='mapping-reject':targets=['veyra_qml_ui'];args=['--export-worker','1']
+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 t in targets:
+ exe=out/(t+'.exe');shutil.copyfile(build/exe.name,exe)
+ log=logs/(label+'-'+t+'.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
+ text=log.read_text(encoding='utf8',errors='replace')
+ good=rc==0
+ if case=='graph-before':good=rc==1 and 'layers=0 temporal=0' in text and text.count('pass=0')==6
+ if case=='mapping-reject':
+ workers=list((out/'logs').glob('export-worker-*.log'))
+ good=rc==1 and len(workers)==1 and 'mapping failed win32=' in workers[0].read_text(encoding='utf8',errors='replace')
+ results.append(dict(target=t,exit=rc,expectedPass=good,seconds=time.monotonic()-begin,exeSHA=hashlib.sha256(exe.read_bytes()).hexdigest(),log=str(log)))
+ print(t,rc,'expected',good);print('\n'.join(text.splitlines()[-9:]))
+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'])==({'lifecycle':20,'lifecycle-boundary':2}.get(case,60))
+(logs/(label+'.json')).write_text(json.dumps(results,indent=2),encoding='utf8')
+raise SystemExit(0 if all(x['expectedPass'] for x in results) else 1)
diff --git a/scripts/acceptance/obs-export-amdnr-ui.py b/scripts/acceptance/obs-export-amdnr-ui.py
new file mode 100644
index 00000000..95ab58d9
--- /dev/null
+++ b/scripts/acceptance/obs-export-amdnr-ui.py
@@ -0,0 +1,118 @@
+"""Own-process GUI export and GDI screenshots of the real software-rendered window."""
+from pathlib import Path
+import ctypes as C
+from ctypes import wintypes as W
+import os,sys,json,subprocess,shutil,time,re,hashlib
+from PIL import Image,ImageChops
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='obs-export-amdnr-20261006'
+label,case,version=sys.argv[1:4];out=BASE/'tests'/TASK/label;tmp=BASE/'tmp'/TASK/label;logs=BASE/'logs'/TASK
+for p in (out,tmp):p.mkdir(parents=True,exist_ok=False)
+app=BASE/'verify'/TASK/'ui-app'
+source=BASE/'releases/publish-2.0.4-20261006/packages/Veyra-2.0.4-NVIDIA-win64-portable'
+if not app.exists():shutil.copytree(source,app)
+exeSource=source/'veyra_qml_ui.exe' if version=='before' else BASE/'build'/TASK/'veyra_qml_ui.exe'
+shutil.copyfile(exeSource,app/'veyra_qml_ui.exe')
+if version!='before':
+ for f in (BASE/'build'/TASK/'shaders').glob('*'):
+ if f.is_file():shutil.copyfile(f,app/'shaders'/f.name)
+(out/'outputs').mkdir();(out/'screenshots').mkdir()
+main=app/'qml/Veyra/Main.qml';original=main.read_bytes();text=original.decode('utf8');at=text.rfind('}')
+fixture=ROOT/'scripts/acceptance/obs-export-amdnr-ui.qml';media=BASE/'tests/release-2.0.4-20261005/nr-fixture.mp4'
+injection='\nLoader{anchors.fill:parent;source:'+json.dumps(fixture.as_uri())+';onLoaded:{item.caseName='+json.dumps('obs' if case.startswith('obs') else 'export')+';item.media='+json.dumps(str(media))+'}}\n'
+main.write_text(text[:at]+injection+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',CUDA_CACHE_PATH=str(tmp/'cuda-cache'))
+if case=='obs-full':env['QSG_SOFTWARE_RENDERER_FORCE_PARTIAL_UPDATES']='0'
+if 'fractional' in label:env['QT_SCALE_FACTOR']='1.25'
+args=[str(app/'veyra_qml_ui.exe'),'--data-dir',str(out/'profile'),'--quit-after','260000','--export-out',str(out/'outputs')]
+if case!='native':args+=['--obs-game-capture']
+user=C.WinDLL('user32',use_last_error=True);gdi=C.WinDLL('gdi32',use_last_error=True);kernel=C.WinDLL('kernel32',use_last_error=True)
+kernel.OpenProcess.argtypes=[W.DWORD,W.BOOL,W.DWORD];kernel.OpenProcess.restype=W.HANDLE
+kernel.CloseHandle.argtypes=[W.HANDLE]
+kernel.GetProcessTimes.argtypes=[W.HANDLE,C.POINTER(W.FILETIME),C.POINTER(W.FILETIME),C.POINTER(W.FILETIME),C.POINTER(W.FILETIME)]
+user.GetDC.argtypes=[W.HWND];user.GetDC.restype=W.HDC;user.ReleaseDC.argtypes=[W.HWND,W.HDC]
+gdi.CreateCompatibleDC.argtypes=[W.HDC];gdi.CreateCompatibleDC.restype=W.HDC
+gdi.CreateCompatibleBitmap.argtypes=[W.HDC,C.c_int,C.c_int];gdi.CreateCompatibleBitmap.restype=W.HANDLE
+gdi.SelectObject.argtypes=[W.HDC,W.HANDLE];gdi.SelectObject.restype=W.HANDLE
+gdi.BitBlt.argtypes=[W.HDC,C.c_int,C.c_int,C.c_int,C.c_int,W.HDC,C.c_int,C.c_int,W.DWORD]
+gdi.DeleteObject.argtypes=[W.HANDLE];gdi.DeleteDC.argtypes=[W.HDC]
+user.GetClientRect.argtypes=[W.HWND,C.POINTER(W.RECT)]
+user.GetWindowThreadProcessId.argtypes=[W.HWND,C.POINTER(W.DWORD)]
+user.IsWindowVisible.argtypes=[W.HWND];user.GetDpiForWindow.argtypes=[W.HWND];user.GetDpiForWindow.restype=W.UINT
+class BIH(C.Structure):_fields_=[('size',W.DWORD),('width',W.LONG),('height',W.LONG),('planes',W.WORD),('bits',W.WORD),('compression',W.DWORD),('sizeImage',W.DWORD),('x',W.LONG),('y',W.LONG),('used',W.DWORD),('important',W.DWORD)]
+class BI(C.Structure):_fields_=[('header',BIH),('colors',W.DWORD*3)]
+gdi.GetDIBits.argtypes=[W.HDC,W.HANDLE,W.UINT,W.UINT,C.c_void_p,C.POINTER(BI),W.UINT]
+CALLBACK=C.WINFUNCTYPE(W.BOOL,W.HWND,W.LPARAM)
+def ownedWindow(pid):
+ found=[]
+ @CALLBACK
+ def cb(hwnd,unused):
+ actual=W.DWORD();user.GetWindowThreadProcessId(hwnd,C.byref(actual));rect=W.RECT()
+ if actual.value==pid and user.IsWindowVisible(hwnd) and user.GetClientRect(hwnd,C.byref(rect)) and rect.right>=1000 and rect.bottom>=600:found.append(hwnd)
+ return True
+ user.EnumWindows(cb,0)
+ if len(found)!=1:raise RuntimeError('Own main window count '+str(len(found)))
+ return found[0]
+def capture(pid,name,area):
+ hwnd=ownedWindow(pid);actual=W.DWORD();user.GetWindowThreadProcessId(hwnd,C.byref(actual));assert actual.value==pid
+ rect=W.RECT();assert user.GetClientRect(hwnd,C.byref(rect));w,h=rect.right,rect.bottom
+ dc=user.GetDC(hwnd);mem=gdi.CreateCompatibleDC(dc);bitmap=gdi.CreateCompatibleBitmap(dc,w,h);old=gdi.SelectObject(mem,bitmap)
+ assert gdi.BitBlt(mem,0,0,w,h,dc,0,0,0x00CC0020)
+ bits=C.create_string_buffer(w*h*4);info=BI();info.header=BIH(C.sizeof(BIH),w,-h,1,32,0,w*h*4,0,0,0,0)
+ assert gdi.GetDIBits(mem,bitmap,0,h,bits,C.byref(info),0)==h
+ image=Image.frombytes('RGB',(w,h),bits.raw,'raw','BGRX')
+ image.save(out/'screenshots'/(name+'.png'))
+ # The fixture sets logical width=1280; include QT_SCALE_FACTOR as well as
+ # the monitor DPI when mapping the inspector to physical client pixels.
+ scale=w/1280
+ x,y,aw,ah=area;crop=image.crop((round(x*scale),round(y*scale),round((x+aw)*scale),round((y+ah)*scale)))
+ crop.save(out/'screenshots'/(name+'-inspector.png'))
+ gdi.SelectObject(mem,old);gdi.DeleteObject(bitmap);gdi.DeleteDC(mem);user.ReleaseDC(hwnd,dc)
+ return crop
+console=logs/(label+'.log');shots={};seen=set();area=None;begin=time.monotonic();cpu=0;processHandle=None
+try:
+ with console.open('xb') as f:
+ p=subprocess.Popen(args,cwd=app,env=env,stdout=f,stderr=subprocess.STDOUT)
+ processHandle=kernel.OpenProcess(0x1000,False,p.pid)
+ while p.poll() is None:
+ if time.monotonic()-begin>270:p.kill();raise TimeoutError('Own GUI deadline')
+ time.sleep(.08)
+ for line in console.read_text(encoding='utf8',errors='replace').splitlines():
+ if line in seen:continue
+ seen.add(line)
+ if 'OBS_RECT' in line:
+ m=re.search(r'OBS_RECT (\{.*\}) ([\d.]+) ([\d.]+)',line);point=json.loads(m[1]);area=(point['x'],point['y'],float(m[2]),float(m[3]))
+ if 'OBS_BASE_READY' in line:shots['base']=capture(p.pid,'base',area)
+ if 'OBS_SCROLL_READY' in line:
+ m=re.search(r'OBS_SCROLL_READY (\d+) ([\d.]+)',line);shots['scroll-'+m[1]]=capture(p.pid,'scroll-'+m[1],area)
+ rc=p.returncode
+ if processHandle:
+ created,ended,systemCpu,userCpu=W.FILETIME(),W.FILETIME(),W.FILETIME(),W.FILETIME()
+ assert kernel.GetProcessTimes(processHandle,C.byref(created),C.byref(ended),C.byref(systemCpu),C.byref(userCpu))
+ cpu=((systemCpu.dwHighDateTime<<32)+systemCpu.dwLowDateTime+(userCpu.dwHighDateTime<<32)+userCpu.dwLowDateTime)/10000000
+finally:
+ main.write_bytes(original)
+ if processHandle:kernel.CloseHandle(processHandle)
+content=console.read_text(encoding='utf8',errors='replace');engine=Path(env['VEYRA_LOG_FILE']).read_text(encoding='utf8',errors='replace')
+result=dict(exit=rc,seconds=time.monotonic()-begin,processCpuSeconds=cpu,args=args,sourceExeSHA=hashlib.sha256(exeSource.read_bytes()).hexdigest(),version=version,case=case,area=area)
+if case.startswith('obs'):
+ comparisons=[]
+ for key in ('scroll-0','scroll-6','scroll-8'):
+ if key not in shots:continue
+ a,b=shots['base'],shots[key];assert a.size==b.size
+ diff=ImageChops.difference(a,b);different=sum(1 for px in diff.getdata() if max(px)>8)
+ comparisons.append(dict(frame=key,pixelsDifferentOver8=different,pixels=a.width*a.height,fraction=different/(a.width*a.height)))
+ diff.save(out/'screenshots'/(key+'-difference.png'))
+ result['comparisons']=comparisons;result['partialUpdatesDisabled']='partial updates disabled' in engine or case=='obs-full'
+ passed=rc==0 and 'OBS_DONE' in content and len(shots)>=10 and 'FIELD_UI_FAIL' not in content
+ if version!='before':passed=passed and result['partialUpdatesDisabled'] and all(x['fraction']<.005 for x in comparisons)
+else:
+ files=list((out/'outputs').glob('*.mp4'));result['exports']=[]
+ for file in files:
+ probe=json.loads(subprocess.check_output([shutil.which('ffprobe'),'-v','error','-count_frames','-show_streams','-of','json',str(file)],timeout=30))
+ video=next(x for x in probe['streams'] if x['codec_type']=='video');result['exports'].append(dict(path=str(file),video=video))
+ passed=rc==0 and 'FIELD_EXPORT_PASS' in content and len(files)==4 and all(int(x['video']['nb_read_frames'])==60 for x in result['exports'])
+ if version=='before':passed=rc==0 and 'FIELD_UI_FAIL' in content and len(files)==2 and content.count('FIELD_EXPORT_DONE')==2 and '[export-worker] finished' in engine
+result['passed']=passed
+(logs/(label+'.json')).write_text(json.dumps(result,ensure_ascii=False,indent=2),encoding='utf8')
+print(json.dumps(result,ensure_ascii=False));print('\n'.join(content.splitlines()[-4:]));raise SystemExit(0 if passed else 1)
diff --git a/scripts/acceptance/obs-export-amdnr-ui.qml b/scripts/acceptance/obs-export-amdnr-ui.qml
new file mode 100644
index 00000000..89057dae
--- /dev/null
+++ b/scripts/acceptance/obs-export-amdnr-ui.qml
@@ -0,0 +1,81 @@
+import QtQuick
+Item {
+ id:test
+ property string caseName:"obs"
+ property string media:""
+ property var appWindow:Window.window
+ property int phase:0
+ property int ticks:0
+ property int job:0
+ property int waitTicks:0
+ property var scroller:null
+ function findNamed(item,name){if(item.objectName===name)return item;for(const c of item.children||[]){const r=findNamed(c,name);if(r)return r}return null}
+ function require(v,s){if(!v)throw new Error(s)}
+ function findScroll(item){
+ if(item.visible&&typeof item.contentY==="number"&&item.contentHeight>item.height+50){const p=item.mapToItem(test.appWindow.contentItem,0,0);if(p.x>test.appWindow.width/2)return item}
+ for(const c of item.children||[]){const r=findScroll(c);if(r)return r}return null
+ }
+ Timer {
+ interval:200;running:true;repeat:true
+ onTriggered:{try{
+ ++test.ticks;test.require(test.ticks<1250,"250s deadline phase="+test.phase)
+ if(test.phase===0){
+ if(test.ticks<12)return
+ test.appWindow.width=1280;test.appWindow.height=800;test.appWindow.page="pro"
+ veyra.nodeMode=0;veyra.muted=true;veyra.nrEnabled=false;veyra.srEnabled=false;veyra.fgEnabled=false
+ if(!veyra.nrLayers.length)veyra.addEffect("nr")
+ veyra.setNrLayerParameter(veyra.nrLayers[0].index,"runtime",3)
+ test.waitTicks=0;test.phase=1
+ }else if(test.phase===1){
+ ++test.waitTicks
+ if(test.caseName==="obs"&&test.waitTicks===8){
+ const stage=test.findNamed(test.appWindow.contentItem,"list-nr-stage")
+ const layer=test.findNamed(test.appWindow.contentItem,"nr-card-1")
+ test.require(stage!==null&&layer!==null,"NR inspector cards missing")
+ stage.open=true;layer.open=true
+ }
+ if(test.waitTicks<16)return
+ if(test.caseName==="obs"){
+ test.scroller=test.findScroll(test.appWindow.contentItem);test.require(test.scroller!==null,"visible inspector scroll missing")
+ console.log("OBS_RECT",JSON.stringify(test.scroller.mapToItem(test.appWindow.contentItem,0,0)),test.scroller.width,test.scroller.height)
+ test.scroller.contentY=0;test.waitTicks=0;test.phase=2
+ }else{
+ veyra.exportCompletionSound=false;veyra.exportHevc=false;veyra.exportRateControl=1;veyra.exportBitrateMbps=12
+ test.phase=20
+ }
+ }else if(test.phase===2){
+ if(++test.waitTicks<8)return
+ console.log("OBS_BASE_READY",test.scroller.contentY)
+ test.waitTicks=0;test.phase=3
+ }else if(test.phase===3){
+ const sequence=[0,90,210,380,200,90,0,360,0]
+ const i=Math.floor(test.waitTicks/8);if(i>=sequence.length){test.waitTicks=0;test.phase=4;return}
+ if(test.waitTicks%8===0)test.scroller.contentY=Math.min(sequence[i],test.scroller.contentHeight-test.scroller.height)
+ if(test.waitTicks%8===6)console.log("OBS_SCROLL_READY",i,test.scroller.contentY)
+ ++test.waitTicks
+ }else if(test.phase===4){
+ if(++test.waitTicks<8)return
+ console.log("OBS_DONE");Qt.quit()
+ }else if(test.phase===20){
+ veyra.srEnabled=test.job===3;veyra.nrEnabled=test.job>0
+ const n=veyra.nrLayers[0].index
+ veyra.setNrLayerParameter(n,"sizePolicy",2)
+ veyra.setNrLayerParameter(n,"style",1);veyra.setNrLayerParameter(n,"total",2)
+ veyra.setNrLayerParameter(n,"correctionEnabled",1)
+ if(test.job===2){const d=veyra.duplicateNrLayer(n);test.require(d>=0,"second layer add");veyra.setNrLayerParameter(d,"style",2)}
+ if(test.job===3&&veyra.nrLayers.length>1)veyra.removeEffect(veyra.nrLayers[1].index)
+ veyra.addExportFiles([test.media]);test.phase=21;test.waitTicks=0
+ }else if(test.phase===21){
+ if(veyra.exportReadyCount<1)return
+ veyra.startExport();test.require(veyra.exportRunning,"start refused")
+ console.log("FIELD_EXPORT_STARTED",test.job,JSON.stringify(veyra.nrLayers));test.phase=22;test.waitTicks=0
+ }else if(test.phase===22){
+ if(veyra.exportRunning)return
+ test.require(veyra.exportItems.some(i=>i.state==="done"),"export failed "+JSON.stringify(veyra.exportItems))
+ console.log("FIELD_EXPORT_DONE",test.job,JSON.stringify(veyra.exportItems));veyra.clearFinishedExportItems()
+ if(++test.job<4){test.phase=20;return}
+ console.log("FIELD_EXPORT_PASS");Qt.quit()
+ }
+ }catch(e){console.error("FIELD_UI_FAIL",test.phase,e.message);Qt.quit()}}
+ }
+}
diff --git a/src/engine/EffectChain.cpp b/src/engine/EffectChain.cpp
index a1d5340a..fc3b5904 100644
--- a/src/engine/EffectChain.cpp
+++ b/src/engine/EffectChain.cpp
@@ -316,6 +316,7 @@ EffectChain toChain(const EnhancementSettings& settings) {
nr.nr.residual = layer.residual;
nr.nr.runtime = layer.runtime;
nr.nr.temporal = layer.temporal;
+ nr.nr.antiFlicker = layer.antiFlicker;
nr.nr.lowLatencyPairing = layer.lowLatencyPairing;
nr.nr.sizePolicy = layer.sizePolicy;
}
@@ -415,6 +416,7 @@ void fromChain(const EffectChain& chain, EnhancementSettings& settings) {
settings.residual = node.nr.residual;
settings.nrRuntime = node.nr.runtime;
settings.nrTemporal = node.nr.temporal;
+ settings.nrAntiFlicker = node.nr.antiFlicker;
settings.lowLatency = node.nr.lowLatencyPairing;
settings.nrPolicy = node.nr.sizePolicy;
}
diff --git a/src/engine/ExportJobManager.cpp b/src/engine/ExportJobManager.cpp
index dfc44962..9d8039d5 100644
--- a/src/engine/ExportJobManager.cpp
+++ b/src/engine/ExportJobManager.cpp
@@ -135,7 +135,14 @@ 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;s.settings.nrPolicy=pipeline::NrSizePolicy::Native;s.chain=toChain(s.settings);s.hevc=hevc;s.maxFrames=maxFrames;s.rateControl=uint32_t(rateControl);
+ 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;
+ s.chain=toChain(s.settings);fromChain(s.chain,s.settings);
+ s.hevc=hevc;s.maxFrames=maxFrames;s.rateControl=uint32_t(rateControl);
s.audioStreamIndex=audioStreamIndex;
s.trimStartSeconds=trimStartSeconds;s.trimEndSeconds=trimEndSeconds;
s.media=media;wcscpy_s(s.temporary,p_->snapshot.temporaryPath.c_str());
@@ -244,15 +251,32 @@ ExportJobSnapshot ExportJobManager::poll(){
if(p_->shared&&InterlockedCompareExchange(&p_->shared->messageLock,1,0)==0){if(p_->shared->message[0])p_->snapshot.message=p_->shared->message;InterlockedExchange(&p_->shared->messageLock,0);}if(p_->snapshot.message.empty()||p_->snapshot.state==ExportState::Paused)p_->snapshot.message=label(p_->snapshot.state);return p_->snapshot;
}
int runExportWorker(HANDLE mapping){
- auto s=static_cast<Shared*>(MapViewOfFile(mapping,FILE_MAP_ALL_ACCESS,0,0,sizeof(Shared)));if(!s)return 1;
- if(s->signature!=magic||s->version!=8||s->bytes!=sizeof(Shared)||!s->media.valid()||s->audioStreamIndex< -1||s->rateControl>uint32_t(sink::ExportRateControl::Cq)||!std::isfinite(s->trimStartSeconds)||!std::isfinite(s->trimEndSeconds)||s->trimStartSeconds<0||s->trimEndSeconds<0||(s->trimEndSeconds>0&&s->trimEndSeconds<=s->trimStartSeconds)||!s->settings.validate().empty()||s->input[32767]||s->output[32767]||s->temporary[32767]||!s->temporary[0]||s->priorCount>=kMaxExportParts){UnmapViewOfFile(s);CloseHandle(mapping);return 1;}
Logger::instance().openFile((runtime::logsDirectory()/std::format("export-worker-{}.log",GetCurrentProcessId())).wstring());
+ auto s=static_cast<Shared*>(MapViewOfFile(mapping,FILE_MAP_ALL_ACCESS,0,0,sizeof(Shared)));
+ if(!s){log::error("export-worker",std::format("mapping failed win32={}",GetLastError()));CloseHandle(mapping);return 1;}
+ auto reject=[&](const wchar_t* reason){
+ log::error("export-worker",utf8(reason));
+ if(s->signature==magic&&s->version==8&&s->bytes==sizeof(Shared)){
+ if(InterlockedCompareExchange(&s->messageLock,1,0)==0){
+ wcsncpy_s(s->message,reason,_TRUNCATE);
+ InterlockedExchange(&s->messageLock,0);
+ }
+ InterlockedExchange(&s->state,LONG(ExportState::Failed));
+ }
+ UnmapViewOfFile(s);CloseHandle(mapping);return 1;
+ };
+ if(s->signature!=magic||s->version!=8||s->bytes!=sizeof(Shared))return reject(L"导出任务通信协议不匹配");
+ if(const auto error=s->settings.validate();!error.empty()){
+ log::error("export-worker",std::format("invalid frozen settings: {}",error));
+ return reject(L"导出任务的增强参数无效,请查看任务日志中的具体参数错误");
+ }
+ if(!s->media.valid()||s->audioStreamIndex< -1||s->rateControl>uint32_t(sink::ExportRateControl::Cq)||!std::isfinite(s->trimStartSeconds)||!std::isfinite(s->trimEndSeconds)||s->trimStartSeconds<0||s->trimEndSeconds<0||(s->trimEndSeconds>0&&s->trimEndSeconds<=s->trimStartSeconds)||s->input[32767]||s->output[32767]||s->temporary[32767]||!s->temporary[0]||s->priorCount>=kMaxExportParts)return reject(L"导出任务的路径、剪辑、封装或轨道参数无效");
ExportStreams::enableWorkerLogging(GetEnvironmentVariableW(L"VEYRA_TEST_EXPORT_FFMPEG_DEBUG",nullptr,0)>0);
// The chain is the description of record for this job; the settings struct
// stays the runtime input until the executor consumes chains directly.
// 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){UnmapViewOfFile(s);CloseHandle(mapping);return 1;}}
+ 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;
std::thread monitor([&]{while(!done){if(InterlockedCompareExchange(&s->cancel,0,0))cancel=true;std::this_thread::sleep_for(std::chrono::milliseconds(10));}});
auto frameBoundary=[&]{
diff --git a/src/pipeline/EnhanceGraph.cpp b/src/pipeline/EnhanceGraph.cpp
index 6c5712e4..f3718859 100644
--- a/src/pipeline/EnhanceGraph.cpp
+++ b/src/pipeline/EnhanceGraph.cpp
@@ -2472,7 +2472,9 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
// not in a second loop after all layers have already evaluated.
auto compositeNrLayer = [&](size_t layerIndex) {
auto* layer=nrInstances_[layerIndex].get();
- if(layer->handle()==nullptr||!layer->enabled)return;
+ // AMD owns a ready lmxxf context rather than an NGX feature handle.
+ // Skipping this pass leaves the downstream fullTarget unwritten.
+ if((layer->handle()==nullptr&&(!layer->amd||!layer->amd->ready()))||!layer->enabled)return;
const bool temporallyStabilised=layer->stabilised;
ID3D12Resource* destination=temporallyStabilised?layer->temporal().raw():layer->fullTarget();
const auto& r=layer->residualSettings;
@@ -2596,6 +2598,8 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
tracker_.transition(list,layer->finalRgba(),D3D12_RESOURCE_STATE_COPY_DEST);
if(!layer->amd->recordOutputs(list,layer->finalRgba()))return false;
tracker_.transition(list,layer->finalRgba(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+ if(reset||!layer->historyValid)
+ veyra::log::info("amd-nr",std::format("layer={} linear output recorded; shared residual/temporal composite enabled input={}x{} target={}x{}",layerIndex+1,nrW,nrH,sourceW,sourceH));
gpuTimer_.mark(list,GpuStage::Nr,true);
gpuTimer_.mark(list,diagnostics::nrLayerStage(unsigned(layerIndex)),true);
++metrics_.nrEvaluateCount;layer->historyValid=true;layer->inputRevision=1;
diff --git a/src/pipeline/LmxxfNrBackend.cpp b/src/pipeline/LmxxfNrBackend.cpp
index b73dc6d8..7bb7432f 100644
--- a/src/pipeline/LmxxfNrBackend.cpp
+++ b/src/pipeline/LmxxfNrBackend.cpp
@@ -83,7 +83,14 @@ bool LmxxfNrBackend::recordInputs(ID3D12GraphicsCommandList* list, ID3D12Resourc
}
bool LmxxfNrBackend::enqueue() {
if (!job_.handle || enqueued_ || !result(api_.EnqueueHip(context_, job_.handle, queue_), "EnqueueHip")) return false;
- enqueued_ = true; return true;
+ enqueued_ = true;
+ if(!diagnosticsLogged_&&api_.GetStatus){
+ char status[4096]{};
+ if(api_.GetStatus(context_,status,sizeof(status))==LMXXF_NR_OK)
+ log::info("amd-nr",std::format("first enqueue session={} runtime={}",session_,status));
+ diagnosticsLogged_=true;
+ }
+ return true;
}
bool LmxxfNrBackend::recordOutputs(ID3D12GraphicsCommandList* list, ID3D12Resource* destination) {
if (!job_.handle || !enqueued_ || !list || !destination || !result(api_.RecordOutputs(context_, job_.handle, list), "RecordOutputs")) return false;
@@ -107,7 +114,7 @@ void LmxxfNrBackend::close() noexcept {
(void)result(api_.Drain(context_),"Drain"); (void)result(api_.Destroy(context_),"Destroy");
}
context_ = nullptr; queue_ = nullptr; job_ = {}; api_ = {}; caps_ = {};
- enqueued_ = outputsRecorded_ = false;
+ enqueued_ = outputsRecorded_ = diagnosticsLogged_ = false;
if (module_) FreeLibrary(module_); module_ = nullptr;
}
}
diff --git a/tests/integration/ExportWorkflowTests.cpp b/tests/integration/ExportWorkflowTests.cpp
index 308919bb..d975fa95 100644
--- a/tests/integration/ExportWorkflowTests.cpp
+++ b/tests/integration/ExportWorkflowTests.cpp
@@ -35,6 +35,22 @@ 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;
+ // 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.
+ if(mode.find(L"field-single")!=std::wstring::npos||mode.find(L"field-stack")!=std::wstring::npos){
+ settings.nr=true;settings.nrLayerCount=mode.find(L"field-stack")!=std::wstring::npos?2:1;
+ settings.nrRuntime=NrRuntime::NvidiaOriginal;
+ for(uint32_t i=0;i<settings.nrLayerCount;++i){
+ auto& n=settings.nrLayers[i];n.enabled=true;n.runtime=NrRuntime::NvidiaOriginal;
+ n.model.style=int(i);n.model.intensity=.8f;
+ n.temporal=true;n.antiFlicker=i?NrAntiFlicker::Static:NrAntiFlicker::FlowPlus;
+ n.sizePolicy=i?veyra::pipeline::NrSizePolicy::P720:veyra::pipeline::NrSizePolicy::Realtime;
+ n.residual.total=i?2.f:1.f;
+ }
+ settings.model.style=2;settings.nrPolicy=veyra::pipeline::NrSizePolicy::P480;
+ settings.flow=FlowQuality::Performance;settings.content=ContentRate::Transport;
+ }
if(mode==L"queue"){
std::filesystem::create_directories(output);
ExportQueue queue(manager);
diff --git a/tests/integration/LmxxfNrGraphTests.cpp b/tests/integration/LmxxfNrGraphTests.cpp
new file mode 100644
index 00000000..0f095ef9
--- /dev/null
+++ b/tests/integration/LmxxfNrGraphTests.cpp
@@ -0,0 +1,61 @@
+// SPDX-License-Identifier: GPL-3.0-only
+// Actual shared graph and shaders with a GPU identity provider. This checks
+// composition, chaining and reset, and does NOT execute HIP/AMD neural inference.
+#include "veyra/pipeline/EnhanceGraph.h"
+#include "veyra/gfx/D3D12DeviceContext.h"
+#include "veyra/gfx/CommandSlotRing.h"
+#include "veyra/sink/ImageExportSink.h"
+#include <iostream>
+#include <filesystem>
+#include <algorithm>
+extern "C" {
+#include <libavutil/frame.h>
+}
+using namespace veyra;
+int main(){
+ CoInitializeEx(nullptr,COINIT_MULTITHREADED);
+ gfx::D3D12DeviceContext ctx;gfx::CommandSlotRing ring;Status st=Status::Ok;
+ gfx::DeviceContextDesc device;device.enableDebugLayer=true;
+ if(!ctx.initialize(device,st)||!ring.initialize(ctx.device(),ctx.directQueue(),ctx.fence(),ctx.fenceEvent(),6,st))return 2;
+ AVFrame* frame=av_frame_alloc();frame->format=AV_PIX_FMT_RGBA;frame->width=128;frame->height=72;
+ 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(30+x);p[1]=uint8_t(40+y*2);p[2]=uint8_t(210-x);p[3]=255;
+ }
+ unsigned failures=0,checks=0;
+ sink::RgbaImage reference;
+ for(unsigned layers:{0u,1u,2u,4u})for(bool temporal:{false,true}){
+ if(!layers&&temporal)continue;
+ pipeline::EnhanceGraph graph(ctx,ring);pipeline::EnhanceGraphDesc gd;
+ gd.sourceWidth=gd.workWidth=128;gd.sourceHeight=gd.workHeight=72;
+ gd.rgbInput=true;gd.enableNr=layers>0;gd.enableSr=gd.enableFg=false;
+ gd.nrRuntime=engine::NrRuntime::LmxxfAmd;gd.nrMotion=engine::MotionSource::Zero;
+ gd.srMotion=gd.fgMotion=engine::MotionSource::Zero;
+ gd.runtimeAbsPath=std::filesystem::absolute("runtime/nvidia").wstring();
+ gd.nrLayersModel.resize(layers);gd.nrLayersResidual.resize(layers);
+ gd.nrLayersTemporal.assign(layers,temporal);
+ gd.nrLayersSizePolicy.assign(layers,pipeline::NrSizePolicy::P480);
+ gd.nrLayersExtent.assign(layers,{64,36});
+ bool ok=graph.initialize(gd)&&graph.createViews();
+ unsigned maximum=0;uint64_t rgbSum=0;
+ for(unsigned f=0;ok&&f<8;++f){
+ pipeline::EnhanceGraph::FrameOutputs out;sink::RgbaImage image;
+ ok=graph.process(frame,f*33.333,f==0||f==4,out,f+1)&&
+ sink::readRgba8(ctx,ring,graph.videoFrameResource(out.videoSlot),image);
+ if(ok&&!layers&&f==0)reference=image;
+ ok=ok&&image.width==reference.width&&image.height==reference.height&&image.pixels.size()==reference.pixels.size();
+ if(ok)for(size_t i=0;i<image.pixels.size();++i)if(i%4!=3){
+ rgbSum+=image.pixels[i];maximum=std::max(maximum,unsigned(std::abs(int(image.pixels[i])-int(reference.pixels[i]))));
+ }
+ ok=ok&&maximum<=1&&rgbSum>0;
+ }
+ ring.drainQueue();graph.shutdown();++checks;failures+=!ok;
+ std::cout<<"AMD_GRAPH_IDENTITY layers="<<layers<<" temporal="<<temporal
+ <<" maxCodeDifference="<<maximum<<" rgbSum="<<rgbSum<<" 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";
+ return failures?1:0;
+}
diff --git a/tests/unit/EffectChainTests.cpp b/tests/unit/EffectChainTests.cpp
index 9abbceeb..62863790 100644
--- a/tests/unit/EffectChainTests.cpp
+++ b/tests/unit/EffectChainTests.cpp
@@ -962,7 +962,22 @@ void testNrCorrectionDescription(){
check(d.nrLayersTemporal.size()==2&&!d.nrLayersTemporal[0]&&d.nrLayersTemporal[1],
"controlled history is allocated per active layer");
}
+void testPerLayerAntiFlickerSnapshot(){
+ using namespace veyra::engine;
+ for(uint32_t count:{1u,2u}){
+ EnhancementSettings settings;settings.nr=true;settings.nrLayerCount=count;
+ settings.nrTemporal=false;settings.nrAntiFlicker=NrAntiFlicker::Flow;
+ for(uint32_t i=0;i<count;++i){settings.nrLayers[i].enabled=true;settings.nrLayers[i].temporal=true;
+ settings.nrLayers[i].antiFlicker=i?NrAntiFlicker::Static:NrAntiFlicker::FlowPlus;}
+ const auto chain=toChain(settings);auto restored=settings;fromChain(chain,restored);
+ check(restored.nrLayer(0).usesTemporal()&&restored.nrLayer(0).antiFlicker==NrAntiFlicker::FlowPlus,
+ "single and stacked snapshots retain first layer anti-flicker tier");
+ if(count==2)check(restored.nrLayer(1).antiFlicker==NrAntiFlicker::Static,
+ "stacked snapshot retains independent second layer anti-flicker tier");
+ }
+}
int main() {
+ testPerLayerAntiFlickerSnapshot();
testNrCorrectionDescription();
std::setvbuf(stdout,nullptr,_IONBF,0);
testNodeEditorGraph();