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 field regressions and integrate experimental AMD NR runtime
Veyra Goal Agentc80662f34403
diff --git a/AGENTS.md b/AGENTS.mdindex e4cf6136..418ad16b 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -1,5 +1,7 @@# Veyra 项目 Agent 执行规则+> **2026-10-03 当前真人现场修复与升级授权**:用户明确要求 Xbox 无声/断开修复、lmxxf AMD RX 9000 NR 接入、导出码率回跳/设置无效修复、RTSS 兼容背景透明修复、取消 NVIDIA App 插件检测;先存档、写方案、创建分支再动手。仅在 `E:/项目/Veyra/worktrees/field-upgrade-20261003` / `codex/field-upgrade-20261003`(main `66cd3e5`)按 `docs/FIELD_UPGRADE_PLAN_2026-10-03.md` 实施。这五项必要 backend/NR/graph/source/QML/bridge/CMake/定向验收接点获本轮授权,覆盖对应历史冻结;无关链路不扩改。开工存档及标签见方案;旧桌面 guard/baseline、main、其他工作区、用户设置和已发布包保持。所有产物在 E 盘,不派子 Agent,不 merge/push/Release/删除旧 UI。单测试≤300秒、单构建≤900秒;现有运行库身份、patched FFmpeg 与源码/模型隔离不变,AMD/Xbox 实机未验如实记录。+> **2026-10-02 导出优化目标授权(用户:“开启目标模式搞定他”)**:按 `docs/EXPORT_PAGE_OPTIMIZATION_PLAN_2026-10-02.md` 在 `E:/项目/Veyra/worktrees/export-page-20261002` / `codex/export-page-20261002` 实现导出页布局、可编辑顺序队列、MKV/多音轨/内嵌字幕、取消重试及完成提示音,并做真实验收。本条仅解除该方案列出的导出后端、QML/bridge、必要 CMake 与定向测试接点的历史冻结;其他链路不改。每轮先执行本分支 `python -B scripts/acceptance/export-page-control.py`,不可变基线在 `E:/项目/Veyra/archives/export-page-20261002-start/scope-baseline.json`,不得修改旧桌面 guard/baseline。Claude 的其他工作区、主分支、已有候选与用户配置保持原样;专用 E 盘构建/测试/TEMP,不派子 Agent,不 commit/tag/merge/push/Release。单测试≤300秒,构建≤900秒;已有 runtime/patched FFmpeg 身份和源码隔离约束保持。> **2026-10-01 Moonlight(PC 串流)接入授权(用户:“不用,我有用户有双机,你就先干Moonlight吧,开工”;并同意下载官方源码、按阶段在新分支提交)**:在 `E:/项目/Veyra/worktrees/moonlight-20261001` 的新分支 `codex/moonlight-20261001`(从 `main` `09392c4` 开出)按 `docs/STREAMING_PLAN_MOONLIGHT_XBOX_2026-10-01.md` 与 `docs/MOONLIGHT_EXECUTION_2026-10-01.md` 实现串流核心:新增 `src/moonlight`、`include/veyra/moonlight`、`cmake/VeyraMoonlight.cmake`、`scripts/moonlight`、`tests/moonlight`,以及接入所必需的来源类、引擎/桥接/QML 接点;只接入串流核心,效果器沿用现有同一条处理链,不为串流另设预设或开关。PS5、采集卡等既有来源路径不改行为。已按用户授权从 GitHub 下载并固定两个官方源码到 `E:/项目/Veyra/deps/moonlight/`:moonlight-common-c `f900dd4767759c7b9d0e93bcea666b55c69ea62f`(含 enet `aca87840…`、nanors `b1e3c22c…`)与 moonlight-qt 浅克隆 `8369d1a0e11b999d4d1598f62ca5f6dea49602fb`(仅作移植参考,不编译)。**不下载、不安装、不连接 Sunshine 或任何主机**(用户明确“不用”,真机互通由用户的双机测试者验证);Xbox 仍只做调研。可在该分支按阶段 commit;不合并 main、不 push、不 Release、不碰桌面原目录。真机互通、4K60 实测与运动画面未验前,不得称 Moonlight 已通过。diff --git a/CMakeLists.txt b/CMakeLists.txtindex ce229e21..f5fe4e96 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -360,6 +360,7 @@ add_library(veyra_pipeline STATICsrc/pipeline/ColorGradeInstance.cppsrc/pipeline/ColorDetailPass.cppsrc/pipeline/NrInstance.cpp+ src/pipeline/LmxxfNrBackend.cpp)veyra_apply_warnings(veyra_pipeline)# FFmpeg/NVOF headers are third-party: /WX stays off for this target.@@ -370,6 +371,15 @@ target_compile_definitions(veyra_pipeline PUBLICVEYRA_SHADER_DIR="${CMAKE_BINARY_DIR}/shaders")target_include_directories(veyra_pipeline PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)target_link_libraries(veyra_pipeline PUBLIC veyra_base veyra_gfx d3d12 dxgi dxguid d3dcompiler)+add_library(veyra_lmxxf_fake_runtime SHARED tests/unit/LmxxfNrFakeRuntime.cpp)+target_compile_features(veyra_lmxxf_fake_runtime PRIVATE cxx_std_20)+target_compile_definitions(veyra_lmxxf_fake_runtime PRIVATE LMXXF_NR_RUNTIME_EXPORTS NOMINMAX WIN32_LEAN_AND_MEAN)+target_link_libraries(veyra_lmxxf_fake_runtime PRIVATE d3d12 dxgi dxguid)+set_target_properties(veyra_lmxxf_fake_runtime PROPERTIES OUTPUT_NAME LmxxfNrRuntime RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lmxxf-test-runtime")+add_executable(veyra_lmxxf_nr_tests tests/unit/LmxxfNrTests.cpp)+target_compile_features(veyra_lmxxf_nr_tests PRIVATE cxx_std_20)+target_link_libraries(veyra_lmxxf_nr_tests PRIVATE veyra_pipeline)+add_dependencies(veyra_lmxxf_nr_tests veyra_lmxxf_fake_runtime)add_dependencies(veyra_pipeline veyra_shader_color_grade veyra_shader_color_detail_reduce veyra_shader_color_detail_blur veyra_shader_color_detail_apply)add_executable(veyra_pipeline_testsdiff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.mdindex ffe853b3..0d9143d4 100644--- a/THIRD_PARTY_NOTICES.md+++ b/THIRD_PARTY_NOTICES.md@@ -652,3 +652,22 @@ an unbounded metadata queue. These CPU timestamps do not claim physical scanout.## NVIDIA original NR restored in 2.0.2The user-approved, unmodified NVIDIA-signed 310.8.0.0 NR (SHA256 E16BCF15E16E13F527491CDF7845B2FE6521A738D8F7C9C721866A8496E1FC8E) is distributed only as a release runtime at runtime/experimental/nr-original/nvngx_dlssnr.dll. Existing community Lecram/SF-v2 choices and notices remain. See docs/RUNTIME_COMPONENTS_2.0.2.md and the publisher manifest. This experimental integration is not NVIDIA certification or complete official DLSS 5 support. No proprietary binary has been added to source Git.++## lmxxf AMD NR local integration (2026-10-03)++Veyra calls the independent MIT C ABI from+[lmxxf/dlss5-on-amd-9070xt-porting](https://github.com/lmxxf/dlss5-on-amd-9070xt-porting),+fixed commit `78f548749e74824327b8458c57be31a1df78376a`, Copyright (c) 2026 Kien.+The unchanged public header, original MIT license and adaptation details are in+`third_party/lmxxf/`. The runtime build uses upstream codec/network code directly;+Veyra's GPL host adapter records producers/consumers on the existing D3D12 queue.+It does not load a ReShade add-on or copy Magpie's player/loop.++The user supplied `Magpie-DLSS5-AMD-0.39.zip` (SHA256+`9ea84c665d270cd45e24184729b8272c152485df462a1528539ed778d41849f5`).+Its NVIDIA-derived model weights are **not** MIT-licensed code. All weights,+compiled HIP modules and runtime DLLs stay outside source Git; their use in this+local candidate does not authorize a public release. HIP API license and the+runtime MIT notice accompany the local asset directory. No AMD driver DLL is+copied from that package; an RX 9000 driver must provide `amdhip64_7.dll`.+Hardware inference, image quality and stability remain unverified on RX 9000.diff --git a/apps/veyra-qml/main.cpp b/apps/veyra-qml/main.cppindex d167b854..a73e9562 100644--- a/apps/veyra-qml/main.cpp+++ b/apps/veyra-qml/main.cpp@@ -582,6 +582,7 @@ static int runApplication(int argc, char** argv, QString& restartProgram, QStrin});QQmlApplicationEngine engine;+ engine.rootContext()->setContextProperty(QStringLiteral("vySoftwareUi"), softwareUi);auto* thumbnails = new ui::ThumbnailProvider;engine.addImageProvider(QStringLiteral("veyra-thumb"), thumbnails);QObject::connect(&bridge, &ui::QmlPlayerBridge::thumbnailSourceChanged, &app,diff --git a/docs/AMD_NR_INTEGRATION_2026-10-03.md b/docs/AMD_NR_INTEGRATION_2026-10-03.mdnew file mode 100644index 00000000..ff1a6fb6--- /dev/null+++ b/docs/AMD_NR_INTEGRATION_2026-10-03.md@@ -0,0 +1,69 @@+# AMD RX 9000 NR 接入记录(2026-10-03)++## 来源与资源++独立运行时来自 [lmxxf 官方仓库](https://github.com/lmxxf/dlss5-on-amd-9070xt-porting),+固定 `78f548749e74824327b8458c57be31a1df78376a`。源码 MIT;权重不因此获得 MIT 许可。+只复制公开 C ABI header 和 MIT 原文到 Git。独立 DLL 用该提交的原始 codec/HIP+实现编译;MSVC 适配仅为 NOMINMAX、noinline 注解和 user32 链接,见+`scripts/amd-nr/build-lmxxf-runtime.py` 与 `third_party/lmxxf/VEYRA_ORIGIN.md`。++用户提供 `C:/Users/123/Downloads/Magpie-DLSS5-AMD-0.39.zip`,340434944 bytes,+SHA256 `9ea84c665d270cd45e24184729b8272c152485df462a1528539ed778d41849f5`。+740 个文件项,739 个有包内 SHA256 记录的文件全部匹配。+其中模型权重 186 个(122 f16 + 64 f32),索引映射 2 个 i32,+HIP 内核 62 个(gfx1200、gfx1201 各 31)。不加载包内 Magpie.exe、dxgi.dll+或 dlss5-amd.addon64;不在磁盘修改 NVIDIA/AMD 驱动或运行库。++原解压:`E:/项目/Veyra/deps/magpie-amd-039-20261003`;+宿主资源:`E:/项目/Veyra/deps/veyra-amd-nr-039-20261003`;+独立 DLL:`E:/项目/Veyra/build/lmxxf-runtime-20261003/LmxxfNrRuntime.dll`。+包审计:`E:/项目/Veyra/logs/field-upgrade-20261003/amd-039-archive.json`。+运行时逐文件审计在宿主资源的 `amd-nr-local-manifest.json`。++## 共享图接入与兼容++- NR runtime ID 4 为 lmxxf;旧 NVIDIA 0/2/3 编号不变。+- AMD 卡默认选择 lmxxf NR、AMD 光流和已有 FSR SR;效果仍默认关闭。+ 保存的 NVIDIA 光流选择在 AMD 图中解析到 AMD 光流,不访问 NVOF。+- 每个共享 `NrInstance` 拥有一个独立 runtime context;输入为同尺寸稳定的+ linear RGBA16F。运行时负责 encode/network/decode,Veyra 接着执行共享残差、+ 保护、抗闪烁与输出,不复制播放器或另写网络。+- 绝对路径 `runtime/amd-nr/LmxxfNrRuntime.dll`,资产在同级 `assets`;+ LoadLibraryExW 限制 DLL directory/System32 搜索。C ABI 1 的表大小+ 144/136、FrameInfo 104/80 可协商;缺函数表、创建/准备/执行失败均记录。+- producer 录制/提交 → 同一 direct queue 的 HIP enqueue → consumer 录制/提交+ → Retire。Retire 在输出 reader 提交后执行,不能提前释放或复用输出。+ 图退出先排空队列、释放 runtime,再释放借用输入与 queue。+- host 不添加逐帧 CPU fence 等待。上游首次准备、资源更换和 teardown 可等待;+ 实际 HIP 时序/耗时尚未在本机测量,不能将 identity-copy 测试当成 HIP 性能。+- 环境 `DLSS5_CODEC_SRGB=1` 拒绝(Veyra 是线性输入);运行时的 ResetHistory+ 当前无网络历史重置实现,因此有 `DLSS5_VIT_ADAPTIVE!=0` 环境时拒绝。+ 不偷偷改变全局环境。默认无网络跨帧复用,Veyra 自身 history 正常 reset。+- 上游 0.40 runtime 明确支持旧内核目录,缺可选内核则关闭该优化;本地采用+ 用户 0.39 的内核选择和 skip/style 配置,FAST_NUMERIC=0。codec shaders 使用+ 与 C++ 同一固定提交,HIP/权重原样,生成相对路径 HIP/SHA256SUMS。++## 已知功能边界++公开 ABI 接受高度 ≤1080、总像素 ≤1920×1080、宽度 ≤2560(可容纳部分超宽)。+AMD NR 的 UI 只提供 480/720/900/1080 内部档;列表与节点共用该编辑器。+预览可降采样后再回到目标输出尺寸。当前图片/视频导出按产品原生 NR 合同处理,+超出预算明确拒绝;**没有原生 1440p/4K AMD NR 导出**。不改成隐形降采样来冒称原生。+HDR 输入也明确拒绝,避免把未经验证的 codec 结果当作 HDR 增强。+tone/structure/skin/autoMask/uiCorrection 不在此 C ABI 支持范围,AMD UI 隐藏这些+NVIDIA 专用控件;模型强度通过 transfer_strength,style 使用运行时配置。++## 本机证据与复现++1. `build-lmxxf-runtime.py --source E:/项目/Veyra/deps/lmxxf-nr-20261003 --build E:/项目/Veyra/build/lmxxf-runtime-20261003 --tmp E:/项目/Veyra/tmp/field-upgrade-20261003 --log E:/项目/Veyra/logs/field-upgrade-20261003/lmxxf-recipe.log`:MSVC 编译成功。+2. `prepare-local-runtime.py --package E:/项目/Veyra/deps/magpie-amd-039-20261003 --source E:/项目/Veyra/deps/lmxxf-nr-20261003 --dll E:/项目/Veyra/build/lmxxf-runtime-20261003/LmxxfNrRuntime.dll --out E:/项目/Veyra/deps/veyra-amd-nr-039-20261003`:739 hashes、62 modules、真实 DLL 的 API/capabilities/module layout 通过。没有执行网络。+3. `veyra_lmxxf_nr_tests`:62 checks,0 failures;独立 identity GPU-copy+ provider 验证新/旧 ABI、同队列调用顺序、reader 后 retire、12 帧 allocator+ 复用、缺库/坏函数表/错误环境/失败 enqueue 拒绝。此测试 DLL 不进入候选。+4. RTX 5070 的真实 NR+SR 4K NVENC 导出通过,NVIDIA 路线保持可用。++本机无 RX 9000,System32 也没有 amdhip64_7.dll。没有证明 AMD 真正推理、颜色、+画质、性能、多实例显存、长期稳定或 RX9060 通过。下一步实卡按 720/900/1080、+源切换/seek/暂停恢复/resize、多层 NR、与 FSR SR/FG 组合分别验证;初始化日志、+真实输出与无设备移除必须同时取得。当前是有完整资产的本地实验接入。diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.mdindex e2336b47..7456c14f 100644--- a/docs/CURRENT_STATUS.md+++ b/docs/CURRENT_STATUS.md@@ -1,5 +1,16 @@# 当前项目状态 / Current Status+## 2026-10-03 五项问题修复:独立本地候选++分支 codex/field-upgrade-20261003,已先存档写方案。修复 Xbox 音频输出线程未+启动,加入按原因的有界重连;修复码率提交/回跳与范围;修复软件 UI 背景透明;+删除 NVIDIA App 模块存在性误判。AMD RX9000 NR 的独立 MIT runtime 接入共享+图,用户 0.39 模型/HIP 完整资产已补齐。真实 RTX5070 NVENC 导出、RTSS 下软件+背景、39 项 QML、本地 Xbox/音频、AMD C ABI 测试通过。真实 Xbox 有声/长稳、+RX9000 推理未验;AMD 当前限 1080p 像素预算,HDR/原生 4K NR 导出未支持。+详见 FIELD_UPGRADE_ACCEPTANCE_2026-10-03.md。未合并 main、推送或发布,+下面 2.0.2 已发布记录仍是公开版本事实。+## 2026-10-03 2.0.2 已发布(最新)[正式 Release](https://github.com/Likely7/Veyra-NRVideo/releases/tag/v2.0.2),tag/source `0dafc57`,已合并并推送 nrvideo/main,latest/公开/一个便携 ZIP。三版 NR、Claude RTSS 兼容、Codex Xbox/VRR/倍速/启动恢复全部包含;英文首页、中文切换、双语 Release 与支持二维码已远端核对。最终包 1520 文件审计、干净解压实跑和远端 SHA256 一致。完整身份与验证在 WORKLOG 最新节;以下准备/未发布状态均为历史。用户现场显存根因与 Xbox/VRR 实卡边界没有冒称通过。diff --git a/docs/FIELD_UPGRADE_ACCEPTANCE_2026-10-03.md b/docs/FIELD_UPGRADE_ACCEPTANCE_2026-10-03.mdnew file mode 100644index 00000000..f268b431--- /dev/null+++ b/docs/FIELD_UPGRADE_ACCEPTANCE_2026-10-03.md@@ -0,0 +1,61 @@+# 五项修复本地验收(2026-10-03)++分支 `codex/field-upgrade-20261003`,起点 main `66cd3e5`。先建立+`checkpoint/pre-field-upgrade-20261003`、Git bundle/桌面修改存档及施工方案,+再修改产品。未合并、推送或公开发布。++## 修复与证据++| 项目 | 实现与本机结果 | 尚未验证 |+|---|---|---|+| Xbox 无声音 | configure 48k stereo float 后未启动输出线程;改为 configure + start,记录 Opus 首块与启动结果。真实 WASAPI 链 250 个 20ms float 块通过。 | 测试 gain=0,不证明主机声音已听到;需真实 Xbox 有声验收。 |+| Xbox 断开 | 日志 16 持续约 17 分钟后收到 KickForServerShutdown。保留具体 reason,网络丢失/服务器关闭/过期最多 3 次重连,1/2/3 秒退避,可取消;30 秒连续解码才恢复额度,重连原子 reset 图历史。 | 本地 ICE/DTLS/SCTP/RTP peer 90 checks 通过;无 Xbox 长稳测试,不能阻止服务端关闭或保证 Wi-Fi 永不丢包。 |+| AMD NR | MIT 独立 runtime、共享 NR 图及按 GPU 的 UI 接入;用户 0.39 包校验通过,186 权重/2 映射/62 HIP 核补齐,真实 DLL API 和模块布局验证通过。 | RTX5070 无 RX9000 HIP 推理/画质/性能/长稳实测;仅 1080p 像素预算,HDR/原生 4K AMD NR 导出未支持。 |+| 导出码率 | 有效键入即时提交,草稿不受其他 exportChanged 覆盖,统一 1–300 Mbps,具体 validate 错误和冻结参数入日志。真实 bridge/worker/NVENC 的两种复现均通过。 | 本机驱动 616.56;用户 616.92 未直接测试。 |+| RTSS 透明背景 | 软件绘制用 Rectangle/Image,Window 不透明;真实 RTSS 7.3.7 自动兼容,RTSSHooks64 已注入,截图深色 alpha=255。 | 未枚举全部 RTSS/OBS 版本、注入组合与显示配置。 |+| NVIDIA 插件误判 | 删除 nvppex/NvPresent 风险分类、检测与崩溃归因;旧 device/nvppex marker 不再触发 NVIDIA App 提示,真实 GPU 错误仍记录。 | 不宣称所有第三方插件安全;不再只凭模块存在判断崩溃。 |++## 自动测试与真实导出++- Fresh 工作树编译与最终增量成功:+ `E:/项目/Veyra/logs/field-upgrade-20261003/build-final-contracts.log`。+- `E:/项目/Veyra/tests/field-upgrade-20261003/final/summary.json`:Qt Quick+ 39 passed,Xbox loopback 90 checks,WASAPI float output passed,AMD ABI/identity+ GPU-copy 62 checks,全部 0 failure。测试 provider 没有 HIP/NR,不随候选分发。+- 音频:48k float stereo、5 秒 250 个 20ms 块;视频 RTP epoch 与音频从零 PTS+ 不同时走现有 video-arrival fallback(35ms),未伪造同一时钟域。+ 缓冲计数不是扬声器/屏幕端到端延迟,gain=0 无可听证据。+- `field-upgrade-ui.py rtss --rtss` 在 RTX5070 / 616.56 通过。+ 输入 2560×1440、30fps、MPEG-4 Part 2 的 AVI,0.8 秒、24 帧;NR 启用、+ RTX Video SR quality 4、目标 4K HEVC。导出仍依原生 NR 合同执行,+ 不将预览的 1080p 内部档冒称导出已降采样。+- 输入 18 Mbps VBR 后改 HEVC/4K/容器再开始,第二份输入 24 Mbps CBR 直接+ 开始,均成功输出 24/24 帧、3840×2160 HEVC。worker encoder 收到 18/24,+ 启动后 UI 改为 7/8 不改变冻结任务。日志/ffprobe:+ `E:/项目/Veyra/logs/field-upgrade-20261003/production-rtss/`。+- 短片 ffprobe 平均约 20.745/27.311 Mbps。VBR 随复杂度变化,CBR 启动/缓冲+ 受短样本影响;本次证明设置到达编码器,不保证实际平均数逐位等于目标。+- RTSS 截图在+ `E:/项目/Veyra/tests/field-upgrade-20261003/production-rtss/software-background.png`,+ 背景取样 (37,37,41,255)、(16,16,20,255)、(8,8,10,255)。三档背景像素检查+ 也在 Qt Quick 回归中。只关闭本轮启动的 RTSS,未编辑用户 RTSS/OBS 配置。+- Source guard 和 git diff --check 通过。旧 delivery.ps1 明确仅支持 legacy+ Win32,QML 用以上定向生产测试,不把旧 gate 当通过。++## 失败修复与边界++初次 AMD adapter 编译发现 st 作用域,已修复。MSVC 对上游 GNU noinline、+Windows min/max、user32 需显式适配,版本化 recipe 重建成功(lmxxf-recipe.log)。+Qt 测试初次进程路径/Unicode argv0/offscreen plugin 失败,改为绝对 executable++ 相对 argv0、明确 Qt platform plugin 路径后通过;不把失败计为通过。+最初 0.40 下载尚无链接、0.39 镜像未取得,用户 zip 已补齐该缺口。+RTSS 普通启动需提升,本轮以当前用户 RunAsInvoker 启动测试副本,成功注入,+没有提权或修改系统配置。没有 RX9000 或真实 Xbox 的验收,不冒称全型号稳定。++## 本地候选++输出 `E:/项目/Veyra/test-packages/field-upgrade-20261003/`;软件版本仍为 2.0.2,+候选名称带 field 标识。AMD 放 runtime/amd-nr,独立 manifest/许可证随包;+原 2.0.2 的 43 个增强运行组件沿用原件身份。没有 SDK、测试替身、PDB、测试媒体、+凭据或用户配置。最终包审计/干净启动在 WORKLOG 补记;硬件未验与 AMD 功能+边界随包保留,源码/模型/运行库继续隔离。本轮未授权公开资产上传。diff --git a/docs/FIELD_UPGRADE_PLAN_2026-10-03.md b/docs/FIELD_UPGRADE_PLAN_2026-10-03.mdnew file mode 100644index 00000000..cdb75d61--- /dev/null+++ b/docs/FIELD_UPGRADE_PLAN_2026-10-03.md@@ -0,0 +1,51 @@+# 2.0.2 现场问题修复与 AMD NR 接入方案++用户 2026-10-03 请求五项工作:Xbox 无声音和运行后断开;接入 lmxxf 的 AMD RX 9000 NR;导出码率编辑回跳和设置无效;小飞机兼容模式背景透明;取消截图中的 NVIDIA App 插件检测。先存档、写方案、创建分支,再修改产品。此授权仅覆盖这些问题的必要后端、QML、构建和定向验收接点,不继续历史 UI migration 队列。++## 开工基线与隔离++- 基于已发布 2.0.2 的本地 main `66cd3e50590766e5a654528ab61e491dc4d30c83`,新分支 `codex/field-upgrade-20261003`。+- 工作区 `E:/项目/Veyra/worktrees/field-upgrade-20261003`。桌面旧迁移工作区及其它工作区保持原样。+- 开工存档 `E:/项目/Veyra/archives/field-upgrade-20261003-start`:全引用 Git bundle(已 verify)、桌面 tracked binary diff/index diff、未跟踪源码、状态和 SHA256 清单;标签 `checkpoint/pre-field-upgrade-20261003` 指向上述 main。首次 PowerShell 的 git --output 参数解析失败,已在产品修改前重新生成并核对 working patch 258615 bytes、index patch 0 bytes。+- 输入证据复制到 `E:/项目/Veyra/logs/field-upgrade-20261003/inputs`,原微信日志和截图不改、不提交。+- 新建构建、tests、logs、tmp、候选包都使用 `E:/项目/Veyra/<用途>/field-upgrade-20261003`。每个测试最多 300 秒,单次构建最多 900 秒;仅对子进程设置 TEMP/TMP。+- 旧桌面 scope guard 固定旧目录、旧分支和已过期 main;本轮独立授权与分支不使用它证明通过,也不修改旧 guard/baseline。每片修改和测试前检查新分支文件范围。+- 不派子 Agent;不合并 main、不 push、不发布、不删除旧 UI,不改变用户设置或 RTSS/OBS 配置。开工标签为用户明确要求的存档,代码先保留为可审查 diff。++## 已确认事实与待证假设++1. 日志 16/17 存在 Xbox `WNSError / WaitingForServerToRegister`,也有成功完成 ICE/DTLS/SCTP、握手和持续视频的会话。前者是服务端主机注册失败,不能靠本地重试隐藏成成功。日志 2 的文本只有 `device / nvppex.dll`,只证明出错时该模块在进程里,不能证明它造成错误。+2. Xbox 音频现有代码按解码样本数从零生成 PTS,视频按 90 kHz RTP 生成 PTS;需要核对共享实时音频入口是否要求视频时钟域。还需验证 RTCP 接收统计、反馈发送和关闭回调,不能只延长超时称稳定。+3. 导出 UI/bridge 接受 0–2000 Mbps,而 `EnhancementSettings::validate` 上限 300 Mbps;`VTextField` 只在 editingFinished 提交,exportChanged 会刷新文字绑定。两个缺陷都需真实交互复现;VBR 的实际平均码率不保证等于目标,不能单凭约 7000 kbps 断言编码器没接码率。+4. `Main.qml` 窗口透明;背景 `VBackdrop.qml` 使用 Qt Quick Shape/纹理填充。RTSS/OBS 兼容会切到软件 UI,必须检查其不支持的绘制节点,提供可见、不透明的背景路径,保留单一 D3D12 视频窗口。+5. NVIDIA App 注入模块目前会在设备失败/上次失败后推断原因并提示。按用户要求删除这类检测和因果提示;保留真实 D3D12 错误及 RTSS 必需的兼容模式选择。++## 施工顺序与验收++### A. 导出码率++逐键提交有效输入,防止无关 exportChanged 覆盖正在编辑的文字;范围与后端 1–300 Mbps 一致,空输入/非数字不得静默生成无效设置。开始导出前使用同一份已提交参数冻结任务;错误显示具体验证原因。检查输入后切编码/容器/分辨率/质量/预设、直接点击开始、离开页面重回、CBR/VBR/CQ 切换、300 边界及超界输入。用产品短片导出记录 worker 实际 rateControl/bitrateMbps,再用 ffprobe 核对输出,区分目标和实测码率。++### B. RTSS 背景和 NVIDIA 检测++软件 UI 提供普通 Rectangle/Image 背景,不依赖 GPU Shape/MultiEffect;各页面和极简/全屏、不同背景强度不出现桌面透出。GPU UI 保持原有圆角背景。删除 NVIDIA App 插件检测、旧 marker 引发的该类提示和“已知会崩溃”的归因文字,真实 GPU 故障仍按实际错误报告。RTSS Auto/Off 和 OBS 兼容开关做交互截图;不更改外部软件配置。++### C. Xbox 音频和会话++先从日志建立会话时间线,再对照已固定的 Greenlight/libdatachannel 源码查协议。音频加入包计数、Opus 错误、配置/输出计数和时钟域诊断;修正已证实的 RTP/实时音频域或处理链缺陷。网络失败、服务端拒绝、视频处理失败分开记录;RTCP/心跳/反馈必须依据协议并用真实本地 peer 验证。保留有界队列、关闭期间不抛异常、不回调已释放对象,音频不因 GPU 慢而停摆。自动重连若必要,限制次数并显式显示,不无界重试。单测试 300 秒以内;真实 Xbox 长稳和声音须由持机反馈验证,不冒充本机已验。++### D. AMD RX 9000 NR++已定位上游 `https://github.com/lmxxf/dlss5-on-amd-9070xt-porting`(用户写作 Imxxf/MTI)。获取官方源码到 E 盘 deps,固定 commit 和 MIT 原文;核对 `include/LmxxfNrApi.h` 的 standalone Runtime API、GPU 架构、D3D12/HIP 互操作、输入颜色/codec、异步 fence 与会话销毁规则。优先调用上游独立 Runtime,禁止依赖 ReShade/游戏注入,禁止另造网络。源码 MIT 不代表 NVIDIA 衍生权重也属 MIT;权重、HIP 模块/SDK/Runtime 均不进源码 Git,也不未经身份和来源记录加入公开包。++AMD 后端接入共享 NR 实例和图,列表/节点/图片/视频导出一致;保留 NVIDIA 路线,按 GPU/Runtime 能力选择。RX 9000 的 gfx1200/gfx1201、同一 D3D12 设备与 HIP 设备对应、缺失 DLL/模型、API 版本不匹配、创建/执行失败、resize/reset/多实例/源切换都需显式处理。不让 AMD 卡尝试 NVIDIA NGX/NVOF;既有 FSR SR/FG 保持。若上游契约无法满足现有同步/颜色/授权边界,记录具体缺口,不用接口桩或 UI 开关冒充接入。当前只有 RTX 5070,AMD 真正推理和性能/画质必须标未验,软件模拟 ABI 测试仅证明宿主契约。++## 交付记录++每片在本文件和 WORKLOG 记录修改符号、实际命令、结果、失败修复与证据路径。构建统一当前分支产物,针对性 unit/QML/本地 WebRTC/短片 GPU 导出及非 AMD 回归通过后生成独立本地候选。结束核对 source Git 没有 SDK/DLL/模型、main/桌面原状态未改,保存最终 diff 和源码证据。未运行或无对应硬件的项目明确列出,禁止将编译、上游声明或本地 peer 当作 Xbox/RX 9000 实机通过。++当前状态:必要代码与本机回归已完成。Xbox 输出线程与有界重连已实现;导出与+真实 RTSS 软件绘制通过;AMD 独立运行时和用户 0.39 完整资产已接入。RX9000+推理、真实 Xbox 有声/长稳仍待实机;原生 4K AMD NR/HDR 未支持。证据见+`FIELD_UPGRADE_ACCEPTANCE_2026-10-03.md` 和 `AMD_NR_INTEGRATION_2026-10-03.md`。+只生成本地候选,不发布。diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex 1e91c95e..67334dc3 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -1,5 +1,29 @@# Veyra 工作记录+## 2026-10-03 五项修复:代码与本机验收++- 补充回归 `python -B scripts/acceptance/field-upgrade-tests.py ui-final qml-software ui-i18n nr-preset-persistence` exit0(build-localized-candidate.log 成功);含 AMD ID4 list/node/session/preset 重启持久化,四语言 catalog 与最终软件背景。证据 E:/项目/Veyra/tests/field-upgrade-20261003/ui-final。候选脚本 scripts/acceptance/field-upgrade-package.py 仅本地组包,使用既有 43 原件与独立 AMD manifest,source zip 与模型/运行库分离。++- 工作树 E:/项目/Veyra/worktrees/field-upgrade-20261003,分支 codex/field-upgrade-20261003,base 66cd3e5;先存档写方案,未改桌面用户工作区/main,未 push/Release。+- 导出:有效键入即时提交,草稿不受无关 exportChanged 覆盖,1–300 Mbps 与后端统一;具体 validate 原因、冻结 bitrate/rateControl 入日志。两种真实复现均通过,不把目标当实际平均保证。+- Xbox:configure float 后补 start;保留具体服务端断流原因,网络/服务器关闭/过期最多三次重连,1/2/3s 退避可取消,连续解码 30s 恢复额度,首帧后 reset 全图。404 不覆盖已收到的踢出原因;未知踢出不重连。没有真实主机有声/长稳证据。+- RTSS:Window 软件模式不透明,VBackdrop 用 Rectangle/Image。RTSS 7.3.7 当前用户副本实际注入 RTSSHooks64,自动兼容截图 alpha=255;普通启动需提升,改以 RunAsInvoker 当前用户启动,结束只关闭自己 PID 35124,未编辑 RTSS/OBS 配置。删除 nvppex/NvPresent 检测与 NVIDIA App 归因;旧 marker 无误判提示。+- AMD:固定 lmxxf 78f548749e74824327b8458c57be31a1df78376a / MIT,独立 C ABI、共享 NrInstance、同队列 producer/HIP/consumer/retire,退出先放 runtime 再放借用资源。ID4,AMD 光流/FSR SR 默认,未支持控件隐藏,1080p 预算/4K native export/HDR 边界明确。MSVC recipe 成功,E:/项目/Veyra/logs/field-upgrade-20261003/lmxxf-recipe.log;最初 st scope/GNU annotation/min-max/user32 问题已修复。+- 用户 zip C:/Users/123/Downloads/Magpie-DLSS5-AMD-0.39.zip,SHA256 9ea84c665d270cd45e24184729b8272c152485df462a1528539ed778d41849f5;739 文件 hashes 匹配,186 权重/2 映射/62 HIP 模块。原解压 E:/项目/Veyra/deps/magpie-amd-039-20261003,宿主资源 E:/项目/Veyra/deps/veyra-amd-nr-039-20261003,逐文件 manifest 随目录。真实 DLL API/capabilities/module layout 通过,不加载 Magpie/ReShade。0.40 下载空缺已用本地资源解决;无 RX9000/amdhip64_7.dll,不称推理已验。+- `python -B scripts/acceptance/field-upgrade-build.py build-final-contracts.log veyra_qml_ui veyra_xbox_tests veyra_capture_audio_tests veyra_qml_quick_tests veyra_export_probe veyra_lmxxf_nr_tests veyra_lmxxf_fake_runtime` exit0;fresh build E:/项目/Veyra/build/field-upgrade-20261003,logs/tmp 同任务目录。+- `python -B scripts/acceptance/field-upgrade-tests.py final` exit0:Qt Quick39、Xbox90、本机 gain0 WASAPI 250×20ms float、AMD ABI identity GPU-copy62 均 0 failure。E:/项目/Veyra/tests/field-upgrade-20261003/final/summary.json;之前 executable/argv0/plugin 失败已修复,最终通过才算验收。+- `python -B scripts/acceptance/field-upgrade-ui.py rtss --rtss` exit0:2K30 AVI→NR+最高档 SR→4K HEVC;VBR18 编辑其他选项与 CBR24 直接开始均完成,UI 后改7/8 不污染冻结参数。24/24帧,ffprobe 平均约20.745/27.311Mbps,NVENC D3D12。本机 RTX5070 616.56,不冒称用户616.92;logs E:/项目/Veyra/logs/field-upgrade-20261003/production-rtss,截图/媒体 E:/项目/Veyra/tests/field-upgrade-20261003/production-rtss。+- 新文本 en/zh-TW/ja 补齐,AMD ID4 的 preset/list/node session 持久化纳入现有测试。构建 build-localized-candidate.log,测试/候选最终结果继续补记。git diff --check 与 source guard 通过,禁止 DLL/SDK/f16/f32/i32/hsaco 入 Git。旧 delivery.ps1 仅 legacy,不当作 QML 验收。+- 详细报告 docs/FIELD_UPGRADE_ACCEPTANCE_2026-10-03.md、docs/AMD_NR_INTEGRATION_2026-10-03.md。++## 2026-10-03 现场五项修复接管、开工存档与方案++- 当前用户要求先存档、写方案、新分支修复 Xbox 音频/断开、AMD RX 9000 lmxxf NR、导出码率、RTSS 背景透明和 NVIDIA App 检测。桌面 checkout 仍为旧 UI migration 脏工作树,最新 2.0.2 main 在 E 盘,故基于干净 `66cd3e50590766e5a654528ab61e491dc4d30c83` 创建 `codex/field-upgrade-20261003` / `E:/项目/Veyra/worktrees/field-upgrade-20261003`。+- `git bundle create E:/项目/Veyra/archives/field-upgrade-20261003-start/repository-before.bundle --all`、`git bundle verify` 成功,bundle 71223867 bytes。桌面 working binary diff 258615 bytes、index diff 0 bytes,未跟踪源码与 SHA 清单一起存档;不 stash/reset/切换桌面分支。首次 `--output=(Join-Path ...)` 被 PowerShell 错误解析,已改变量 `"--output=$taskPatch"` 并检查退出码后重生成 manifest。+- 标签 `checkpoint/pre-field-upgrade-20261003` 指向上述 main;输入日志复制至 `E:/项目/Veyra/logs/field-upgrade-20261003/inputs`,原始文件未改。官方 lmxxf 源码获取目录 `E:/项目/Veyra/deps/lmxxf-nr-20261003`,尚未推理或添加模型。+- 开工方案 `docs/FIELD_UPGRADE_PLAN_2026-10-03.md` 已在产品修改前落地。明确本轮授权覆盖对应历史冻结,保留源码/Runtime/模型隔离、硬件未验边界,不派 Agent、不合并/推送/发布。+- 当前静态证据:导出 UI/bridge 2000 Mbps 上限与后端 300 不一致;字段只在 editingFinished 提交;透明主窗口依赖 Shape 背景而 RTSS 模式为软件绘制;Xbox 音频/视频时钟域待验证。尚未标任何产品问题通过。+## 2026-10-03 2.0.2 正式发布完成- 发布地址 https://github.com/Likely7/Veyra-NRVideo/releases/tag/v2.0.2 ,2026-10-02 18:40:18 UTC(台北 10-03 02:40:18)公开并设为 latest,非 draft / 非 prerelease。源码 tag v2.0.2 指向 `0dafc57e7ad54880b1748e7046970ddc825e7e46`;该提交同时包含 Claude `28a440b` 与 Codex `bfafbea`。主分支从 `8f42fd5` 干净 fast-forward 后用 `git push --atomic nrvideo main refs/tags/v2.0.2` 推送,未动 origin。diff --git a/i18n/catalog.json b/i18n/catalog.jsonindex ed0f3707..f64d6ffb 100644--- a/i18n/catalog.json+++ b/i18n/catalog.json@@ -462,6 +462,13 @@"en": "AMD FSR frame generation is limited to 2X; request not applied","ja": "AMD FSR のフレーム生成は最大 2X です。要求は適用されていません"},+ {+ "zh": "AMD NR(实验):需要 RX 9000 驱动及 lmxxf 运行组件,内部最高 1080p 像素预算。支持模型强度、残差与保护;风格使用运行时配置。HDR 尚未验收。",+ "src": "qml/NrLayerEditor.qml",+ "zh-TW": "AMD NR(實驗):需要 RX 9000 驅動及 lmxxf 執行元件,內部最高 1080p 像素預算。支援模型強度、殘差與保護;風格使用執行元件設定。HDR 尚未驗收。",+ "en": "AMD NR (experimental): requires an RX 9000 driver and lmxxf runtime, with an internal 1080p pixel budget. Model strength, residual and protection are supported; style uses the runtime configuration. HDR has not been validated.",+ "ja": "AMD NR(実験):RX 9000 ドライバーと lmxxf ランタイムが必要です。内部処理の画素数は最大 1080p 相当です。モデル強度・残差・保護に対応し、スタイルはランタイム設定を使います。HDR は未検証です。"+ },{"zh": "AMD 性能档","src": "qml/ProPage.qml",@@ -1288,6 +1295,13 @@"en": "RTX Video Super Resolution level","ja": "RTX ビデオ超解像のレベル"},+ {+ "zh": "RX 9000 · lmxxf(实验)",+ "src": "qml/NrLayerEditor.qml",+ "zh-TW": "RX 9000 · lmxxf(實驗)",+ "en": "RX 9000 · lmxxf (experimental)",+ "ja": "RX 9000 · lmxxf(実験)"+ },{"zh": "Reflex 调用及驱动撤销失败;请关闭视频后重试","src": "src/engine/EngineController.cpp",@@ -4943,6 +4957,13 @@"en": "Invalid export settings","ja": "書き出し設定が不正です"},+ {+ "zh": "导出设置无效:%1",+ "src": "src/ui/QmlPlayerBridge.cpp",+ "zh-TW": "匯出設定無效:%1",+ "en": "Invalid export settings: %1",+ "ja": "書き出し設定が不正です:%1"+ },{"zh": "导出进程隔离失败","src": "src/engine/ExportJobManager.cpp",@@ -9011,6 +9032,13 @@"en": "The target file already exists; choose another file name","ja": "保存先のファイルがすでに存在します。別のファイル名にしてください"},+ {+ "zh": "目标码率 1–300 Mbps;VBR 的实际平均码率随画面复杂度变化。",+ "src": "qml/ExportPage.qml",+ "zh-TW": "目標位元速率 1–300 Mbps;VBR 的實際平均位元速率隨畫面複雜度變化。",+ "en": "Target bitrate: 1–300 Mbps. Actual VBR average bitrate varies with scene complexity.",+ "ja": "目標ビットレートは 1~300 Mbps。VBR の実際の平均値は映像の複雑さによって変わります。"+ },{"zh": "目标码率影响画质与文件大小。","src": "qml/ExportPage.qml",@@ -12490,6 +12518,13 @@"en": "The preview keeps the aspect ratio and does not upscale small inputs; image/video export is still fully processed.","ja": "プレビューは縦横比を保ち、小さい入力は拡大しません。画像・動画の書き出しは完全に処理します。"},+ {+ "zh": "预览可降采样到 1080p。AMD NR 图片/视频导出仅接受预算内原生尺寸,暂不支持 4K NR 导出。",+ "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": "预览:SDR 转 HDR 已运行","src": "src/engine/EngineController.cpp",diff --git a/include/veyra/engine/EnhancementSettings.h b/include/veyra/engine/EnhancementSettings.hindex 97e1584c..706b92e3 100644--- a/include/veyra/engine/EnhancementSettings.h+++ b/include/veyra/engine/EnhancementSettings.h@@ -70,10 +70,10 @@ constexpr std::wstring_view captureAudioIngressName(CaptureAudioIngress mode) {}// The original slot (0) became Lecram in 2.0.0. Give the restored NVIDIA// binary a new value so existing presets keep selecting the same DLL.-enum class NrRuntime { Original = 0, Community = 1, Ampere = 2, NvidiaOriginal = 3 };+enum class NrRuntime { Original = 0, Community = 1, Ampere = 2, NvidiaOriginal = 3, LmxxfAmd = 4 };constexpr bool validNrRuntime(NrRuntime runtime) {return runtime == NrRuntime::Original || runtime == NrRuntime::Community ||- runtime == NrRuntime::Ampere || runtime == NrRuntime::NvidiaOriginal;+ runtime == NrRuntime::Ampere || runtime == NrRuntime::NvidiaOriginal || runtime == NrRuntime::LmxxfAmd;}// Persisted value 1 selected the retired RTX40 DLL. Never load that DLL in// current builds; preserve 0 (Lecram) and 2 (SF-v2) as explicit user choices.@@ -86,6 +86,7 @@ constexpr std::string_view nrRuntimeName(NrRuntime runtime) {case NrRuntime::Community:return "community-SF-v2-RTX20-RTX50-legacy40";case NrRuntime::Ampere:return "community-SF-v2-RTX20-RTX50";case NrRuntime::NvidiaOriginal:return "NVIDIA-original-RTX50-310.8.0";+ case NrRuntime::LmxxfAmd:return "lmxxf-AMD-RDNA4";}return "unknown";}diff --git a/include/veyra/gfx/PresentationHooks.h b/include/veyra/gfx/PresentationHooks.hindex c5ab3bd4..9446d09a 100644--- a/include/veyra/gfx/PresentationHooks.h+++ b/include/veyra/gfx/PresentationHooks.h@@ -27,18 +27,13 @@ inline constexpr PresentationHook kPresentationHooks[] = {{L"GameTracker64.dll", "GamePP"},};-// Injected components that field logs tie to the GPU device being removed, or to a crash,-// within seconds of a capture preview starting (2026-10-02): NVIDIA App's presentation-// plug-in nvppex.dll (it carries RTX HDR, Smooth Motion and RTX Dynamic Vibrance; two-// crashes inside it on an RTX 5080), the driver's present layer, and RTSS (device removed-// with ACCESS_DENIED on an RTX 4070 SUPER). Veyra cannot switch them off; it can name them.+// RTSS needs a different UI renderer. NVIDIA App module presence is not a failure+// diagnosis and must not trigger a warning or a persistent failure marker.inline constexpr PresentationHook kRiskyInjections[] = {- {L"nvppex.dll", "NVIDIA App presentation plug-in"},- {L"NvPresent64.dll", "NVIDIA present layer"},{L"RTSSHooks64.dll", "RivaTuner Statistics Server"},};-// The risky components loaded now, as "nvppex.dll,RTSSHooks64.dll" (empty when none).+// The compatibility components loaded now (empty when none).inline std::wstring riskyInjections() {std::wstring out;for (const auto& hook : kRiskyInjections)diff --git a/include/veyra/pipeline/EnhanceGraph.h b/include/veyra/pipeline/EnhanceGraph.hindex 269ebe29..a4e8668a 100644--- a/include/veyra/pipeline/EnhanceGraph.h+++ b/include/veyra/pipeline/EnhanceGraph.h@@ -486,7 +486,7 @@ public:};const Metrics& metrics() const { return metrics_; }const std::string& mvecSource() const { return mvecSource_; }- bool nrCreated() const { return !nrInstances_.empty() && nrInstances_.front()->handle() != nullptr; }+ bool nrCreated() const { return !nrInstances_.empty() && (nrInstances_.front()->handle() != nullptr || (nrInstances_.front()->amd && nrInstances_.front()->amd->ready())); }bool initialized() const { return initialized_; }uint32_t sourceWidth() const { return srcW_; }uint32_t sourceHeight() const { return srcH_; }@@ -648,6 +648,8 @@ private:// NR layers. One entry means the single-layer product path; the probe in// tools/nr_probe verified several handles coexist on one snippet session.std::vector<std::unique_ptr<NrInstance>> nrInstances_;+ bool lmxxfNr_ = false;+ bool submitGraph(uint32_t slot);// The layer count the current graph was built with, so a settings change// that adds or removes a layer is detected as a rebuild.uint32_t nrLayerCount_=1;diff --git a/include/veyra/pipeline/LmxxfNrBackend.h b/include/veyra/pipeline/LmxxfNrBackend.hnew file mode 100644index 00000000..5567b81a--- /dev/null+++ b/include/veyra/pipeline/LmxxfNrBackend.h@@ -0,0 +1,38 @@+// SPDX-License-Identifier: GPL-3.0-only+// Host adapter for lmxxf's MIT C ABI; third_party/lmxxf/ records the pinned source.+#pragma once+#include <d3d12.h>+#include <filesystem>+#include <cstdint>+#include <string>+#include "../../../third_party/lmxxf/LmxxfNrApi.h"++namespace veyra::pipeline {+class LmxxfNrBackend {+public:+ ~LmxxfNrBackend() { close(); }+ LmxxfNrBackend() = default;+ LmxxfNrBackend(const LmxxfNrBackend&) = delete;+ LmxxfNrBackend& operator=(const LmxxfNrBackend&) = delete;+ bool open(const std::filesystem::path& directory, ID3D12Device*, ID3D12CommandQueue*, uint32_t vendor);+ void close() noexcept;+ bool ready() const { return context_ != nullptr; }+ bool admits(uint32_t width, uint32_t height) const;+ bool recordInputs(ID3D12GraphicsCommandList*, ID3D12Resource* color, uint64_t frame, bool reset, float intensity = 1);+ bool enqueue(); // immediately after the producer submission, on the session queue+ bool recordOutputs(ID3D12GraphicsCommandList*, ID3D12Resource* destination);+ bool retireSubmitted(); // after the list containing RecordOutputs was submitted+ const std::string& error() const { return error_; }+private:+ bool result(int32_t code, const char* operation);+ HMODULE module_ = nullptr;+ LmxxfNrApi api_{};+ LmxxfNrCapabilities caps_{};+ LmxxfNrJob job_{};+ void* context_ = nullptr;+ ID3D12CommandQueue* queue_ = nullptr; // graph owns it and outlives the adapter+ uint64_t session_ = 0;+ bool enqueued_ = false, outputsRecorded_ = false;+ std::string error_;+};+}diff --git a/include/veyra/pipeline/NrInstance.h b/include/veyra/pipeline/NrInstance.hindex 6eb761b9..5a3fbe75 100644--- a/include/veyra/pipeline/NrInstance.h+++ b/include/veyra/pipeline/NrInstance.h@@ -9,6 +9,7 @@#pragma once#include "veyra/pipeline/GpuPassUtils.h"#include "veyra/pipeline/NrTemporalPass.h"+#include "veyra/pipeline/LmxxfNrBackend.h"#include "veyra/engine/EnhancementSettings.h"#include <memory>@@ -23,6 +24,7 @@ namespace veyra::pipeline {// its own input copy) and its temporal history.class NrInstance {public:+ ~NrInstance() { close(); }// `zeroMotion` / `zeroDepth` are shared constant guidance textures owned by// the graph; the layer only borrows them. `fullWidth`/`fullHeight` are the// composite extent, which differs from the NR extent in the realtime path.@@ -85,6 +87,7 @@ public:// direct-to-target path.bool stabilised = false;bool enabled = true;+ std::unique_ptr<LmxxfNrBackend> amd;// Bumped when an upstream layer's settings or output change. A layer whose// input revision moved drops its history, the same contract Magpie's// inputRevision enforces between passes.diff --git a/include/veyra/source/XboxSessionSource.h b/include/veyra/source/XboxSessionSource.hindex 9041437f..bd9c3159 100644--- a/include/veyra/source/XboxSessionSource.h+++ b/include/veyra/source/XboxSessionSource.h@@ -34,12 +34,15 @@ struct XboxConnectDesc {std::string locale = "zh-CN";std::shared_ptr<ID3D12Device> decodeDevice;std::shared_ptr<ID3D12CommandQueue> decodeQueue;+ const std::atomic<bool>* stopRequested = nullptr; // engine owner outlives the source};struct XboxStats {enum class State : uint8_t { Idle, Starting, Connecting, Streaming, Ended, Failed };State state = State::Idle;std::wstring message; // progress while starting; the reason when Ended or Failed+ std::string disconnectReason;+ bool reconnectable = false;uint32_t width = 0, height = 0;bool hardwareDecode = false;uint64_t units = 0, decoded = 0, dropped = 0, decodeErrors = 0, keyframeRequests = 0;diff --git a/include/veyra/ui/QmlPlayerBridge.h b/include/veyra/ui/QmlPlayerBridge.hindex 024ed830..666524d7 100644--- a/include/veyra/ui/QmlPlayerBridge.h+++ b/include/veyra/ui/QmlPlayerBridge.h@@ -109,6 +109,7 @@ class QmlPlayerBridge : public QObject {Q_PROPERTY(QString captureDeviceId READ captureDeviceId WRITE setCaptureDeviceId NOTIFY captureChanged)Q_PROPERTY(QString captureDeviceLabel READ captureDeviceLabel NOTIFY captureChanged)Q_PROPERTY(bool captureForceSdr READ captureForceSdr WRITE setCaptureForceSdr NOTIFY settingsChanged)+ Q_PROPERTY(bool amdNrGpu READ amdNrGpu CONSTANT)Q_PROPERTY(bool captureFlipVertical READ captureFlipVertical WRITE setCaptureFlipVertical NOTIFY settingsChanged)// P4-e: the full capture connection, as the 1.4.4 panel: device details and// formats come from asynchronous DirectShow queries (never on the UI thread),@@ -447,6 +448,7 @@ class QmlPlayerBridge : public QObject {Q_PROPERTY(QVariantList colourLooks READ colourLooks NOTIFY colourLibraryChanged)public:+ bool amdNrGpu() const;// `engine` must outlive the bridge. `dataDirectory` holds ui-session.v1 and// the preset library; empty means the default user data directory.QmlPlayerBridge(engine::EngineController& engine, std::filesystem::path dataDirectory = {},diff --git a/include/veyra/xbox/DisconnectPolicy.h b/include/veyra/xbox/DisconnectPolicy.hnew file mode 100644index 00000000..e0b4015e--- /dev/null+++ b/include/veyra/xbox/DisconnectPolicy.h@@ -0,0 +1,28 @@+// SPDX-License-Identifier: GPL-3.0-only+#pragma once+#include <string_view>+#include <cstdint>++namespace veyra::xbox {+// Only explicitly recoverable transport/service losses. A takeover, sign-out,+// console shutdown or an unknown server kick must stay visible to the user.+constexpr bool reconnectableDisconnect(std::string_view reason) {+ return reason == "connection lost" || reason == "KickForServerShutdown" || reason == "session expired";+}+class ReconnectBudget {+public:+ bool take() { if (attempts_ >= 3) return false; ++attempts_; return true; }+ unsigned attempts() const { return attempts_; }+ // Refill only after 30 seconds of continuous decoded progress. One frame+ // after a reconnect must not enable another endless cycle of retries.+ void decoded(int64_t host100ns) {+ if (!progressStart_ || host100ns - lastProgress_ > 10000000 || host100ns < lastProgress_) progressStart_ = host100ns;+ lastProgress_ = host100ns;+ if (host100ns - progressStart_ >= 300000000) attempts_ = 0;+ }+ void disconnected() { progressStart_ = lastProgress_ = 0; }+private:+ unsigned attempts_ = 0;+ int64_t progressStart_ = 0, lastProgress_ = 0;+};+}diff --git a/qml/Veyra/ExportPage.qml b/qml/Veyra/ExportPage.qmlindex 4a17b148..362e506e 100644--- a/qml/Veyra/ExportPage.qml+++ b/qml/Veyra/ExportPage.qml@@ -251,9 +251,31 @@ VPage {VRow {visible: veyra.exportRateControl !== 2label: qsTr("码率 Mbps")- DialogHost.VTextField { objectName: "export-bitrate-field"; implicitWidth: 100; text: String(veyra.exportBitrateMbps); onEdited: value => { const n = Number(value); if (isFinite(n)) veyra.exportBitrateMbps = Math.max(1, Math.min(2000, Math.round(n))) } }+ Basic.TextField {+ id: bitrateEditor+ objectName: "export-bitrate-field"+ implicitWidth: 100+ implicitHeight: 28+ color: Theme.t1+ font.pixelSize: 12+ selectByMouse: true+ validator: IntValidator { bottom: 1; top: 300 }+ // exportChanged also covers codec, size and track choices. Keep the+ // draft independent of it, and commit valid keystrokes before a+ // start button can read the export settings.+ property int committedValue: veyra.exportBitrateMbps+ Component.onCompleted: text = String(committedValue)+ onCommittedValueChanged: if (!activeFocus) text = String(committedValue)+ onTextEdited: if (acceptableInput) veyra.exportBitrateMbps = Number(text)+ onEditingFinished: text = String(committedValue)+ background: Rectangle {+ color: Theme.bgOuter; radius: 4+ border.width: 1+ border.color: bitrateEditor.activeFocus ? Theme.accent : Theme.stroke+ }+ }}- Note { text: veyra.exportRateControl === 2 ? qsTr("CQ 使用恒定质量;文件大小随画面复杂度变化。") : qsTr("目标码率影响画质与文件大小。") }+ Note { text: veyra.exportRateControl === 2 ? qsTr("CQ 使用恒定质量;文件大小随画面复杂度变化。") : qsTr("目标码率 1–300 Mbps;VBR 的实际平均码率随画面复杂度变化。") }VRow { label: qsTr("增强预设"); Choice { options: veyra.presetChoices; selected: String((veyra.presetChoices.find(o => o.label === veyra.exportPresetName) || {id: "-1"}).id); onPicked: id => veyra.selectExportPreset(Number(id)) } }}VGroup {@@ -328,7 +350,7 @@ VPage {RowLayout {Layout.fillWidth: true; spacing: 6Text { visible: root.compact; Layout.fillWidth: true; text: veyra.exportStatus; color: Theme.t2; elide: Text.ElideRight; font.pixelSize: 11 }- VButton { objectName: "export-start"; Layout.fillWidth: !root.compact; primary: !veyra.exportRunning; text: veyra.exportRunning ? (veyra.exportPaused ? qsTr("继续导出") : qsTr("暂停导出")) : qsTr("开始导出 ") + veyra.exportReadyCount + qsTr(" 项"); enabled: root.exportKind === "video" && (veyra.exportRunning || veyra.exportReadyCount > 0); onClicked: veyra.exportRunning ? veyra.pauseExport(!veyra.exportPaused) : veyra.startExport() }+ VButton { objectName: "export-start"; Layout.fillWidth: !root.compact; primary: !veyra.exportRunning; text: veyra.exportRunning ? (veyra.exportPaused ? qsTr("继续导出") : qsTr("暂停导出")) : qsTr("开始导出 ") + veyra.exportReadyCount + qsTr(" 项"); enabled: root.exportKind === "video" && (veyra.exportRunning || (veyra.exportReadyCount > 0 && (veyra.exportRateControl === 2 || bitrateEditor.acceptableInput))); onClicked: veyra.exportRunning ? veyra.pauseExport(!veyra.exportPaused) : veyra.startExport() }VButton { objectName: "export-cancel"; visible: veyra.exportRunning; text: qsTr("取消"); onClicked: veyra.cancelExport() }}// The one remaining-time readout (the old page had two); it holds still while paused.diff --git a/qml/Veyra/Main.qml b/qml/Veyra/Main.qmlindex 62d54c2b..249ca2bd 100644--- a/qml/Veyra/Main.qml+++ b/qml/Veyra/Main.qml@@ -26,7 +26,9 @@ Window {minimumWidth: cinema ? 360 : 720minimumHeight: 260visible: true- color: "transparent"+ // The software scene graph cannot draw the Shape background. Keep the native+ // window opaque as well, including while its first frame is being produced.+ color: typeof vySoftwareUi !== "undefined" && vySoftwareUi ? (cinema ? Theme.videoBlack : Theme.bgOuter) : "transparent"flags: Qt.Window | Qt.FramelessWindowHinttitle: "Veyra " + veyra.versiondiff --git a/qml/Veyra/NrLayerEditor.qml b/qml/Veyra/NrLayerEditor.qmlindex 21a36df0..0e5b8fec 100644--- a/qml/Veyra/NrLayerEditor.qml+++ b/qml/Veyra/NrLayerEditor.qml@@ -16,7 +16,10 @@ ColumnLayout {signal duplicateRequested(int nodeIndex)signal removeRequested(int nodeIndex)signal orderEdited(bool enabled)- readonly property var sizeChoices: [+ readonly property bool amdNr: (typeof veyra !== "undefined" && veyra.amdNrGpu) || layerData.runtime === 4+ readonly property var sizeChoices: amdNr ? [+ {id:"2",label:"480p"}, {id:"3",label:"720p"}, {id:"4",label:"900p"}, {id:"0",label:qsTr("1080p · 默认")}+ ] : [{id:"2",label:"480p"}, {id:"3",label:"720p"}, {id:"4",label:"900p"},{id:"0",label:qsTr("1080p · 默认")}, {id:"5",label:"1440p"}, {id:"1",label:qsTr("原生")}]@@ -65,9 +68,10 @@ ColumnLayout {hint: qsTr("全链共享 · 切换会重建 NR 管线")VSelect {objectName: "nr-runtime"- value: editor.layerData.runtime === 3 ? qsTr("RTX 50 · NVIDIA 原版")+ value: (typeof veyra !== "undefined" && veyra.amdNrGpu) || editor.layerData.runtime === 4 ? qsTr("RX 9000 · lmxxf(实验)")+ : editor.layerData.runtime === 3 ? qsTr("RTX 50 · NVIDIA 原版"): editor.layerData.runtime === 2 ? "RTX 20–50 · SF-v2" : "RTX 50 · Lecram"- options: [{id:"0",label:"RTX 50 · Lecram"},{id:"2",label:"RTX 20–50 · SF-v2"},+ options: typeof veyra !== "undefined" && veyra.amdNrGpu ? [{id:"4",label:qsTr("RX 9000 · lmxxf(实验)")}] : [{id:"0",label:"RTX 50 · Lecram"},{id:"2",label:"RTX 20–50 · SF-v2"},{id:"3",label:qsTr("RTX 50 · NVIDIA 原版")}]onPicked: id => editor.edited(editor.layerData.index, "runtime", Number(id))}@@ -93,7 +97,8 @@ ColumnLayout {}Text {Layout.fillWidth: true- text: qsTr("预览保留比例且不放大小输入;图片/视频导出仍完整处理。")+ text: editor.amdNr ? qsTr("预览可降采样到 1080p。AMD NR 图片/视频导出仅接受预算内原生尺寸,暂不支持 4K NR 导出。")+ : qsTr("预览保留比例且不放大小输入;图片/视频导出仍完整处理。")color: Theme.t3; font.family: Theme.fontUi; font.pixelSize: 11wrapMode: Text.WordWrap}@@ -102,8 +107,15 @@ ColumnLayout {amount: editor.layerData.intensityonEdited: amount => editor.edited(editor.layerData.index, "intensity", amount)}+ Text {+ Layout.fillWidth: true+ visible: (typeof veyra !== "undefined" && veyra.amdNrGpu) || editor.layerData.runtime === 4+ text: qsTr("AMD NR(实验):需要 RX 9000 驱动及 lmxxf 运行组件,内部最高 1080p 像素预算。支持模型强度、残差与保护;风格使用运行时配置。HDR 尚未验收。")+ color: Theme.t3; font.pixelSize: 11; wrapMode: Text.WordWrap+ }VSubGroup {objectName: "nr-model-group"+ visible: !(typeof veyra !== "undefined" && veyra.amdNrGpu) && editor.layerData.runtime !== 4Layout.fillWidth: truelabel: qsTr("模型参数"); count: 6Repeater {diff --git a/qml/Veyra/VBackdrop.qml b/qml/Veyra/VBackdrop.qmlindex aa5f54ae..137d5c33 100644--- a/qml/Veyra/VBackdrop.qml+++ b/qml/Veyra/VBackdrop.qml@@ -7,39 +7,69 @@ import QtQuick.Shapes// matched but on a 7..28 level ramp it quantised into visible rings (G1.2 evidence).// The CSS gradient is relative to the box, so stretching the image keeps its shape.// The Shape only gives it the window's rounded corners and the 1px stroke.-Shape {+Item {id: backdropproperty int radius: Theme.rWindowproperty color strokeColor: Theme.stroke- // fillItem crashes the CurveRenderer in Qt 6.8.3 (access violation, reproduced- // with qml.exe); the geometry renderer is fine, with multisampling for the corners.- preferredRendererType: Shape.GeometryRenderer- layer.enabled: true- layer.samples: 4-- // fillItem must be a texture provider (an Image), not a container: a- // Rectangle holding images filled the shape white.- // 设置 → 背景渐变强度: 0 = flat base colour, 1 = the design's gradient,- // 2 = backdrop-strong.png: the same generator (tools/qt_probe/make-backdrop.py,- // same seed and grain) with the stops' distance from the edge colour x1.8.- Image {- id: fill- visible: false- width: backdrop.width- height: backdrop.height- source: Theme.backdropLevel === 2 ? "backdrop-strong.png" : "backdrop.png"- smooth: true+ property bool softwareRendering: typeof vySoftwareUi !== "undefined" && vySoftwareUi+ // Rectangle and Image have software scene graph implementations. Shape does+ // not; instantiate it only for the GPU renderer.+ Loader {+ anchors.fill: parent+ sourceComponent: backdrop.softwareRendering ? softwareBackground : gpuBackground}-- ShapePath {- strokeWidth: 1- strokeColor: backdrop.strokeColor- fillColor: Theme.bgOuter- fillItem: Theme.backdropLevel === 0 ? null : fill- PathRectangle {- x: 0.5; y: 0.5- width: backdrop.width - 1; height: backdrop.height - 1+ Component {+ id: softwareBackground+ Rectangle {+ color: Theme.bgOuterradius: backdrop.radius+ Image {+ anchors.fill: parent+ visible: Theme.backdropLevel !== 0+ source: Theme.backdropLevel === 2 ? "backdrop-strong.png" : "backdrop.png"+ smooth: true+ }+ Rectangle {+ anchors.fill: parent; color: "transparent"+ radius: backdrop.radius+ border.width: 1; border.color: backdrop.strokeColor+ }+ }+ }+ Component {+ id: gpuBackground+ Shape {+ // fillItem crashes the CurveRenderer in Qt 6.8.3 (access violation, reproduced+ // with qml.exe); the geometry renderer is fine, with multisampling for the corners.+ preferredRendererType: Shape.GeometryRenderer+ layer.enabled: true+ layer.samples: 4++ // fillItem must be a texture provider (an Image), not a container: a+ // Rectangle holding images filled the shape white.+ // 设置 → 背景渐变强度: 0 = flat base colour, 1 = the design's gradient,+ // 2 = backdrop-strong.png: the same generator (tools/qt_probe/make-backdrop.py,+ // same seed and grain) with the stops' distance from the edge colour x1.8.+ Image {+ id: fill+ visible: false+ width: backdrop.width+ height: backdrop.height+ source: Theme.backdropLevel === 2 ? "backdrop-strong.png" : "backdrop.png"+ smooth: true+ }++ ShapePath {+ strokeWidth: 1+ strokeColor: backdrop.strokeColor+ fillColor: Theme.bgOuter+ fillItem: Theme.backdropLevel === 0 ? null : fill+ PathRectangle {+ x: 0.5; y: 0.5+ width: backdrop.width - 1; height: backdrop.height - 1+ radius: backdrop.radius+ }+ }}}}diff --git a/scripts/acceptance/field-upgrade-build.py b/scripts/acceptance/field-upgrade-build.pynew file mode 100644index 00000000..f2f5cdfc--- /dev/null+++ b/scripts/acceptance/field-upgrade-build.py@@ -0,0 +1,45 @@+"""Fresh isolated build, using only the existing product dependency paths."""+import os+import subprocess+import sys+from pathlib import Path++ROOT = Path(__file__).resolve().parents[2]+BASE = Path('E:/项目/Veyra')+TASK = 'field-upgrade-20261003'+BUILD, TMP, LOGS = (BASE / part / TASK for part in ('build', 'tmp', 'logs'))+CONTROL = ROOT / 'scripts/acceptance/field-upgrade-control.py'+subprocess.run([sys.executable, '-B', str(CONTROL)], check=True)+for p in (BUILD, TMP, LOGS):+ p.mkdir(parents=True, exist_ok=True)+settings = []+for line in (BASE / 'build/release-2.0.2-20261003/CMakeCache.txt').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'):+ continue+ if key.startswith('VEYRA_') or key in ('CMAKE_PREFIX_PATH', 'CMAKE_MAKE_PROGRAM', 'PROTOC', 'PKG_CONFIG_EXECUTABLE'):+ settings.append(f'set({key} [[{value}]] CACHE {kind} "Existing dependency" FORCE)')+(TMP / 'dependencies.cmake').write_text('\n'.join(settings), encoding='utf8')+targets = sys.argv[2:] or ['veyra_qml_ui', 'veyra_xbox_tests', 'veyra_capture_audio_tests', 'veyra_qml_quick_tests', 'veyra_export_probe']+if any(not t.replace('_', '').isalnum() for t in targets):+ raise SystemExit('Invalid target')+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(VSLANG='1033', TASK_ROOT=str(ROOT), TASK_BUILD=str(BUILD), TASK_TMP=str(TMP),+ TEMP=str(TMP), TMP=str(TMP),+ TASK_CMAKE='C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe')+log = LOGS / sys.argv[1]+with log.open('x', encoding='utf8') as output:+ try:+ code = subprocess.run(['cmd.exe', '/d', '/c', str(cmd)], cwd=ROOT, env=env,+ stdout=output, stderr=subprocess.STDOUT, timeout=890).returncode+ except subprocess.TimeoutExpired:+ code = 124+print('BUILD', code, log)+print('\n'.join(log.read_text(encoding='utf8', errors='replace').splitlines()[-25:]))+subprocess.run([sys.executable, '-B', str(CONTROL)], check=True)+raise SystemExit(code)diff --git a/scripts/acceptance/field-upgrade-control.py b/scripts/acceptance/field-upgrade-control.pynew file mode 100644index 00000000..79657fa2--- /dev/null+++ b/scripts/acceptance/field-upgrade-control.py@@ -0,0 +1,41 @@+"""Scope check for the five fixes authorized on 2026-10-03; no release actions."""+import subprocess+from pathlib import Path++ROOT = Path(__file__).resolve().parents[2]+BRANCH = 'codex/field-upgrade-20261003'+BASE = '66cd3e50590766e5a654528ab61e491dc4d30c83'+ALLOWED = {+ 'AGENTS.md', 'CMakeLists.txt', 'THIRD_PARTY_NOTICES.md', 'README.md', 'i18n/catalog.json',+ 'apps/veyra-qml/main.cpp', 'qml/Veyra/ExportPage.qml', 'qml/Veyra/VBackdrop.qml',+ 'qml/Veyra/NrLayerEditor.qml',+ 'qml/Veyra/Main.qml', 'src/ui/QmlPlayerBridge.cpp', 'include/veyra/ui/QmlPlayerBridge.h',+ 'include/veyra/gfx/PresentationHooks.h', 'src/source/XboxSessionSource.cpp',+ 'include/veyra/source/XboxSessionSource.h', 'src/xbox/WebRtcSession.cpp',+ 'include/veyra/xbox/DisconnectPolicy.h', 'src/engine/EngineController.cpp',+ 'include/veyra/engine/EnhancementSettings.h', 'src/engine/SettingsJson.cpp',+ 'src/pipeline/EnhanceGraph.cpp', 'include/veyra/pipeline/EnhanceGraph.h',+ 'include/veyra/pipeline/NrInstance.h', 'src/pipeline/NrInstance.cpp',+ 'include/veyra/pipeline/LmxxfNrBackend.h', 'src/pipeline/LmxxfNrBackend.cpp',+ 'tests/xbox/XboxTests.cpp', 'tests/integration/CaptureAudioTests.cpp',+ 'tests/qml/quick/tst_export.qml', 'tests/qml/quick/tst_backdrop.qml',+ 'tests/unit/LmxxfNrTests.cpp', 'tests/unit/LmxxfNrFakeRuntime.cpp',+ 'tests/unit/PresetLibraryTests.cpp',+ 'docs/WORKLOG.md', 'docs/CURRENT_STATUS.md', 'docs/FIELD_UPGRADE_PLAN_2026-10-03.md',+ 'docs/FIELD_UPGRADE_ACCEPTANCE_2026-10-03.md', 'docs/AMD_NR_INTEGRATION_2026-10-03.md',+ 'scripts/acceptance/field-upgrade-control.py', 'scripts/acceptance/field-upgrade-build.py',+ 'scripts/acceptance/field-upgrade-tests.py',+ 'scripts/acceptance/field-upgrade-ui.py', 'scripts/acceptance/field-upgrade-ui.qml',+ 'scripts/acceptance/field-upgrade-package.py',+}+def git(*args):+ return subprocess.check_output(['git', *args], cwd=ROOT).decode('utf8').strip()+if git('branch', '--show-current') != BRANCH or git('rev-parse', 'checkpoint/pre-field-upgrade-20261003^{commit}') != BASE:+ raise SystemExit('FIELD SCOPE FAIL: branch or archive tag changed')+changed = set(filter(None, git('diff', '--name-only', BASE).splitlines()))+changed.update(filter(None, git('ls-files', '--others', '--exclude-standard').splitlines()))+unexpected = {p for p in changed if p not in ALLOWED and not p.startswith(('third_party/lmxxf/','scripts/amd-nr/'))}+binary = {p for p in changed if Path(p).suffix.lower() in {'.dll', '.exe', '.lib', '.zip', '.hsaco', '.bin', '.onnx', '.pdb', '.f16', '.f32', '.i32', '.cso', '.addon64'}}+if unexpected or binary:+ raise SystemExit('FIELD SCOPE FAIL\n' + '\n'.join(sorted(unexpected | binary)))+print('FIELD SCOPE PASS:', len(changed), 'authorized source/document files; archive tag unchanged')diff --git a/scripts/acceptance/field-upgrade-package.py b/scripts/acceptance/field-upgrade-package.pynew file mode 100644index 00000000..d59508d5--- /dev/null+++ b/scripts/acceptance/field-upgrade-package.py@@ -0,0 +1,67 @@+"""Local candidate with audited user assets; never a public release/upload."""+import hashlib, importlib.util, json, os, shutil, subprocess, sys, zipfile+from pathlib import Path++ROOT=Path(__file__).resolve().parents[2]+BASE=Path('E:/项目/Veyra');TASK='field-upgrade-20261003';LABEL='2.0.2-field-20261003'+OUTPUT=BASE/'test-packages'/TASK+STAGE=OUTPUT/('Veyra-'+LABEL+'-win64-portable')+AMD=BASE/'deps/veyra-amd-nr-039-20261003'+LOGS=BASE/'logs'/TASK+QT=Path('C:/veyra-deps/qt-veyra/6.8.3/msvc2022_64')+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/field-upgrade-control.py')],check=True)+OUTPUT.mkdir(parents=True,exist_ok=True)+command=[sys.executable,'-B',str(ROOT/'scripts/package-qml-release.py'),+ '--build',str(BASE/'build'/TASK),'--runtime-source',str(BASE/'releases/2.0.2/Veyra-2.0.2-win64-portable'),+ '--legacy-licenses',str(BASE/'releases/2.0.2/Veyra-2.0.2-win64-portable/licenses'),+ '--qt',str(QT),'--qt-licenses',str(BASE/'deps/qt-licenses-6.8.3'),+ '--output',str(OUTPUT),'--label',LABEL,'--no-archive']+with (LOGS/'package-stage.log').open('xb') as log:+ subprocess.run(command,cwd=ROOT,stdout=log,stderr=subprocess.STDOUT,timeout=290,check=True)+shutil.copytree(AMD,STAGE/'runtime/amd-nr')+for name in ('FIELD_UPGRADE_PLAN_2026-10-03.md','FIELD_UPGRADE_ACCEPTANCE_2026-10-03.md','AMD_NR_INTEGRATION_2026-10-03.md'):+ shutil.copy2(ROOT/'docs'/name,STAGE/'docs'/name)+(STAGE/'LOCAL-FIELD-FIX.md').write_text('''# Veyra 本地修复候选 / Local field-fix candidate++双击 veyra_qml_ui.exe。基于 2.0.2,含本轮 Xbox 输出/重连、导出码率、RTSS 背景和 NVIDIA 插件误判修复。+尚未合并、推送或公开发布;详情见 docs/FIELD_UPGRADE_ACCEPTANCE_2026-10-03.md。++AMD NR 已接入共享图,用户 0.39 模型/HIP 资源已附在 runtime/amd-nr。+仅用于本地实验;权重不是 MIT 源码,不代表公开分发授权。需要 RX9000 和驱动自带 amdhip64_7.dll。+本机 RTX5070 未验证 AMD 推理;当前仅 1080p 像素预算,不支持 HDR/原生 4K AMD NR 导出。+AMD 使用模型强度/残差/保护,style 在 assets/native-game-flags.txt;不加载 ReShade/Magpie 注入模块。+Xbox 真机有声/长稳仍需验收。本机导出测试驱动 616.56,用户 616.92 未直接验证。++Launch veyra_qml_ui.exe. This local 2.0.2 candidate fixes Xbox audio startup and bounded reconnection,+bitrate input, the RTSS software background and NVIDIA module false warnings.+AMD NR is experimental: RX9000 + driver HIP runtime required; 1080p pixel budget, no native 4K NR export or HDR.+AMD inference and real Xbox sound/long-term stability remain unverified. No public release has been made.+''',encoding='utf8')+spec=importlib.util.spec_from_file_location('qml_package',ROOT/'scripts/package-qml-release.py')+pkg=importlib.util.module_from_spec(spec);spec.loader.exec_module(pkg)+manifest=json.loads((STAGE/'package-manifest.json').read_text(encoding='utf8'))+records=[]+for file in sorted(STAGE.rglob('*')):+ if not file.is_file():continue+ name=file.relative_to(STAGE).as_posix()+ if name=='package-manifest.json':continue+ pkg.validate_payload(name)+ records.append({'path':name,'size':file.stat().st_size,'sha256':pkg.digest(file)})+assert not any('lmxxf-test-runtime' in r['path'] or 'fake' in r['path'].lower() or r['path'].endswith('.addon64') for r in records)+manifest.update(files=records,localOnly=True,amdInferenceVerified=False,xboxHardwareVerified=False,+ amdProvenance='runtime/amd-nr/amd-nr-local-manifest.json')+(STAGE/'package-manifest.json').write_text(json.dumps(manifest,ensure_ascii=False,indent=2),encoding='utf8')+(LOGS/'candidate-stage.json').write_text(json.dumps({'stage':str(STAGE),'files':len(records),'source':manifest['baseCommit'],'appSha256':pkg.digest(STAGE/'veyra_qml_ui.exe')},ensure_ascii=False,indent=2),encoding='utf8')+print('LOCAL CANDIDATE STAGED',STAGE,'files',len(records),flush=True)+# Corresponding Veyra source remains physically separate; the pinned external+# MIT runtime source is identified by its origin/build instructions.+source=OUTPUT/('Veyra-'+LABEL+'-source.zip')+subprocess.run(['git','archive','--format=zip','--output',str(source),'HEAD'],cwd=ROOT,timeout=60,check=True)+archive=Path(str(STAGE)+'.zip')+with zipfile.ZipFile(archive,'x',zipfile.ZIP_DEFLATED,compresslevel=5) as z:+ for file in sorted(STAGE.rglob('*')):+ if file.is_file():z.write(file,STAGE.name+'/'+file.relative_to(STAGE).as_posix())+audit=pkg.verify_zip(archive)+archive.with_suffix('.zip.sha256').write_text(audit['sha256']+' '+archive.name+'\n',encoding='ascii')+(LOGS/'candidate-package-audit.json').write_text(json.dumps(audit,indent=2),encoding='utf8')+print('LOCAL CANDIDATE ARCHIVE PASS',json.dumps(audit),flush=True)diff --git a/scripts/acceptance/field-upgrade-tests.py b/scripts/acceptance/field-upgrade-tests.pynew file mode 100644index 00000000..f3123d5b--- /dev/null+++ b/scripts/acceptance/field-upgrade-tests.py@@ -0,0 +1,40 @@+"""Bounded field regressions in an isolated, current-runtime staging directory."""+import json, os, shutil, subprocess, sys+from pathlib import Path+ROOT=Path(__file__).resolve().parents[2]+BASE=Path('E:/项目/Veyra'); TASK='field-upgrade-20261003'+BUILD=BASE/'build'/TASK; TESTS=BASE/'tests'/TASK; APP=TESTS/'app'+QT=Path('C:/veyra-deps/qt-veyra/6.8.3/msvc2022_64')+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/field-upgrade-control.py')],check=True)+label=sys.argv[1]+if not label.replace('-','').isalnum():raise ValueError('label')+out=TESTS/label;out.mkdir(parents=True,exist_ok=False)+tmp=BASE/'tmp'/TASK/label;tmp.mkdir(parents=True,exist_ok=False)+if not APP.exists():shutil.copytree(BASE/'releases/2.0.2/Veyra-2.0.2-win64-portable',APP)+for name in ('veyra_qml_ui','veyra_qml_quick_tests','veyra_capture_audio_tests','veyra_xbox_tests','veyra_lmxxf_nr_tests','veyra_export_probe','veyra_ui_i18n_tests','veyra_preset_library_tests'):+ shutil.copy2(BUILD/(name+'.exe'),APP/(name+'.exe'))+shutil.copytree(BUILD/'lmxxf-test-runtime',APP/'lmxxf-test-runtime',dirs_exist_ok=True)+shutil.copytree(ROOT/'qml',APP/'qml',dirs_exist_ok=True)+shutil.copytree(ROOT/'tests/qml/quick',APP/'qml-tests',dirs_exist_ok=True)+for name in ('Qt6Test.dll','Qt6QuickTest.dll'):shutil.copy2(QT/'bin'/name,APP/name)+env=os.environ.copy();env.update(TEMP=str(tmp),TMP=str(tmp),+ QT_QPA_PLATFORM='offscreen',QT_QUICK_BACKEND='software',QT_QUICK_CONTROLS_STYLE='Basic',+ QML_DISABLE_DISK_CACHE='1',QT_FORCE_STDERR_LOGGING='1',+ QT_QPA_PLATFORM_PLUGIN_PATH=str(QT/'plugins/platforms'),+ PATH=str(QT/'bin')+os.pathsep+str(APP)+os.pathsep+env['PATH'])+results=[]+cases=[('qml-software',['.\\veyra_qml_quick_tests.exe']),+ ('xbox-loopback',['.\\veyra_xbox_tests.exe']),+ ('xbox-float-output',['.\\veyra_capture_audio_tests.exe','--xbox-float-rtp']),+ ('amd-abi-copy',['.\\veyra_lmxxf_nr_tests.exe']),+ ('ui-i18n',['.\\veyra_ui_i18n_tests.exe']),+ ('nr-preset-persistence',['.\\veyra_preset_library_tests.exe'])]+if len(sys.argv)>2:cases=[case for case in cases if case[0] in sys.argv[2:]]+if not cases:raise ValueError('No matching tests')+for name,args in cases:+ with (out/(name+'.log')).open('xb') as log:+ try:code=subprocess.run(args,executable=str(APP/Path(args[0]).name),cwd=APP,env=env,stdout=log,stderr=subprocess.STDOUT,timeout=290).returncode+ except subprocess.TimeoutExpired:code=124+ results.append({'test':name,'exit':code});print(results[-1],flush=True)+(out/'summary.json').write_text(json.dumps(results,indent=2),encoding='utf8')+raise SystemExit(any(r['exit'] for r in results))diff --git a/scripts/acceptance/field-upgrade-ui.py b/scripts/acceptance/field-upgrade-ui.pynew file mode 100644index 00000000..f3b27a25--- /dev/null+++ b/scripts/acceptance/field-upgrade-ui.py@@ -0,0 +1,49 @@+"""Actual Qt bridge, NR/SR, NVENC and software background regression, <300 sec."""+import json, os, shutil, subprocess, sys+from pathlib import Path+ROOT=Path(__file__).resolve().parents[2]+BASE=Path('E:/项目/Veyra');TASK='field-upgrade-20261003'+APP=BASE/'tests'/TASK/'app';BUILD=BASE/'build'/TASK+out=BASE/'tests'/TASK/('production-'+sys.argv[1]);out.mkdir(parents=True,exist_ok=False)+tmp=BASE/'tmp'/TASK/('production-'+sys.argv[1]);tmp.mkdir(parents=True,exist_ok=False)+logs=BASE/'logs'/TASK/('production-'+sys.argv[1]);logs.mkdir(parents=True,exist_ok=False)+media=out/'2k30.avi'+env=os.environ.copy();env.update(TEMP=str(tmp),TMP=str(tmp),VEYRA_LOG_FILE=str(logs/'veyra-qml.log'),+ QT_FORCE_STDERR_LOGGING='1',QML_DISABLE_DISK_CACHE='1')+for key in ('QT_QPA_PLATFORM','QT_QUICK_BACKEND','VEYRA_UI_RHI','VEYRA_TEST_IGNORE_RTSS'):+ env.pop(key,None)+with (logs/'fixture.log').open('xb') as log:+ subprocess.run(['ffmpeg','-v','warning','-n','-f','lavfi','-i','testsrc2=size=2560x1440:rate=30',+ '-t','0.8','-c:v','mpeg4','-q:v','3','-threads','2',str(media)],env=env,stdout=log,stderr=subprocess.STDOUT,timeout=60,check=True)+for name in ('veyra_qml_ui.exe',):shutil.copy2(BUILD/name,APP/name)+shutil.copytree(ROOT/'qml',APP/'qml',dirs_exist_ok=True)+(out/'outputs').mkdir()+(logs/'veyra-last-failure.txt').write_text('device\nnvppex.dll\n',encoding='ascii')+main=APP/'qml/Veyra/Main.qml';original=main.read_bytes();source=original.decode('utf8')+expect_rtss='--rtss' in sys.argv+loader='\nLoader { source: '+json.dumps((ROOT/'scripts/acceptance/field-upgrade-ui.qml').as_uri())+'; onLoaded: { item.media='+json.dumps(str(media))+'; item.evidence='+json.dumps(str(out))+'; item.expectRtss='+str(expect_rtss).lower()+' } }\n'+args=['.\\veyra_qml_ui.exe','--page','exp','--size','1280x720','--reduced-motion','--export-out',str(out/'outputs'),+ '--data-dir',str(out/'profile'),'--exit-after','250000']+if not expect_rtss:args.append('--obs-game-capture')+try:+ at=source.rfind('}');main.write_text(source[:at]+loader+source[at:],encoding='utf8')+ with (logs/'console.log').open('xb') as log:+ code=subprocess.run(args,executable=str(APP/'veyra_qml_ui.exe'),cwd=APP,env=env,stdout=log,stderr=subprocess.STDOUT,timeout=270).returncode+finally:main.write_bytes(original)+console=(logs/'console.log').read_text(encoding='utf8',errors='replace')+assert code==0 and 'FIELD_UI_PASS' in console and 'FIELD_UI_FAIL' not in console,console[-5000:]+parent=(logs/'veyra-qml.log').read_text(encoding='utf8',errors='replace')+assert 'export frozen bitrateMbps=18 rateControl=1' in parent and 'export frozen bitrateMbps=24 rateControl=0' in parent+outputs=sorted((out/'outputs').glob('*.mp4'));assert len(outputs)==2,outputs+probes=[]+for file in outputs:+ data=json.loads(subprocess.check_output(['ffprobe','-v','error','-count_frames','-show_streams','-show_format','-of','json',str(file)],env=env,timeout=30))+ stream=next(x for x in data['streams'] if x['codec_type']=='video')+ assert stream['codec_name']=='hevc' and int(stream['width'])==3840 and int(stream['height'])==2160 and int(stream['nb_read_frames'])==24+ probes.append({'output':str(file),'probe':data})+(logs/'outputs.json').write_text(json.dumps(probes,ensure_ascii=False,indent=2),encoding='utf8')+from PIL import Image+im=Image.open(out/'software-background.png').convert('RGBA')+samples=[im.getpixel((12,80)),im.getpixel((640,25)),im.getpixel((1260,710))]+assert all(p[3]==255 and max(p[:3])<130 for p in samples),samples+print('FIELD PRODUCTION PASS',out,'background_pixels',samples,'outputs',len(outputs))diff --git a/scripts/acceptance/field-upgrade-ui.qml b/scripts/acceptance/field-upgrade-ui.qmlnew file mode 100644index 00000000..d13e100f--- /dev/null+++ b/scripts/acceptance/field-upgrade-ui.qml@@ -0,0 +1,88 @@+// Used only in the task's staging copy of Main.qml, with the production bridge.+import QtQuick+Item {+ id: test+ property string media: ""+ property string evidence: ""+ property var appWindow: Window.window+ property int step: 0+ property int ticks: 0+ property bool imageSaved: false+ property bool expectRtss: false+ function find(item,name) {+ if(item.objectName===name)return item+ for(const child of item.children||[]){const hit=find(child,name);if(hit)return hit}+ return null+ }+ function require(ok,why) {+ if(!ok){console.error("FIELD_UI_FAIL",step,why);timer.stop();Qt.quit();throw new Error(why)}+ }+ Connections {+ target: veyra+ function onNotice(message,error) {+ console.log("FIELD_NOTICE",message,error)+ test.require(message.indexOf("NVIDIA App")<0,"obsolete NVIDIA module warning still shown")+ }+ }+ Timer {+ id: timer+ interval: 200;repeat: true;running: true+ onTriggered: {+ if(++test.ticks>1200){test.require(false,"240-second deadline");return}+ if(!test.media.length)return+ const model=veyra.exportQueueModel+ const field=test.find(test.appWindow.contentItem,"export-bitrate-field")+ const start=test.find(test.appWindow.contentItem,"export-start")+ if(test.step===0){+ if(test.ticks<15||!field||!start)return+ test.require(vySoftwareUi&&test.appWindow.color.a===1,"software window background must be opaque")+ if(test.expectRtss)test.require(veyra.overlayCompatActive,"real RTSS automatic compatibility not active")+ test.appWindow.contentItem.grabToImage(result=>{+ test.imageSaved=result.saveToFile(test.evidence+"/software-background.png")+ })+ veyra.nrEnabled=true+ veyra.srEnabled=true+ veyra.videoSrQuality=4+ veyra.exportCompletionSound=false+ veyra.addExportFiles([test.media])+ veyra.exportRateControl=1+ field.forceActiveFocus();field.text="18";field.textEdited()+ test.require(veyra.exportBitrateMbps===18,"valid text not immediately committed")+ veyra.exportHevc=true+ veyra.exportSrTargetIndex=2+ veyra.exportContainer=0+ test.require(field.text==="18"&&veyra.exportBitrateMbps===18,"other export options replaced bitrate draft")+ test.step=1+ }else if(test.step===1){+ if(veyra.exportReadyCount!==1)return+ test.require(start.enabled,"18 Mbps export incorrectly disabled")+ start.clicked()+ test.require(veyra.exportRunning,"production VBR export rejected as invalid")+ veyra.exportBitrateMbps=7 // active worker must keep its frozen 18 Mbps+ test.step=2+ }else if(test.step===2){+ if(veyra.exportRunning)return+ test.require(veyra.exportItems.filter(i=>i.state==="done").length===1,"VBR worker failed")+ veyra.addExportFiles([test.media])+ veyra.exportRateControl=0+ field.forceActiveFocus();field.text="24";field.textEdited()+ test.require(veyra.exportBitrateMbps===24,"24 Mbps input not committed")+ test.step=3+ }else if(test.step===3){+ if(veyra.exportReadyCount!==1)return+ // No other export option is edited between the input and start.+ test.require(start.enabled,"direct CBR export incorrectly disabled")+ start.clicked()+ test.require(veyra.exportRunning,"direct export rejected as invalid")+ veyra.exportBitrateMbps=8+ test.step=4+ }else if(test.step===4){+ if(veyra.exportRunning)return+ test.require(veyra.exportItems.filter(i=>i.state==="done").length===2,"CBR worker failed")+ test.require(test.imageSaved,"background evidence not saved")+ console.log("FIELD_UI_PASS: real bridge + worker, 2K30 AVI -> NR + highest RTX SR 4K, 18 VBR changed-options, 24 CBR direct-start, frozen jobs, opaque software UI, old NVIDIA marker")+ timer.stop();Qt.quit()+ }+ }+ }+}diff --git a/scripts/amd-nr/build-lmxxf-runtime.py b/scripts/amd-nr/build-lmxxf-runtime.pynew file mode 100644index 00000000..e9629903--- /dev/null+++ b/scripts/amd-nr/build-lmxxf-runtime.py@@ -0,0 +1,36 @@+"""Build the pinned MIT runtime from its original checkout; no injection module."""+import argparse, os, re, subprocess+from pathlib import Path++PIN = '78f548749e74824327b8458c57be31a1df78376a'+p = argparse.ArgumentParser()+p.add_argument('--source', type=Path, required=True)+p.add_argument('--build', type=Path, required=True)+p.add_argument('--tmp', type=Path, required=True)+p.add_argument('--log', type=Path, required=True)+a = p.parse_args()+source = a.source.resolve()+head = subprocess.check_output(['git','rev-parse','HEAD'],cwd=source,text=True).strip()+if head != PIN or subprocess.check_output(['git','diff','--name-only','HEAD'],cwd=source):+ raise SystemExit('Expected an unchanged pinned upstream checkout')+attributes = []+for file in (source/'src').glob('*.h'):+ attributes += re.findall(r'__attribute__\(\(([^)]*)\)\)', file.read_text(encoding='utf8'))+for file in (source/'Development/HIP').glob('*.h'):+ attributes += re.findall(r'__attribute__\(\(([^)]*)\)\)', file.read_text(encoding='utf8'))+if not attributes or any(x != 'noinline' for x in attributes):+ raise SystemExit('Review MSVC compatibility shim for changed GNU attributes')+for target in (a.build,a.tmp,a.log.parent):+ target.resolve().relative_to(Path('E:/项目/Veyra').resolve())+ target.mkdir(parents=True,exist_ok=True)+script = a.tmp/'lmxxf-build.cmd'+script.write_text('@echo off\ncall "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat" >nul 2>&1\nif errorlevel 1 exit /b 4\ncd /d "%LMXXF_TASK_BUILD%"\ncl /nologo /std:c++17 /EHsc /O2 /LD /MD /FI"%LMXXF_TASK_COMPAT%" /DNOMINMAX /D_WIN32_WINNT=0x0A00 /DLMXXF_NR_RUNTIME_EXPORTS /I"%LMXXF_TASK_SOURCE%\\include" /I"%LMXXF_TASK_SOURCE%\\src" /I"%LMXXF_TASK_SOURCE%\\Development\\HIP" "%LMXXF_TASK_SOURCE%\\src\\LmxxfNrRuntime.cpp" /Fe:LmxxfNrRuntime.dll /link d3d12.lib dxgi.lib d3dcompiler.lib dxguid.lib user32.lib\nexit /b %errorlevel%\n',encoding='ascii')+env=os.environ.copy()+env.update(LMXXF_TASK_SOURCE=str(source),LMXXF_TASK_BUILD=str(a.build.resolve()),+ LMXXF_TASK_COMPAT=str(Path(__file__).with_name('msvc-compat.h').resolve()),+ TEMP=str(a.tmp.resolve()),TMP=str(a.tmp.resolve()),VSLANG='1033')+with a.log.open('xb') as log:+ code=subprocess.run(['cmd.exe','/d','/c',str(script.resolve())],cwd=source,env=env,+ stdout=log,stderr=subprocess.STDOUT,timeout=290).returncode+print('LMXXF BUILD',code,a.log)+raise SystemExit(code)diff --git a/scripts/amd-nr/msvc-compat.h b/scripts/amd-nr/msvc-compat.hnew file mode 100644index 00000000..184e013a--- /dev/null+++ b/scripts/amd-nr/msvc-compat.h@@ -0,0 +1,5 @@+// lmxxf 78f548749e74824327b8458c57be31a1df78376a: the only GNU attribute+// used by this runtime is __attribute__((noinline)); map it for MSVC.+#ifdef _MSC_VER+#define __attribute__(x) __declspec(noinline)+#endifdiff --git a/scripts/amd-nr/prepare-local-runtime.py b/scripts/amd-nr/prepare-local-runtime.pynew file mode 100644index 00000000..66eae287--- /dev/null+++ b/scripts/amd-nr/prepare-local-runtime.py@@ -0,0 +1,76 @@+"""Audit and stage user-provided 0.39 assets, separately from source Git.++No Magpie executable, proxy dxgi.dll or ReShade add-on is copied. The model+weights are NVIDIA-derived assets and are not covered by the code's MIT license.+"""+import argparse, collections, ctypes, hashlib, json, shutil, subprocess+from pathlib import Path++PIN='78f548749e74824327b8458c57be31a1df78376a'+p=argparse.ArgumentParser()+p.add_argument('--package',type=Path,required=True,help='Extracted user package')+p.add_argument('--source',type=Path,required=True)+p.add_argument('--dll',type=Path,required=True)+p.add_argument('--out',type=Path,required=True)+a=p.parse_args()+a.out.resolve().relative_to(Path('E:/项目/Veyra').resolve())+if a.out.exists():raise SystemExit('Output must be a new directory')+if subprocess.check_output(['git','rev-parse','HEAD'],cwd=a.source,text=True).strip()!=PIN:+ raise SystemExit('Unexpected upstream source revision')+def sha(path):return hashlib.sha256(path.read_bytes()).hexdigest()+count=0+for line in (a.package/'SHA256SUMS.txt').read_text(encoding='utf-8-sig').splitlines():+ digest,name=line.split(None,1);file=(a.package/name.lstrip('*')).resolve()+ file.relative_to(a.package.resolve())+ if not file.is_file() or sha(file)!=digest.lower():raise SystemExit('Package checksum mismatch: '+name)+ count+=1+assets=a.package/'DLSS5-AMD/native-game-tiled-assets'+extensions=collections.Counter(f.suffix for f in assets.rglob('*') if f.is_file())+if extensions['.f16']!=122 or extensions['.f32']!=64 or extensions['.hsaco']!=62:+ raise SystemExit('Expected the reviewed 0.39 weight/kernel set')+a.out.mkdir(parents=True)+shutil.copytree(assets,a.out/'assets')+shutil.copy2(a.dll,a.out/'LmxxfNrRuntime.dll')+shutil.copy2(a.source/'LICENSE',a.out/'LICENSE-lmxxf-MIT.txt')+shutil.copy2(a.package/'HIP-API-LICENSE.txt',a.out/'HIP-API-LICENSE.txt')+# The independent C ABI uses its own current linear encode/decode shaders.+# Overlay the pinned source shader files, preserving unchanged binary weights.+for file in (a.source/'shaders').glob('*.hlsl'):+ shutil.copy2(file,a.out/'assets'/file.name)+hip=a.out/'assets/HIP'+kernel_sums=''.join(sha(f)+' '+f.relative_to(hip).as_posix()+'\n' for f in sorted(hip.rglob('*.hsaco')))+(hip/'SHA256SUMS').write_text(kernel_sums,encoding='ascii')+# Preserve the supplied kernel choices and skip policy. Add-on display/codec+# settings are intentionally not copied to the independent runtime.+keys=[]+for line in (a.package/'DLSS5-AMD/native-game-flags.txt').read_text(encoding='utf-8-sig').splitlines():+ if line.startswith('DLSS5_HIP_') or line.startswith(('DLSS5_SKIP_BLOCKS=','DLSS5_NETWORK_HEIGHT=','DLSS5_NETWORK_1080_ROWS=','DLSS5_STYLE=','DLSS5_DIRECT_IO=')):+ keys.append(line)+keys+=['DLSS5_FAST_NUMERIC=0','DLSS5_FRAME_STATS=0']+(a.out/'assets/native-game-flags.txt').write_text('\n'.join(keys)+'\n',encoding='ascii')+(a.out/'LOCAL-EXPERIMENT.txt').write_text('Veyra AMD NR local experiment\nRuntime code: lmxxf MIT, '+PIN+'\nAssets: user-provided Magpie-DLSS5-AMD 0.39 package. NVIDIA-derived model weights are not MIT code.\nRequires AMD RX 9000 and driver-provided amdhip64_7.dll; do not copy a driver from another machine.\nNo ReShade/Magpie injection module is loaded by Veyra. AMD inference/quality not verified on this RTX 5070.\nInternal input: height <=1080, <=1920x1080 pixels; native export above this budget is rejected.\nHDR is rejected. Keep process DLSS5_CODEC_SRGB/DLSS5_VIT_ADAPTIVE absent or 0.\n',encoding='utf8')+files=[{'path':f.relative_to(a.out).as_posix(),'size':f.stat().st_size,'sha256':sha(f)} for f in sorted(a.out.rglob('*')) if f.is_file()]+report={'upstream':PIN,'asset_package':str(a.package.resolve()),'package_checksums':count,+ 'weight_files':186,'mapping_files':2,'hip_modules':62,'architectures':['gfx1200','gfx1201'],+ 'inference_verified':False,'files':files}+(a.out/'amd-nr-local-manifest.json').write_text(json.dumps(report,ensure_ascii=False,indent=2),encoding='utf8')+# Read the real runtime's ABI and validate the supplied module layout without+# attempting HIP inference or supplying fake output as a product fallback.+class Api(ctypes.Structure):+ _fields_=[('size',ctypes.c_uint32),('abi',ctypes.c_uint32)]+[(n,ctypes.c_void_p) for n in ['QueryCapabilities','Create','Destroy','PrepareSession','PrepareFrame','RecordInputs','EnqueueHip','RecordOutputs','ExecuteAfterProducer','CancelUnsubmitted','Poll','Retire','ResetHistory','Drain','GetStatus','GetLastError','GetTimings']]+class Caps(ctypes.Structure):+ _fields_=[(n,ctypes.c_uint32) for n in ['size','abi','width','height','history','overlap','graph','hip','gfx1201']]+class CreateInfo(ctypes.Structure):+ _fields_=[('size',ctypes.c_uint32),('device',ctypes.c_void_p),('queue',ctypes.c_void_p),('assets',ctypes.c_wchar_p),('flags',ctypes.c_uint32)]+dll=ctypes.WinDLL(str((a.out/'LmxxfNrRuntime.dll').resolve()),winmode=0x1100)+api=Api();api.size=ctypes.sizeof(api)+get=dll.LmxxfNrGetApi;get.argtypes=[ctypes.c_uint32,ctypes.POINTER(Api)];get.restype=ctypes.c_int32+assert get(1,ctypes.byref(api))==0 and api.abi==1+caps=Caps();caps.size=ctypes.sizeof(caps)+assert ctypes.CFUNCTYPE(ctypes.c_int32,ctypes.POINTER(Caps))(api.QueryCapabilities)(ctypes.byref(caps))==0+info=CreateInfo();info.size=ctypes.sizeof(info);info.device=info.queue=1;info.assets=str((a.out/'assets').resolve())+ctx=ctypes.c_void_p()+status=ctypes.CFUNCTYPE(ctypes.c_int32,ctypes.POINTER(CreateInfo),ctypes.POINTER(ctypes.c_void_p))(api.Create)(ctypes.byref(info),ctypes.byref(ctx))+assert status==0 and ctx.value,'Real runtime rejected the audited module layout'+assert ctypes.CFUNCTYPE(ctypes.c_int32,ctypes.c_void_p)(api.Destroy)(ctx)==0+print('AMD RESOURCE PASS',count,'package hashes;',186,'weights;',62,'HIP modules; real ABI/layout admitted. No AMD inference test.',a.out)diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cppindex 9deab8c1..0a7a5576 100644--- a/src/engine/EngineController.cpp+++ b/src/engine/EngineController.cpp@@ -20,6 +20,7 @@#include "veyra/source/MediaFileSource.h"#include "veyra/source/CaptureCardSource.h"#include "veyra/source/ScreenCaptureSource.h"+#include "veyra/xbox/DisconnectPolicy.h"#ifdef VEYRA_ENABLE_REMOTEPLAY#include "veyra/source/RemotePlaySessionSource.h"#endif@@ -312,6 +313,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s#endif#ifdef VEYRA_ENABLE_XBOXauto xb=xboxRequest?std::make_shared<source::XboxSessionSource>():nullptr;+ xbox::ReconnectBudget xboxReconnectBudget;const bool isXbox=bool(xb);{std::lock_guard lock(mutex_);activeXbox_=xb;}#else@@ -414,8 +416,8 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sstatus(L"正在连接 Xbox…");ctx.device()->AddRef();xboxRequest->decodeDevice=std::shared_ptr<ID3D12Device>(ctx.device(),[](ID3D12Device* device){device->Release();});ctx.directQueue()->AddRef();xboxRequest->decodeQueue=std::shared_ptr<ID3D12CommandQueue>(ctx.directQueue(),[](ID3D12CommandQueue* queue){queue->Release();});- if(!xb->connect(std::move(*xboxRequest))){const auto message=xb->stats().message;status(message.empty()?L"Xbox 串流连接失败,请查看诊断":message,true);break;}- xboxRequest.reset();+ xboxRequest->stopRequested=&stop_;+ if(!xb->connect(*xboxRequest)){const auto message=xb->stats().message;status(message.empty()?L"Xbox 串流连接失败,请查看诊断":message,true);break;}const auto firstFrameDeadline=Clock::now()+std::chrono::seconds(20);while(!stop_){const AVFrame* first=nullptr;const auto result=xb->read(cachedPacket,&first);@@ -1346,7 +1348,42 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sif(moon){const auto message=moon->stats().message;status(message.empty()?L"串流中断,请检查主机和网络后重新连接。":message,true);break;}#endif#ifdef VEYRA_ENABLE_XBOX- if(xb){const auto message=xb->stats().message;status(message.empty()?L"Xbox 串流中断,请重新连接。":message,true);break;}+ if(xb){+ const auto failure=xb->stats();+ if(failure.reconnectable && xboxRequest && !stop_){+ xboxReconnectBudget.disconnected();+ drainLivePresentation();+ if(!ring.drainQueue()){status(L"Xbox 重连时 GPU 排空失败",true);break;}+ xb->videoReset();av_frame_free(&cachedFrame);out={};hasOutput=false;+ bool recovered=false;+ while(!stop_ && xboxReconnectBudget.take()){+ const auto attempt=xboxReconnectBudget.attempts();+ status(std::format(L"Xbox 串流中断({}),正在重连 {}/3…",std::wstring(failure.disconnectReason.begin(),failure.disconnectReason.end()),attempt));+ veyra::log::warn("xbox-reconnect",std::format("attempt={} reason={}",attempt,failure.disconnectReason));+ for(unsigned wait=0;wait<attempt*10&&!stop_;++wait)std::this_thread::sleep_for(std::chrono::milliseconds(100));+ if(stop_)break;+ if(!xb->connect(*xboxRequest))continue;+ const auto deadline=Clock::now()+std::chrono::seconds(20);+ while(!stop_&&Clock::now()<deadline){+ const AVFrame* first=nullptr;+ const auto result=xb->read(cachedPacket,&first);+ if(result==source::SourceReadStatus::Frame){cachedFrame=av_frame_clone(first);recovered=cachedFrame!=nullptr;break;}+ if(result==source::SourceReadStatus::Error)break;+ std::this_thread::sleep_for(std::chrono::milliseconds(2));+ }+ if(recovered)break;+ xb->close();+ }+ if(recovered){+ initialRemoteFramePending=true;reset=true;pendingResetCause=pipeline::ResetReason::SourceSwitch;+ status(L"Xbox 已重新连接");veyra::log::info("xbox-reconnect","first decoded frame received; reset all graph history");+ continue;+ }+ if(stop_)break;+ status(L"Xbox 重连失败:"+xb->stats().message,true);break;+ }+ status(failure.message.empty()?L"Xbox 串流中断,请重新连接。":failure.message,true);break;+ }#endifstatus(isScreen?screenSource.status():isCapture?L"采集信号中断,请检查设备连接或格式":source.errorMessage().empty()?L"视频解码或时间戳错误":source.errorMessage(),true);break;}}@@ -1387,6 +1424,9 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s}if(!halfRate)captureSampler.reset();if(isImage)pkt.sequence=1;+#ifdef VEYRA_ENABLE_XBOX+ if(xb&&!rereadCached)xboxReconnectBudget.decoded(monotonic100ns());+#endifif(!rereadCached)++sourceFrames;const double decodeMs=elapsedMs(decodeStart);decodeTimes.add(decodeMs);loopTrace.mark("read");diff --git a/src/pipeline/EnhanceGraph.cpp b/src/pipeline/EnhanceGraph.cppindex 9a22f401..73e7f394 100644--- a/src/pipeline/EnhanceGraph.cpp+++ b/src/pipeline/EnhanceGraph.cpp@@ -435,12 +435,15 @@ bool EnhanceGraph::initialize(const EnhanceGraphDesc& desc)veyra::log::info("pipeline-order",desc.splitNrAcrossSr()?"NR(source) -> SR -> NR(work) -> FG (node preview)":desc.nrBeforeSr?"NR -> residual(source) -> SR -> FG (experimental preview)":"SR -> NR -> residual -> FG");if(!desc.videoHdr.valid()||(desc.hdrOutput&&!desc.hdrInput&&!desc.convertVideoHdr())){veyra::log::error("hdr","HDR output requires native HDR input or explicit Video HDR conversion");return false;}srEnabled_ = desc.enableSr && (srcW_ != workW_ || srcH_ != workH_);- nrEnabled_ = desc.enableNr && !desc.noFeatures && !desc.noNgx;+ lmxxfNr_ = context_.adapter().vendorId == 0x1002 || desc.nrRuntime == engine::NrRuntime::LmxxfAmd;+ if(context_.adapter().vendorId==0x1002 && desc_.opticalFlowBackend==engine::OpticalFlowBackend::Nvidia)+ desc_.opticalFlowBackend=engine::OpticalFlowBackend::AmdFidelityFx;+ nrEnabled_ = desc.enableNr && !desc.noFeatures && (!desc.noNgx || lmxxfNr_);fgEnabled_ = desc.enableFg && !desc.noFeatures && !desc.stillImage &&desc.frameGenerationBackend != engine::FrameGenerationBackend::XeSS &&(!desc.noNgx || engine::fsrFrameGeneration(desc.frameGenerationBackend));nvofStandalone_ = desc.enableNvofStandalone && !desc.noFeatures;- if(desc.opticalFlowBackend==engine::OpticalFlowBackend::AmdFidelityFx&&desc.amdFlowHalfResolution){nvofW_=std::max(1u,nvofW_/2);nvofH_=std::max(1u,nvofH_/2);}+ if(desc_.opticalFlowBackend==engine::OpticalFlowBackend::AmdFidelityFx&&desc.amdFlowHalfResolution){nvofW_=std::max(1u,nvofW_/2);nvofH_=std::max(1u,nvofH_/2);}uint64_t budget=0,usage=0;// Every NR layer allocates its own full set of textures, and a stabilised// layer adds two history/guide pairs on top. The stack is bounded (16 nodes),@@ -1025,21 +1028,21 @@ bool EnhanceGraph::initFsrFg() {bool EnhanceGraph::initNgxFeatures(){+ Status st = Status::Ok;failedBackend_=engine::FailedBackend::NgxCore;if(desc_.convertVideoHdr()&&(desc_.noNgx||desc_.noFeatures)){failedBackend_=engine::FailedBackend::VideoHdr;return false;}- if (desc_.noNgx || desc_.noFeatures || (!nrEnabled_&&!srEnabled_&&!fgEnabled_&&!desc_.convertVideoHdr())) {+ if ((desc_.noNgx && !lmxxfNr_) || desc_.noFeatures || (!nrEnabled_&&!srEnabled_&&!fgEnabled_&&!desc_.convertVideoHdr())) {veyra::log::info("graph", "NGX core/features skipped by disabled-feature configuration");return true;}// FSR upscaling is a FidelityFX effect: a session whose only feature is// FSR SR must not require (or fail on) the NGX core.- const bool needNgxCore = nrEnabled_ || (fgEnabled_ && !fsrEnabled()) || desc_.convertVideoHdr() ||+ const bool needNgxCore = (nrEnabled_ && !lmxxfNr_) || (fgEnabled_ && !fsrEnabled()) || desc_.convertVideoHdr() ||(srEnabled_ && desc_.videoSrQuality!=engine::kVideoSrFsr);if (!needNgxCore) {- veyra::log::info("graph", "NGX core skipped: AMD FSR upscaling is the only enabled stage");- failedBackend_=engine::FailedBackend::None;- return true;+ veyra::log::info("graph", "NGX core skipped: lmxxf NR / AMD FSR stages use their own runtimes");}+ if(needNgxCore){// Read the local NGX identity (same loader contract as the probes).std::ifstream ids(std::wstring(desc_.runtimeAbsPath) + L"\\..\\config\\ngx-local.json",std::ios::binary);@@ -1150,7 +1153,7 @@ bool EnhanceGraph::initNgxFeatures()if(desc_.enableFg&&(desc_.fgMultiplier<2||desc_.fgMultiplier>6||(aboveCapability&&!forceAboveCapability))){veyra::log::error("graph",std::format("requested MFG multiplier unsupported request={} maxGeneratedFrames={}",desc_.fgMultiplier,fgCaps.multiFrameCountMax));return false;}}- if(nrEnabled_){+ if(nrEnabled_ && !lmxxfNr_){failedBackend_=engine::FailedBackend::Nr;if(!engine::validNrRuntime(desc_.nrRuntime))return false;const auto selectedNr=engine::currentNrRuntime(desc_.nrRuntime);@@ -1182,6 +1185,8 @@ bool EnhanceGraph::initNgxFeatures()if(!ring_.submitAndSignal(0)||!ring_.waitIdle())return false;}+ } // needNgxCore+// NR layers: one instance per requested layer, each owning its textures and// history. The snippet session is shared (one adapter, one IAT shim), which// is exactly the structure Magpie uses for its multi-pass DLSSNR.@@ -1216,6 +1221,15 @@ bool EnhanceGraph::initNgxFeatures()instance->residualSettings = index < desc_.nrLayersResidual.size() ? desc_.nrLayersResidual[index] : desc_.residual;instance->protection = index < desc_.nrLayersProtection.size() ? desc_.nrLayersProtection[index] : desc_.protection;instance->temporalEnabled = index < desc_.nrLayersTemporal.size() ? desc_.nrLayersTemporal[index] : desc_.nrTemporal;+ if(lmxxfNr_){+ failedBackend_=engine::FailedBackend::Nr;+ // The upstream ABI owns encode/network/decode; feed the stable+ // linear layer texture directly and use Veyra's shared composite.+ if(desc_.hdrWorking()){veyra::log::error("amd-nr","HDR input is not yet validated for this adapter; NR disabled by backend fallback");return false;}+ instance->amd=std::make_unique<LmxxfNrBackend>();+ const auto directory=std::filesystem::path(desc_.runtimeAbsPath)/L".."/L"amd-nr";+ if(!instance->amd->open(directory.lexically_normal(),context_.device(),context_.directQueue(),context_.adapter().vendorId) || !instance->amd->admits(extent.width,extent.height))return false;+ }veyra::log::info("resolution",std::format("NR layer={} internal={}x{} composite={}x{} sharedMotion={}",index+1,extent.width,extent.height,fullW,fullH,motion!=nullptr));nrInstances_.push_back(std::move(instance));@@ -1224,7 +1238,7 @@ bool EnhanceGraph::initNgxFeatures()}// NR feature create (8.5 create parameter contract), one handle per layer.- for (size_t layerIndex = 0; nrEnabled_ && layerIndex < nrInstances_.size(); ++layerIndex) {+ for (size_t layerIndex = 0; nrEnabled_ && !lmxxfNr_ && layerIndex < nrInstances_.size(); ++layerIndex) {auto* layer = nrInstances_[layerIndex].get();const uint32_t nrW=layer->width(),nrH=layer->height();namespace p = ngx::dlssnr;@@ -1425,6 +1439,12 @@ bool EnhanceGraph::createComputePasses()return true;}+bool EnhanceGraph::submitGraph(uint32_t slot) {+ if(!ring_.submitAndSignal(slot))return false;+ for(auto& layer:nrInstances_)if(layer->amd && !layer->amd->retireSubmitted()) { failedBackend_=engine::FailedBackend::Nr; return false; }+ return true;+}+bool EnhanceGraph::createViews(){// Descriptor initialization is DEFAULT ON since the RAW-upload-SRV removal@@ -2177,7 +2197,7 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frameif (prevValid_ && !gpuDis_) {if(!amdOf_){gpuTimer_.mark(list,GpuStage::Flow);- if(!ring_.submitAndSignal(slot))return false;+ if(!submitGraph(slot))return false;cpuTrace.mark("flowPrepare");haveFlow=nvof_->execute(ring_.lastSignaledValue(),st);cpuTrace.mark("nvofExecute");@@ -2388,7 +2408,7 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame}auto* layer = nrInstances_[layerIndex].get();const uint32_t sourceW=layer->fullWidth(),sourceH=layer->fullHeight();- if (layer->handle() == nullptr || !layer->enabled) continue;+ if ((layer->handle() == nullptr && !layer->amd) || !layer->enabled) continue;if(interNrColorActiveCount_){const auto& plan=*desc_.fixedExecutionPlan;for(uint32_t i=0;i<plan.stepCount;++i){@@ -2419,6 +2439,7 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frametracker_.uavBarrier(list, layer->input());tracker_.transition(list, layer->input(), D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);}+ if(!lmxxfNr_){tracker_.transition(list, layer->proxy(), D3D12_RESOURCE_STATE_UNORDERED_ACCESS);const float constants[8] = {1.0f, 1.0f, 1.0f, desc_.hdrWorking() ? 1.0f : 0.0f,uintBits(nrW), uintBits(nrH), 0.0f, 0.0f};@@ -2430,14 +2451,36 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Framelist->Dispatch((nrW + 15) / 16, (nrH + 15) / 16, 1);tracker_.uavBarrier(list, layer->proxy());tracker_.transition(list, layer->proxy(), D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);+ }(void)stageInput;if (layerIndex == 0 && desc_.stageMark) desc_.stageMark("encode");cpuTrace.mark("nrPrepare");}+ if(layer->amd){+ failedBackend_=engine::FailedBackend::Nr;+ gpuTimer_.mark(list,GpuStage::Nr);+ gpuTimer_.mark(list,diagnostics::nrLayerStage(unsigned(layerIndex)));+ if(!layer->amd->recordInputs(list,layer->input(),realFrameIndex_+1,reset||!layer->historyValid||layer->inputRevision!=1,layer->model.intensity))return false;+ // Same direct queue, producer -> HIP handoff -> consumer. No+ // CPU wait on this frame; only the normal allocator reuse bound.+ if(!submitGraph(slot)||!layer->amd->enqueue())return false;+ list=ring_.acquireNext(slot,st);if(!list)return false;+ 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);+ gpuTimer_.mark(list,GpuStage::Nr,true);+ gpuTimer_.mark(list,diagnostics::nrLayerStage(unsigned(layerIndex)),true);+ ++metrics_.nrEvaluateCount;layer->historyValid=true;layer->inputRevision=1;+ if(layerIndex+1<nrInstances_.size())compositeNrLayer(layerIndex);+ if(desc_.splitNrAcrossSr()&&desc_.stageMark)desc_.stageMark("nr-layer");+ failedBackend_=engine::FailedBackend::None;+ continue;+ }+// 4b. Evaluate on a FRESH list: a snippet constraint that the// single-layer path also honoured.- if (!ring_.submitAndSignal(slot)) { veyra::log::error("graph", "submit before nr"); return false; }+ if (!submitGraph(slot)) { veyra::log::error("graph", "submit before nr"); return false; }ID3D12GraphicsCommandList* nlist = ring_.acquireNext(slot, st);if (nlist == nullptr) { veyra::log::error("graph", "acquire nr list"); return false; }cpuTrace.mark("nrAcquire");@@ -2667,7 +2710,7 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frameout.fgRecovery=runFg&&(fgHistorySkipped_||reseedRejected);if(fgBackendAvailable&&!runFg){out.fgSkippedBeforeEval=out.fgCandidates;fgHistorySkipped_=true;}if(!runFg)gpuTimer_.resolve(list);- if (!ring_.submitAndSignal(slot)) return false;+ if (!submitGraph(slot)) return false;if(!runFg)gpuTimer_.submitted(ring_.lastSignaledValue());out.videoFenceValue = ring_.lastSignaledValue();out.videoFenceObject = context_.fence();@@ -2728,7 +2771,7 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frametracker_.transition(flist,genFrame_[generatedSlot].Get(),D3D12_RESOURCE_STATE_COMMON);tracker_.transition(flist,depthTex_.Get(),D3D12_RESOURCE_STATE_COMMON);if(sub==fgCalls)gpuTimer_.resolve(flist);- if(!ring_.submitAndSignal(slot))return false;+ if(!submitGraph(slot))return false;if(sub==fgCalls)gpuTimer_.submitted(ring_.lastSignaledValue());out.hasGenerated=!resetFg;out.genSlot=parity; out.genFenceValue=ring_.lastSignaledValue();@@ -2839,7 +2882,9 @@ bool EnhanceGraph::applySettings(const engine::EnhancementSettings& s){// but has this NGX-only stage explicitly disabled in the graph. Do not// reject unrelated live settings in that degraded, playable state.if(s.nr&&desc_.enableNr&&!nrCreated())return false;- if(s.opticalFlowBackend!=desc_.opticalFlowBackend||s.amdFlowHalfResolution!=desc_.amdFlowHalfResolution)return false;+ const auto requestedFlow=context_.adapter().vendorId==0x1002&&s.opticalFlowBackend==engine::OpticalFlowBackend::Nvidia+ ?engine::OpticalFlowBackend::AmdFidelityFx:s.opticalFlowBackend;+ if(requestedFlow!=desc_.opticalFlowBackend||s.amdFlowHalfResolution!=desc_.amdFlowHalfResolution)return false;// DLSS allocates multiplier-specific feature/output resources.// XeSS has a fixed 2X proxy swapchain contract. Settings callers must// rebuild instead of accepting a change that cannot take effect in place.@@ -2979,6 +3024,7 @@ void EnhanceGraph::shutdown()// requires release before Shutdown1, and each handle was created on this// same session, so the order is simply back-to-front of creation.for(auto& layer:nrInstances_){+ layer->amd.reset(); // drain HIP while the borrowed graph input/queue still existif(layer->handle()==nullptr)continue;uint64_t layerResult=0;uint32_t layerSeh=0;(void)nrAdapter_->snippetReleaseFeature(layer->handle(),layerResult,layerSeh);diff --git a/src/pipeline/LmxxfNrBackend.cpp b/src/pipeline/LmxxfNrBackend.cppnew file mode 100644index 00000000..b73dc6d8--- /dev/null+++ b/src/pipeline/LmxxfNrBackend.cpp@@ -0,0 +1,113 @@+// SPDX-License-Identifier: GPL-3.0-only+#include "veyra/pipeline/LmxxfNrBackend.h"+#include "veyra/Log.h"+#include <atomic>+#include <format>+#include <algorithm>+#include <cmath>+#include <cstdlib>++namespace veyra::pipeline {+bool LmxxfNrBackend::result(int32_t code, const char* operation) {+ if (code == LMXXF_NR_OK) return true;+ char detail[2048]{};+ if (api_.GetLastError) api_.GetLastError(detail, sizeof(detail));+ error_ = std::format("{} code={} {}", operation, code, detail);+ log::error("amd-nr", error_);+ return false;+}+bool LmxxfNrBackend::open(const std::filesystem::path& directory, ID3D12Device* device, ID3D12CommandQueue* queue, uint32_t vendor) {+ close(); error_.clear();+ if (vendor != 0x1002 || !device || !queue || !directory.is_absolute()) {+ error_ = "lmxxf NR requires an AMD adapter, a D3D12 queue and an absolute runtime directory";+ log::error("amd-nr", error_); return false;+ }+ const auto path = directory / L"LmxxfNrRuntime.dll";+ module_ = LoadLibraryExW(path.c_str(), nullptr, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32);+ if (!module_) { error_ = std::format("LmxxfNrRuntime.dll load failed win32={}", GetLastError()); log::error("amd-nr", error_); return false; }+ const auto getApi = reinterpret_cast<decltype(&LmxxfNrGetApi)>(GetProcAddress(module_, "LmxxfNrGetApi"));+ if (!getApi) { error_ = "LmxxfNrGetApi export is missing"; log::error("amd-nr",error_); close(); return false; }+ api_.struct_size = sizeof(api_);+ int32_t status = getApi(LMXXF_NR_ABI_VERSION, &api_);+ if (status == LMXXF_NR_INVALID_ARGUMENT) { api_ = {}; api_.struct_size = LMXXF_NR_API_V1_SIZE; status = getApi(LMXXF_NR_ABI_VERSION, &api_); }+ if (status != LMXXF_NR_OK || api_.struct_size < LMXXF_NR_API_V1_SIZE || api_.abi_version != LMXXF_NR_ABI_VERSION ||+ !api_.QueryCapabilities || !api_.Create || !api_.Destroy || !api_.PrepareSession ||+ !api_.PrepareFrame || !api_.RecordInputs || !api_.EnqueueHip || !api_.RecordOutputs ||+ !api_.CancelUnsubmitted || !api_.Retire || !api_.ResetHistory || !api_.Drain || !api_.GetLastError) {+ error_ = std::format("invalid lmxxf ABI/function table code={}", status); log::error("amd-nr", error_); close(); return false;+ }+ caps_.struct_size = sizeof(caps_);+ if (!result(api_.QueryCapabilities(&caps_), "QueryCapabilities") || caps_.abi_version != LMXXF_NR_ABI_VERSION || !caps_.max_input_width || !caps_.max_input_height) { close(); return false; }+ // The add-on's sRGB input mode is incompatible with Veyra's linear FP16+ // contract. Runtime flags ignore that file key, but a process environment+ // override still reaches the upstream codec. Do not silently change it.+ const auto* srgb=std::getenv("DLSS5_CODEC_SRGB");+ const auto* adaptive=std::getenv("DLSS5_VIT_ADAPTIVE");+ if((srgb&&std::string_view(srgb)=="1") || (!caps_.history_supported&&adaptive&&std::string_view(adaptive)!="0"&&*adaptive)){+ error_="Veyra AMD NR requires DLSS5_CODEC_SRGB=0 and DLSS5_VIT_ADAPTIVE=0: linear input and source-reset isolation";+ log::error("amd-nr",error_);close();return false;+ }+ const auto assets = directory / L"assets";+ LmxxfNrCreateInfo info{}; info.struct_size = sizeof(info); info.device = device; info.queue = queue;+ info.assets_directory = assets.c_str(); // flags=0: a failed network is never passed off as NR+ if (!result(api_.Create(&info, &context_), "Create") || !context_ || !result(api_.PrepareSession(context_), "PrepareSession")) { close(); return false; }+ queue_ = queue;+ static std::atomic<uint64_t> next{1}; session_ = next++;+ log::info("amd-nr", std::format("lmxxf ABI={} session={} maxInput={}x{}; module metadata admitted, HIP inference initializes on first frame", api_.abi_version, session_, caps_.max_input_width, caps_.max_input_height));+ return true;+}+bool LmxxfNrBackend::admits(uint32_t w, uint32_t h) const {+ return ready() && w && h && w <= 2560 && h <= caps_.max_input_height && uint64_t(w)*h <= uint64_t(caps_.max_input_width)*caps_.max_input_height;+}+bool LmxxfNrBackend::recordInputs(ID3D12GraphicsCommandList* list, ID3D12Resource* color, uint64_t frame, bool reset, float intensity) {+ if (!ready() || job_.handle || !list || !color) { error_ = "invalid/unretired lmxxf input job"; return false; }+ const auto desc = color->GetDesc();+ if (!admits(uint32_t(desc.Width), desc.Height) || desc.Format != DXGI_FORMAT_R16G16B16A16_FLOAT) { error_ = "lmxxf NR needs linear RGBA16F, height <=1080 and <=1920x1080 pixels (width <=2560)"; log::error("amd-nr", error_); return false; }+ if (reset && !result(api_.ResetHistory(context_), "ResetHistory")) return false;+ LmxxfNrFrameInfo info{}; info.struct_size = sizeof(info); info.session_id = session_;+ info.frame_id = frame; info.list_generation = frame; info.command_list = list;+ info.color = color; info.color_width = uint32_t(desc.Width); info.color_height = desc.Height;+ info.color_state = D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE;+ // Veyra applies residual/protection/temporal controls after the full network output.+ if(!std::isfinite(intensity)) { error_ = "invalid model intensity"; return false; }+ info.flags = LMXXF_NR_FRAME_FLAG_STRENGTH; info.transfer_strength = std::clamp(intensity,0.f,1.f); info.color_strength = info.model_scale = 1;+ info.pre_exposure = info.exposure_scale = 1;+ job_ = {}; job_.struct_size = sizeof(job_);+ int32_t prepared=api_.PrepareFrame(context_,&info,&job_);+ if(prepared==LMXXF_NR_INVALID_ARGUMENT){info.struct_size=LMXXF_NR_FRAME_INFO_V1_SIZE;prepared=api_.PrepareFrame(context_,&info,&job_);}+ if (!result(prepared, "PrepareFrame") || !job_.handle || !job_.private_output) return false;+ auto* output = static_cast<ID3D12Resource*>(job_.private_output);+ const auto out = output->GetDesc();+ if (out.Format != desc.Format || out.Width != desc.Width || out.Height != desc.Height) { error_ = "lmxxf output format/extent differs from the linear input"; return false; }+ return result(api_.RecordInputs(context_, job_.handle, list), "RecordInputs");+}+bool LmxxfNrBackend::enqueue() {+ if (!job_.handle || enqueued_ || !result(api_.EnqueueHip(context_, job_.handle, queue_), "EnqueueHip")) return false;+ enqueued_ = 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;+ // The ABI leaves private_output shader-readable. Copy into Veyra's stable+ // linear layer output; the graph already transitioned destination to COPY_DEST.+ auto* source = static_cast<ID3D12Resource*>(job_.private_output);+ D3D12_RESOURCE_BARRIER b{}; b.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;+ b.Transition = {source, D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE, D3D12_RESOURCE_STATE_COPY_SOURCE};+ list->ResourceBarrier(1, &b); list->CopyResource(destination, source);+ std::swap(b.Transition.StateBefore, b.Transition.StateAfter); list->ResourceBarrier(1, &b);+ outputsRecorded_ = true; return true;+}+bool LmxxfNrBackend::retireSubmitted() {+ if (!outputsRecorded_) return true;+ if (!result(api_.Retire(context_, job_.handle), "Retire")) return false;+ job_ = {}; enqueued_ = outputsRecorded_ = false; return true;+}+void LmxxfNrBackend::close() noexcept {+ if (context_) {+ if (job_.handle && !enqueued_) (void)result(api_.CancelUnsubmitted(context_, job_.handle),"CancelUnsubmitted");+ (void)result(api_.Drain(context_),"Drain"); (void)result(api_.Destroy(context_),"Destroy");+ }+ context_ = nullptr; queue_ = nullptr; job_ = {}; api_ = {}; caps_ = {};+ enqueued_ = outputsRecorded_ = false;+ if (module_) FreeLibrary(module_); module_ = nullptr;+}+}diff --git a/src/pipeline/NrInstance.cpp b/src/pipeline/NrInstance.cppindex e9fcc786..e4cec6c6 100644--- a/src/pipeline/NrInstance.cpp+++ b/src/pipeline/NrInstance.cpp@@ -38,6 +38,7 @@ bool NrInstance::create(ID3D12Device* device, uint32_t width, uint32_t height,}void NrInstance::close() {+ amd.reset(); // runtime releases its references before the layer texturestemporal_.close();// Both owned and borrowed inputs are ComPtrs. Release this reference in// either case; the graph retains its own reference to a borrowed input.diff --git a/src/source/XboxSessionSource.cpp b/src/source/XboxSessionSource.cppindex 211b6b75..44eb9a6d 100644--- a/src/source/XboxSessionSource.cpp+++ b/src/source/XboxSessionSource.cpp@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-3.0-only// Session flow after Greenlight's streammanager.ts / stream page (unknownskl/greenlight, MIT).#include "veyra/source/XboxSessionSource.h"+#include "veyra/xbox/DisconnectPolicy.h"#include <windows.h>#include <mmreg.h>@@ -124,6 +125,7 @@ struct XboxSessionSource::Impl {xbox::WebRtcSession rtc;std::atomic<bool> streaming{false}, ended{false};std::wstring endReason;+ std::string disconnectReason;std::mutex endMutex;// Video: the WebRTC thread queues access units; the decode thread drains them.@@ -223,7 +225,7 @@ void XboxSessionSource::run(XboxConnectDesc desc) {started_ = false;ready_.notify_all();};- const auto cancelled = [&] { return cancel_.load(); };+ const auto cancelled = [&] { return cancel_.load() || (p.desc.stopRequested && p.desc.stopRequested->load()); };try {if (!p.desc.account || !p.desc.account->signedIn()) { fail(L"请先登录 Xbox 账号。"); return; }@@ -277,7 +279,8 @@ void XboxSessionSource::run(XboxConnectDesc desc) {const int frames = opus_decode_float(q.opus, data, opus_int32(size), q.pcm.data(), 5760, 0);if (frames <= 0) { q.audioDiscontinuity = true; return; }const double ptsMs = double(q.audioSamples) * 1000.0 / 48000.0;- audio_.push(q.pcm.data(), size_t(frames) * 2 * sizeof(float), ptsMs, q.audioDiscontinuity);+ const bool accepted = audio_.push(q.pcm.data(), size_t(frames) * 2 * sizeof(float), ptsMs, q.audioDiscontinuity);+ if (!q.audioSamples) log::info("xbox-audio", std::format("first Opus block samples={} accepted={}", frames, accepted));q.audioDiscontinuity = false;q.audioSamples += uint64_t(frames);};@@ -300,7 +303,11 @@ void XboxSessionSource::run(XboxConnectDesc desc) {callbacks.ended = [this](const std::string& reason) {auto& q = *p_;std::lock_guard lock(q.endMutex);- q.endReason = reason == "the console ended the stream" ? L"主机结束了串流。" : L"与主机的连接中断了。";+ if (q.ended.load()) return; // preserve the server's first, specific reason+ q.disconnectReason = reason;+ q.endReason = reason == "connection lost" ? L"与主机的连接中断了。"+ : L"Xbox 服务结束了串流(" + widen(reason) + L")。";+ log::warn("xbox-disconnect", std::format("reason={} reconnectable={}", reason, xbox::reconnectableDisconnect(reason)));q.ended = true;};p.rtc.setCallbacks(std::move(callbacks));@@ -314,8 +321,11 @@ void XboxSessionSource::run(XboxConnectDesc desc) {layout.channels = 2;layout.mask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;const WAVEFORMATEXTENSIBLE wave = sink::floatWave(layout);- p.audioReady = audio_.configure(wave.Format, sizeof(wave));- if (!p.audioReady) log::warn("xbox-audio", "the audio output could not be configured; the stream continues without sound");+ p.audioReady = audio_.configure(wave.Format, sizeof(wave)) && audio_.start();+ if (!p.audioReady) log::warn("xbox-audio", "the audio output could not be started; the stream continues without sound");+ else log::info("xbox-audio", "Opus stereo 48000 Hz: output worker started");+ } else {+ log::error("xbox-audio", std::format("Opus decoder creation failed code={}", opusError));}ApiSignaling signaling(*p.api, p.sessionId);@@ -342,7 +352,13 @@ void XboxSessionSource::run(XboxConnectDesc desc) {q.api->keepalive(q.sessionId);} catch (const xbox::ServiceError& e) {log::warn("xbox", std::format("keepalive HTTP {}", e.status));- if (e.status == 404) { std::lock_guard lock(q.endMutex); q.endReason = L"串流会话已在服务器端结束。"; q.ended = true; }+ if (e.status == 404) {+ std::lock_guard lock(q.endMutex);+ if(!q.ended.load()){+ q.endReason = L"串流会话已在服务器端结束。";+ q.disconnectReason = "session expired"; q.ended = true;+ }+ }} catch (const std::exception& e) {log::warn("xbox", std::string("keepalive: ") + e.what());}@@ -375,11 +391,14 @@ void XboxSessionSource::run(XboxConnectDesc desc) {}ready_.notify_all();log::info("xbox", "streaming");- while (!cancel_.load() && !p.ended.load()) std::this_thread::sleep_for(std::chrono::milliseconds(50));+ while (!cancelled() && !p.ended.load()) std::this_thread::sleep_for(std::chrono::milliseconds(50));if (p.ended.load()) {std::wstring reason;- { std::lock_guard lock(p.endMutex); reason = p.endReason; }- setState(XboxStats::State::Ended, reason);+ std::string code;+ { std::lock_guard lock(p.endMutex); reason = p.endReason; code = p.disconnectReason; }+ { std::lock_guard lock(mutex_); stats_.state = XboxStats::State::Ended;+ stats_.message = std::move(reason); stats_.disconnectReason = code;+ stats_.reconnectable = xbox::reconnectableDisconnect(code); }}} catch (const xbox::ServiceError& e) {log::error("xbox", std::format("service error {} {}", e.status, e.what()));diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cppindex 588efa17..67a40048 100644--- a/src/ui/QmlPlayerBridge.cpp+++ b/src/ui/QmlPlayerBridge.cpp@@ -115,11 +115,9 @@ QString lastFailurePath() {}// What the user can switch off, for the injected components named in `modules`-// ("nvppex.dll,RTSSHooks64.dll", see gfx::riskyInjections). Empty when none is known.+// (RTSSHooks64.dll, see gfx::riskyInjections). Empty when none is known.QString injectionAdvice(const QString& modules) {QStringList parts;- if (modules.contains(QStringLiteral("nvppex.dll"), Qt::CaseInsensitive) || modules.contains(QStringLiteral("NvPresent64.dll"), Qt::CaseInsensitive))- parts << QCoreApplication::translate("QmlPlayerBridge", "检测到 NVIDIA App 的画面插件(RTX HDR / 智能平滑运动 / RTX 动态鲜艳度)注入了 Veyra,它已知会在采集开始时让显卡设备丢失或让程序崩溃。请在 NVIDIA App → 图形 → 程序设置里为 Veyra 关闭这几项后再试");if (modules.contains(QStringLiteral("RTSSHooks64.dll"), Qt::CaseInsensitive) && !qApp->property("veyraSoftwareUi").toBool())parts << QCoreApplication::translate("QmlPlayerBridge", "检测到 RivaTuner(小飞机 OSD)注入了 Veyra。请把 设置 → 监控软件兼容 设为“自动”并在小飞机运行时重启 Veyra:界面改用兼容绘制,OSD 只显示在视频上");return parts.join(QStringLiteral(";"));@@ -478,7 +476,8 @@ struct QmlPlayerBridge::Impl {DXGI_ADAPTER_DESC1 desc{};if(FAILED(adapter->GetDesc1(&desc))||(desc.Flags&DXGI_ADAPTER_FLAG_SOFTWARE))continue;auto initial=facade.pendingSettings();- initial.nrRuntime=ngx::preferSfNr(desc.VendorId,desc.Description)?engine::NrRuntime::Ampere:engine::NrRuntime::Original;+ 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;}facade.setPending(initial);veyra::log::info("nr-default",std::format("adapter={} selected={}",utf8Of(std::wstring(desc.Description)).toStdString(),engine::nrRuntimeName(initial.nrRuntime)));break;@@ -534,8 +533,9 @@ struct QmlPlayerBridge::Impl {error = QObject::tr("CBR/VBR 需要指定码率");return std::nullopt;}- if (!settings.validate().empty()) {- error = QObject::tr("导出设置无效");+ if (const auto why = settings.validate(); !why.empty()) {+ veyra::log::warn("export-settings", std::format("invalid: {} bitrateMbps={}", why, settings.exportBitrateMbps));+ error = QObject::tr("导出设置无效:%1").arg(utf8Of(why));return std::nullopt;}return settings;@@ -757,6 +757,7 @@ static uint32_t primaryGpuVendor() {// FSR 4 ML frame generation needs an AMD RX 9000; on other GPUs the provider crashed the// whole program (field report 2026-10-01). Known non-AMD adapters are refused up front.static bool fsr4Possible() { const auto v = primaryGpuVendor(); return v == 0 || v == 0x1002; }+bool QmlPlayerBridge::amdNrGpu() const { return primaryGpuVendor()==0x1002; }QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesystem::path dataDirectory,QObject* parent)@@ -1000,12 +1001,6 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesyst{L"graphics-hook64.dll", "OBS game capture"}, {L"DiscordHook64.dll", "Discord overlay"},{L"gameoverlayrenderer64.dll", "Steam overlay"}, {L"nvspcap64.dll", "NVIDIA overlay / instant replay"},{L"ow-graphics-hook64.dll", "Overwolf overlay"},- // The driver's presentation layer; it carries NVIDIA Smooth Motion, which only- // engages for fullscreen windows (suspected in the fullscreen-only VRAM growth).- {L"NvPresent64.dll", "NVIDIA present layer (Smooth Motion)"},- // NVIDIA App's picture plug-in (RTX HDR / Smooth Motion / RTX Dynamic Vibrance): in- // every fullscreen VRAM-growth log and in two capture crashes (2026-10-02).- {L"nvppex.dll", "NVIDIA App picture plug-in (RTX HDR / Smooth Motion / Dynamic Vibrance)"},};static bool loggedOthers[std::size(others)]{};for (size_t k = 0; k < std::size(others); ++k)@@ -3804,7 +3799,7 @@ bool QmlPlayerBridge::setNrLayerParameter(int index,const QString& key,double vaif(index<0||uint32_t(index)>=impl_->chain.nodeCount||impl_->chain.nodes[index].type!=engine::EffectType::NrEnhance||!std::isfinite(value))return false;if(key=="runtime") {- if(value!=0&&value!=2&&value!=3)return false;+ if(value!=0&&value!=2&&value!=3&&value!=4)return false;const auto before=impl_->chain;for(uint32_t i=0;i<impl_->chain.nodeCount;++i)if(impl_->chain.nodes[i].type==engine::EffectType::NrEnhance)@@ -4053,7 +4048,7 @@ void QmlPlayerBridge::setExportHevc(bool value) {// the engine's exportBitrateMbps field documents.int QmlPlayerBridge::exportBitrateMbps() const { return int(impl_->exportBitrateMbps); }void QmlPlayerBridge::setExportBitrateMbps(int value) {- const uint32_t want = uint32_t(std::max(0, std::min(2000, value)));+ const uint32_t want = uint32_t(std::clamp(value, 0, 300));if (impl_->exportBitrateMbps == want) return;impl_->exportBitrateMbps = want;emit exportChanged();@@ -4671,6 +4666,8 @@ void QmlPlayerBridge::startExport() {if(!impl_->exportQueue.queue().start(wideOf(folder),*settings,impl_->exportHevc,impl_->exportRateControl,reason)){emit notice(uiText(reason),true);emit exportChanged();return;}+ veyra::log::info("qml-export",std::format("export frozen bitrateMbps={} rateControl={} hevc={} srTarget={}",+ settings->exportBitrateMbps,int(impl_->exportRateControl),impl_->exportHevc,int(settings->srTarget)));impl_->exportQueue.refresh();pollExport();emit navigate(QStringLiteral("exp"));// Leave the GPU to the export (field request 2026-10-02): whatever plays is closed,// unless 导出页 → 导出时关闭正在播放的内容 is off.diff --git a/src/xbox/WebRtcSession.cpp b/src/xbox/WebRtcSession.cppindex 5afa0740..22a4d679 100644--- a/src/xbox/WebRtcSession.cpp+++ b/src/xbox/WebRtcSession.cpp@@ -310,7 +310,10 @@ void WebRtcSession::onMessageChannel(const std::string& text) {log::info("xbox-message", target + " " + j.value("content", std::string()).substr(0, 300));if (target == "/streaming/sessionLifetimeManagement/serverInitiatedDisconnect") {sendMessageJson(json{{"type", "TransactionComplete"}, {"content", "\"\""}, {"id", id}, {"cv", ""}}.dump());- if (callbacks_.ended) callbacks_.ended("the console ended the stream");+ const auto content = json::parse(j.value("content", std::string()), nullptr, false);+ const std::string reason = content.is_object() && content.contains("reason") && content["reason"].is_string()+ ? content["reason"].get<std::string>() : "unknown server disconnect";+ if (callbacks_.ended) callbacks_.ended(reason);} else if (target == "/streaming/systemUi/messages/ShowMessageDialog") {// A system dialog meant for the player; acknowledge it so the console does not wait.sendMessageJson(json{{"type", "TransactionComplete"}, {"content", json{{"Result", 0}}.dump()}, {"id", id}, {"cv", ""}}.dump());diff --git a/tests/integration/CaptureAudioTests.cpp b/tests/integration/CaptureAudioTests.cppindex b91732cd..afe2fa87 100644--- a/tests/integration/CaptureAudioTests.cpp+++ b/tests/integration/CaptureAudioTests.cpp@@ -21,6 +21,26 @@ int main(int argc,char** argv){else std::this_thread::sleep_until(due);}} pacer;+ if(argc>=2&&std::string_view(argv[1])=="--xbox-float-rtp"){+ // Xbox's stereo float PCM and independent audio/video RTP origins,+ // through the real shared resampler and muted WASAPI endpoint.+ CaptureAudioSession output;+ const auto wave=floatWave({2,SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT});+ if(!output.configure(wave.Format,sizeof(wave))||!output.start())return 2;+ output.setGain(0);std::vector<float> block(960*2);+ for(size_t i=0;i<block.size();++i)block[i]=float(0.1*std::sin(i*0.025));+ const auto begin=Clock::now();+ for(unsigned i=0;i<250;++i){+ pacer.until(begin+std::chrono::milliseconds(i*20));+ if(!output.push(block.data(),block.size()*sizeof(float),i*20.0,i==0))return 3;+ const auto host=std::chrono::duration_cast<std::chrono::nanoseconds>(Clock::now().time_since_epoch()).count()/100;+ output.videoPresented(456789.0+i*20,host,host-350000);+ }+ const auto s=output.snapshot();output.stop();+ const bool pass=s.running&&s.inputFloating&&s.inputSampleRate==48000&&s.inputBlocks==250&&s.nonFiniteSamples==0&&s.bufferedMs<200&&s.compensationMs<100&&s.syncClockFallback;+ std::cout<<(pass?"PASS ":"FAIL ")<<"Xbox float/independent RTP origins: running="<<s.running<<" blocks="<<s.inputBlocks<<" bufferedMs="<<s.bufferedMs<<" compensationMs="<<s.compensationMs<<" fallback="<<s.syncClockFallback<<'\n';+ return pass?0:1;+ }const bool longOutage=argc>=2&&std::string_view(argv[1])=="--long-endpoint-loss";const bool endpointTest=longOutage||(argc>=2&&std::string_view(argv[1])=="--endpoint-loss");if(longOutage)SetEnvironmentVariableW(L"VEYRA_TEST_CAPTURE_AUDIO_LONG_OUTAGE",L"1");diff --git a/tests/qml/quick/tst_backdrop.qml b/tests/qml/quick/tst_backdrop.qmlnew file mode 100644index 00000000..3e22366e--- /dev/null+++ b/tests/qml/quick/tst_backdrop.qml@@ -0,0 +1,20 @@+import QtQuick+import QtTest+import Veyra++Item {+ width: 400; height: 240+ VBackdrop { id: backdrop; anchors.fill: parent; softwareRendering: true }+ TestCase {+ name: "SoftwareBackdrop"+ when: windowShown+ function test_opaque_background_data() { return [{tag:"flat",level:0},{tag:"gradient",level:1},{tag:"strong",level:2}] }+ function test_opaque_background(data) {+ Theme.backdropLevel=data.level+ waitForRendering(backdrop)+ const shot=grabImage(backdrop)+ compare(shot.alpha(200,120),255)+ verify(shot.red(200,120)<80 && shot.green(200,120)<80 && shot.blue(200,120)<80)+ }+ }+}diff --git a/tests/qml/quick/tst_export.qml b/tests/qml/quick/tst_export.qmlindex 9290c219..ea96fe6a 100644--- a/tests/qml/quick/tst_export.qml+++ b/tests/qml/quick/tst_export.qml@@ -74,6 +74,7 @@ Rectangle {fixture.width=1280;fixture.height=720;page.compactTab=0fixture.Window.window.width=1280;fixture.Window.window.height=720queue.clear();queue.selectedId=0;backend.starts=0;backend.additions=0+ backend.exportRateControl=2;backend.exportBitrateMbps=24for(let i=0;i<20;++i)queue.append({itemId:i+1,name:"clip-"+i+".mkv",input:"clip-"+i,output:"",state:"ready",note:"",duration:120,progress:0,current:false,locked:false,inspecting:false})waitForPolish(fixture.Window.window)}@@ -110,6 +111,27 @@ Rectangle {mouseClick(findChild(page,"export-start"));compare(backend.starts,1)mouseClick(findChild(page,"export-clear-queue"));compare(queue.count,0)}+ function test_bitrate_committed_before_start(){+ backend.exportRateControl=1+ const field=findChild(page,"export-bitrate-field")+ field.forceActiveFocus();field.selectAll();keyClick(Qt.Key_1);keyClick(Qt.Key_8)+ compare(backend.exportBitrateMbps,18)+ backend.exportHevc=true;backend.exportSrTargetIndex=2;backend.exportContainer=1+ compare(field.text,"18");compare(backend.exportBitrateMbps,18)+ mouseClick(findChild(page,"export-start"));compare(backend.starts,1)+ compare(backend.exportBitrateMbps,18)+ }+ function test_bitrate_invalid_draft_blocks_start(){+ backend.exportRateControl=0+ const field=findChild(page,"export-bitrate-field"),start=findChild(page,"export-start")+ field.forceActiveFocus();field.selectAll();keyClick(Qt.Key_Backspace)+ compare(field.text,"");compare(start.enabled,false);compare(backend.exportBitrateMbps,24)+ keyClick(Qt.Key_3);keyClick(Qt.Key_0);keyClick(Qt.Key_0)+ compare(backend.exportBitrateMbps,300);compare(start.enabled,true)+ field.selectAll();keyClick(Qt.Key_0)+ compare(start.enabled,false);compare(backend.exportBitrateMbps,300)+ backend.exportRateControl=2;compare(start.enabled,true)+ }function test_resolution_menu_fits_short_window(){fixture.width=720;fixture.height=260;page.compactTab=2fixture.Window.window.width=720;fixture.Window.window.height=260diff --git a/tests/unit/LmxxfNrFakeRuntime.cpp b/tests/unit/LmxxfNrFakeRuntime.cppnew file mode 100644index 00000000..72bd9759--- /dev/null+++ b/tests/unit/LmxxfNrFakeRuntime.cpp@@ -0,0 +1,49 @@+// SPDX-License-Identifier: GPL-3.0-only+// A test-only identity-copy C ABI provider. No HIP, weights or NR inference.+#include "../../third_party/lmxxf/LmxxfNrApi.h"+#include <windows.h>+#include <d3d12.h>+#include <wrl/client.h>+#include <string>+#include <cstring>+using Microsoft::WRL::ComPtr;+namespace {+struct Session { ID3D12Resource* color=nullptr; ComPtr<ID3D12Resource> output; ComPtr<ID3D12Device> device; ID3D12CommandQueue* queue=nullptr; unsigned state=0; };+std::string mode(){char b[64]{};GetEnvironmentVariableA("VEYRA_TEST_LMXXF_MODE",b,sizeof(b));return b;}+int caps(LmxxfNrCapabilities* p){p->abi_version=1;p->max_input_width=1920;p->max_input_height=1080;return 0;}+int create(const LmxxfNrCreateInfo* p,void** out){if(p->flags||!p->device||!p->queue)return 2;auto* s=new Session;s->device=static_cast<ID3D12Device*>(p->device);s->queue=static_cast<ID3D12CommandQueue*>(p->queue);*out=s;return 0;}+int destroy(void* p){delete static_cast<Session*>(p);return 0;}+int ok(void*){return 0;}+int prepare(void* p,const LmxxfNrFrameInfo* info,LmxxfNrJob* job){+ auto* s=static_cast<Session*>(p);if(s->state||info->color_state!=D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE)return 2;+ if(mode()=="oldabi"&&info->struct_size!=LMXXF_NR_FRAME_INFO_V1_SIZE)return 2;+ s->color=static_cast<ID3D12Resource*>(info->color);+ if(!s->output){auto desc=s->color->GetDesc();desc.Flags=D3D12_RESOURCE_FLAG_NONE;D3D12_HEAP_PROPERTIES heap{};heap.Type=D3D12_HEAP_TYPE_DEFAULT;+ if(FAILED(s->device->CreateCommittedResource(&heap,D3D12_HEAP_FLAG_NONE,&desc,D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE,nullptr,IID_PPV_ARGS(&s->output))))return 5;}+ job->handle=s;job->private_output=s->output.Get();s->state=1;return 0;+}+int inputs(void* p,void* job,void* list){auto* s=static_cast<Session*>(p);if(job!=s||!list||s->state!=1)return 2;s->state=2;return 0;}+int enqueue(void* p,void* job,void* queue){auto* s=static_cast<Session*>(p);if(job!=s||queue!=s->queue||s->state!=2)return 2;if(mode()=="fail-enqueue")return 5;s->state=3;return 0;}+int outputs(void* p,void* job,void* cmd){+ auto* s=static_cast<Session*>(p);if(job!=s||!cmd||s->state!=3)return 2;+ auto* list=static_cast<ID3D12GraphicsCommandList*>(cmd);D3D12_RESOURCE_BARRIER b[2]{};+ for(auto& v:b)v.Type=D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;+ b[0].Transition={s->color,D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES,D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE,D3D12_RESOURCE_STATE_COPY_SOURCE};+ b[1].Transition={s->output.Get(),D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES,D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE,D3D12_RESOURCE_STATE_COPY_DEST};+ list->ResourceBarrier(2,b);list->CopyResource(s->output.Get(),s->color);+ for(auto& v:b)std::swap(v.Transition.StateBefore,v.Transition.StateAfter);list->ResourceBarrier(2,b);s->state=4;return 0;+}+int retire(void* p,void* job){auto* s=static_cast<Session*>(p);if(job!=s||s->state!=4)return 2;s->state=0;return 0;}+int cancel(void* p,void*){static_cast<Session*>(p)->state=0;return 0;}+int poll(void* p,void*,uint32_t* state){*state=static_cast<Session*>(p)->state;return 0;}+int error(char* b,uint32_t n){if(n)strncpy_s(b,n,"test provider: requested failure / incorrect call order",_TRUNCATE);return 0;}+int status(void*,char* b,uint32_t n){return error(b,n);}+}+extern "C" __declspec(dllexport) int32_t LmxxfNrGetApi(uint32_t abi,LmxxfNrApi* p){+ if(abi!=1)return 1;if(mode()=="oldabi"&&p->struct_size>LMXXF_NR_API_V1_SIZE)return 2;+ p->abi_version=1;p->QueryCapabilities=caps;p->Create=create;p->Destroy=destroy;p->PrepareSession=ok;p->PrepareFrame=prepare;+ p->RecordInputs=inputs;p->EnqueueHip=enqueue;p->RecordOutputs=outputs;p->ExecuteAfterProducer=enqueue;p->CancelUnsubmitted=cancel;+ p->Poll=poll;p->Retire=retire;p->ResetHistory=ok;p->Drain=ok;p->GetStatus=status;p->GetLastError=error;+ if(mode()=="bad-table")p->EnqueueHip=nullptr;+ return 0;+}diff --git a/tests/unit/LmxxfNrTests.cpp b/tests/unit/LmxxfNrTests.cppnew file mode 100644index 00000000..e1eb4c26--- /dev/null+++ b/tests/unit/LmxxfNrTests.cpp@@ -0,0 +1,66 @@+// SPDX-License-Identifier: GPL-3.0-only+// GPU/ABI contract tests with an identity-copy provider; NOT AMD inference evidence.+#include "veyra/pipeline/LmxxfNrBackend.h"+#include "veyra/pipeline/GpuPassUtils.h"+#include "veyra/gfx/D3D12DeviceContext.h"+#include "veyra/gfx/CommandSlotRing.h"+#include <cstdio>+#include <cstdint>+#include <cstdlib>+using namespace veyra;+int main(){+ unsigned checks=0,failed=0;+ const auto check=[&](bool ok,const char* name){++checks;if(!ok){++failed;std::printf("FAIL %s\n",name);}};+ gfx::D3D12DeviceContext ctx;Status st=Status::Ok;gfx::DeviceContextDesc desc{};desc.enableDebugLayer=true;+ if(!ctx.initialize(desc,st)){std::puts("FAIL D3D12 unavailable");return 2;}+ gfx::CommandSlotRing ring;if(!ring.initialize(ctx.device(),ctx.directQueue(),ctx.fence(),ctx.fenceEvent(),4,st))return 2;+ const auto directory=std::filesystem::absolute("lmxxf-test-runtime");+ std::filesystem::create_directories(directory/"assets");+ pipeline::LmxxfNrBackend nr;+ check(!nr.open(directory,ctx.device(),ctx.directQueue(),0x10DE),"NVIDIA path does not load AMD runtime");+ check(!nr.open(directory/"missing",ctx.device(),ctx.directQueue(),0x1002),"missing runtime refuses NR");+ SetEnvironmentVariableW(L"VEYRA_TEST_LMXXF_MODE",L"bad-table");+ check(!nr.open(directory,ctx.device(),ctx.directQueue(),0x1002),"incomplete ABI is rejected");+ SetEnvironmentVariableW(L"VEYRA_TEST_LMXXF_MODE",nullptr);+ _putenv_s("DLSS5_CODEC_SRGB","1");+ check(!nr.open(directory,ctx.device(),ctx.directQueue(),0x1002),"display-referred codec environment rejects linear input");+ _putenv_s("DLSS5_CODEC_SRGB","");_putenv_s("DLSS5_VIT_ADAPTIVE","1");+ check(!nr.open(directory,ctx.device(),ctx.directQueue(),0x1002),"hidden adaptive history rejected without reset support");+ _putenv_s("DLSS5_VIT_ADAPTIVE","");+ SetEnvironmentVariableW(L"VEYRA_TEST_LMXXF_MODE",L"oldabi");+ check(nr.open(directory,ctx.device(),ctx.directQueue(),0x1002),"old function table negotiated");+ check(nr.admits(1920,1080)&&nr.admits(2560,800)&&!nr.admits(2560,1440)&&!nr.admits(3840,540),"input budget and ultrawide bounds");+ auto input=pipeline::makeTexture(ctx.device(),128,72,DXGI_FORMAT_R16G16B16A16_FLOAT,true);+ auto output=pipeline::makeTexture(ctx.device(),128,72,DXGI_FORMAT_R16G16B16A16_FLOAT,true);+ D3D12_DESCRIPTOR_HEAP_DESC hd{};hd.Type=D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;hd.NumDescriptors=1;hd.Flags=D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;+ gfx::ComPtr<ID3D12DescriptorHeap> heap;if(FAILED(ctx.device()->CreateDescriptorHeap(&hd,IID_PPV_ARGS(&heap))))return 2;+ D3D12_UNORDERED_ACCESS_VIEW_DESC uav{};uav.Format=DXGI_FORMAT_R16G16B16A16_FLOAT;uav.ViewDimension=D3D12_UAV_DIMENSION_TEXTURE2D;+ ctx.device()->CreateUnorderedAccessView(input.Get(),nullptr,&uav,heap->GetCPUDescriptorHandleForHeapStart());+ D3D12_RESOURCE_BARRIER b{};b.Type=D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;+ for(uint64_t frame=1;frame<=12;++frame){+ uint32_t slot=0;auto* list=ring.acquireNext(slot,st);if(!list)return 2;+ b.Transition={input.Get(),D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES,frame==1?D3D12_RESOURCE_STATE_COMMON:D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE,D3D12_RESOURCE_STATE_UNORDERED_ACCESS};list->ResourceBarrier(1,&b);+ ID3D12DescriptorHeap* heaps[]={heap.Get()};list->SetDescriptorHeaps(1,heaps);const float clear[4]={0.25f,0.5f,0.75f,1};+ list->ClearUnorderedAccessViewFloat(heap->GetGPUDescriptorHandleForHeapStart(),heap->GetCPUDescriptorHandleForHeapStart(),input.Get(),clear,0,nullptr);+ b.Transition.StateBefore=D3D12_RESOURCE_STATE_UNORDERED_ACCESS;b.Transition.StateAfter=D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE;list->ResourceBarrier(1,&b);+ const bool recorded=nr.recordInputs(list,input.Get(),frame,frame==1);check(recorded,"record input, legacy frame ABI");if(!recorded)break;+ check(ring.submitAndSignal(slot)&&nr.enqueue(),"producer then same-queue enqueue");+ list=ring.acquireNext(slot,st);if(!list)return 2;+ b.Transition={output.Get(),D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES,frame==1?D3D12_RESOURCE_STATE_COMMON:D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE,D3D12_RESOURCE_STATE_COPY_DEST};list->ResourceBarrier(1,&b);+ check(nr.recordOutputs(list,output.Get()),"consumer writes owned linear output");+ b.Transition.StateBefore=D3D12_RESOURCE_STATE_COPY_DEST;b.Transition.StateAfter=D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE;list->ResourceBarrier(1,&b);+ check(ring.submitAndSignal(slot)&&nr.retireSubmitted(),"retire after consumer submission without frame drain");+ }+ check(ring.waitIdle(),"final fence completes");nr.close();+ SetEnvironmentVariableW(L"VEYRA_TEST_LMXXF_MODE",L"fail-enqueue");+ check(nr.open(directory,ctx.device(),ctx.directQueue(),0x1002),"failure provider starts");+ uint32_t failSlot=0;auto* failList=ring.acquireNext(failSlot,st);if(!failList)return 2;+ check(nr.recordInputs(failList,input.Get(),13,true),"prepare failure job");+ check(ring.submitAndSignal(failSlot)&&!nr.enqueue(),"enqueue failure is not reported as successful NR");+ check(!nr.recordOutputs(failList,output.Get()),"failed enqueue exposes no output");+ check(ring.waitIdle(),"failure producer completes before teardown");nr.close();+ SetEnvironmentVariableW(L"VEYRA_TEST_LMXXF_MODE",nullptr);+ uint32_t removed=0;check(ctx.checkDeviceAlive(removed),"GPU stays alive across command allocator reuse");+ std::printf("Lmxxf C ABI/identity GPU copy: %u checks %u failures. Not AMD inference.\n",checks,failed);+ return failed?1:0;+}diff --git a/tests/unit/PresetLibraryTests.cpp b/tests/unit/PresetLibraryTests.cppindex 2a28893c..9b43fe11 100644--- a/tests/unit/PresetLibraryTests.cpp+++ b/tests/unit/PresetLibraryTests.cpp@@ -882,7 +882,7 @@ __declspec(noinline) void testRenderingChoices(){ChainSessionStore nr(sessionPath);check(nr.load(*restored)&&*session==*restored,"rendering: v4 editor globals restore exactly");}void testNrVariants() {- for (const auto runtime : {NrRuntime::Original, NrRuntime::Ampere, NrRuntime::NvidiaOriginal}) {+ for (const auto runtime : {NrRuntime::Original, NrRuntime::Ampere, NrRuntime::NvidiaOriginal, NrRuntime::LmxxfAmd}) {auto settings=sample(); settings.nrRuntime=runtime;const auto path=scratch((L"nr-"+std::to_wstring(int(runtime))+L".v1").c_str());PresetLibrary writer(path); writer.setIncludeBuiltins(false);diff --git a/tests/xbox/XboxTests.cpp b/tests/xbox/XboxTests.cppindex 73d745bf..fd0bcec0 100644--- a/tests/xbox/XboxTests.cpp+++ b/tests/xbox/XboxTests.cpp@@ -28,6 +28,7 @@#include "veyra/xbox/Protocol.h"#include "veyra/xbox/StreamApi.h"#include "veyra/xbox/WebRtcSession.h"+#include "veyra/xbox/DisconnectPolicy.h"using namespace veyra::xbox;using json = nlohmann::json;@@ -398,12 +399,14 @@ void webrtcTests() {std::vector<std::vector<uint8_t>> units;std::vector<std::vector<uint8_t>> opus;std::optional<Vibration> vibration;+ std::string endedReason;uint32_t serverW = 0, serverH = 0;WebRtcCallbacks callbacks;callbacks.video = [&](std::vector<uint8_t>&& unit, uint32_t, int64_t arrival) { std::lock_guard l(m); if (arrival > 0) units.push_back(std::move(unit)); };callbacks.audio = [&](const uint8_t* d, size_t n, uint32_t) { std::lock_guard l(m); opus.emplace_back(d, d + n); };callbacks.vibration = [&](const Vibration& v) { std::lock_guard l(m); vibration = v; };callbacks.serverVideoSize = [&](uint32_t w, uint32_t h) { std::lock_guard l(m); serverW = w; serverH = h; };+ callbacks.ended = [&](const std::string& reason) { std::lock_guard l(m); endedReason=reason; };session.setCallbacks(callbacks);std::string error;@@ -516,6 +519,11 @@ void webrtcTests() {detail::get32(encoded.data()+23)==102&&detail::get32(encoded.data()+27)==103&&detail::get32(encoded.data()+31)==104&&detail::get32(encoded.data()+35)==1234&&detail::get32(encoded.data()+39)==1234,"frame feedback matches Greenlight's seven-field wire format");+ // Exercise real transport shutdown while the caller sends input/keyframe+ console.message->send(json{{"type","TransactionStart"},{"target","/streaming/sessionLifetimeManagement/serverInitiatedDisconnect"},{"id","shutdown-test"},{"content",json{{"reason","KickForServerShutdown"}}.dump()}}.dump());+ for(unsigned i=0;i<100;++i){ {std::lock_guard l(m);if(!endedReason.empty())break;} std::this_thread::sleep_for(std::chrono::milliseconds(10)); }+ {std::lock_guard l(m);check(endedReason=="KickForServerShutdown","specific server shutdown reason survives the real message channel");}+// Exercise real transport shutdown while the caller sends input/keyframe// requests. This covers both the isOpen/send race and local close racing// callbacks; exceptions escaping any thread terminate this test process.@@ -531,6 +539,15 @@ void webrtcTests() {} // namespaceint main(int argc, char** argv) {+ check(reconnectableDisconnect("KickForServerShutdown"), "server service restart is recoverable");+ check(reconnectableDisconnect("connection lost"), "transport loss is recoverable");+ check(!reconnectableDisconnect("KickForStreamingClientDisconnect") && !reconnectableDisconnect("unknown server disconnect"), "unknown kicks and takeover are not retried");+ ReconnectBudget budget;+ check(budget.take() && budget.take() && budget.take() && !budget.take(), "retry budget stops at three");+ budget.decoded(1);budget.decoded(10000001);budget.disconnected();budget.decoded(400000000);+ check(!budget.take(), "a brief return or a gap cannot refill retries");+ for(int64_t t=400000000;t<=710000000;t+=5000000)budget.decoded(t);+ check(budget.take() && budget.attempts()==1, "30 seconds of continuous decoded progress refills retries");// --live-device-code: asks Microsoft for a sign-in code with the client id the product uses (no account// is involved, nothing is signed in). Confirms the first step of the real service still answers.if (argc > 1 && std::string(argv[1]) == "--live-device-code") {diff --git a/third_party/lmxxf/LICENSE b/third_party/lmxxf/LICENSEnew file mode 100644index 00000000..ea85db65--- /dev/null+++ b/third_party/lmxxf/LICENSE@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2026 Kien++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.diff --git a/third_party/lmxxf/LmxxfNrApi.h b/third_party/lmxxf/LmxxfNrApi.hnew file mode 100644index 00000000..a07abbb9--- /dev/null+++ b/third_party/lmxxf/LmxxfNrApi.h@@ -0,0 +1,180 @@+#pragma once++/* Versioned C ABI for LmxxfNrRuntime.dll. Recommended per-frame call order: LmxxfNrApi-call-order.md (next to this header).+ * MSVC host and MinGW runtime must not share a C++ ABI. No STL, exceptions, or+ * CRT-allocated objects cross this boundary. x64 stdcall is the Windows default. */++#include <stdint.h>+#include <stddef.h> /* wchar_t in C hosts */++#ifdef __cplusplus+extern "C" {+#endif++#define LMXXF_NR_ABI_VERSION 1u+/* sizeof() of an ABI v1 LmxxfNrFrameInfo: it stopped at model_scale, before the exposure+ * fields. A host talking to a runtime that predates them sends this as struct_size. */+#define LMXXF_NR_FRAME_INFO_V1_SIZE 80u++/* Optional recovery when HIP enqueue or the session queue contract fails.+ * On recovery, EnqueueHip returns OK only after the private neural output was fully zeroed;+ * GetLastError then contains a recovery diagnostic. Submit input and output work+ * on the queue passed to EnqueueHip, and submit the output reader before Retire,+ * Drain, or Destroy. The runtime waits for that supplied queue before output reuse+ * or destruction. It cannot discover output readers on other queues; callers must+ * synchronize those queues themselves before reuse or destruction. A failed or+ * uncertain clear returns FAILED and the session must be rebuilt. */+#define LMXXF_NR_CREATE_FLAG_ZERO_OUTPUT_FALLBACK (1u << 0)++enum LmxxfNrStatus+{+ LMXXF_NR_OK = 0,+ LMXXF_NR_UNSUPPORTED_ABI = 1,+ LMXXF_NR_INVALID_ARGUMENT = 2,+ LMXXF_NR_NOT_IMPLEMENTED = 3,+ LMXXF_NR_UNAVAILABLE = 4,+ LMXXF_NR_FAILED = 5+};++enum LmxxfNrJobState+{+ LMXXF_NR_JOB_NONE = 0,+ LMXXF_NR_JOB_PREPARED = 1, /* Set by PrepareFrame; ready for RecordInputs */+ LMXXF_NR_JOB_PRODUCER_SUBMITTED = 2, /* Set by RecordInputs; producer recorded/submitted */+ LMXXF_NR_JOB_NR_ENQUEUED = 3, /* EnqueueHip scheduled on queue */+ LMXXF_NR_JOB_NR_COMPLETE = 4, /* EnqueueHip executed or completed */+ LMXXF_NR_JOB_CONSUMER_COMPLETE = 5, /* Set by RecordOutputs; consumer recorded */+ LMXXF_NR_JOB_RETIRED = 6 /* Set by Retire or CancelUnsubmitted */+};++typedef struct LmxxfNrCapabilities+{+ uint32_t struct_size;+ uint32_t abi_version;+ /* The always-admitted box. Admission is by pixel budget, so a wider input (up to 2560, height+ * still within max_input_height) is also accepted while width*height stays within+ * max_input_width*max_input_height (ultrawide). */+ uint32_t max_input_width;+ uint32_t max_input_height;+ uint32_t history_supported; /* first product version: 0 */+ uint32_t overlap_supported; /* first product version: 0 */+ uint32_t graph_supported; /* first product version: 0; EnqueueHip must not graph-wait */+ uint32_t hip_ready; /* 1 once host+hsaco are loaded */+ uint32_t gfx1201_target; /* 1 = this binary is for gfx1201 */+} LmxxfNrCapabilities;++typedef struct LmxxfNrCreateInfo+{+ uint32_t struct_size;+ void *device; /* ID3D12Device*; not dereferenced until HIP is wired */+ void *queue; /* ID3D12CommandQueue*; must match device when HIP is wired */+ const wchar_t *assets_directory;+ uint32_t flags; /* LMXXF_NR_CREATE_FLAG_*; unknown bits are rejected */+} LmxxfNrCreateInfo;++#define LMXXF_NR_FRAME_FLAG_STRENGTH (1u << 0)+#define LMXXF_NR_FRAME_FLAG_DEBUG_VIEW (1u << 1)+#define LMXXF_NR_FRAME_FLAG_CODEC_PASSTHROUGH (1u << 2)++typedef struct LmxxfNrFrameInfo+{+ uint32_t struct_size;+ uint64_t session_id;+ uint64_t frame_id;+ uint64_t list_generation;+ void *command_list; /* ID3D12GraphicsCommandList*; Record* do not Execute */+ uint32_t color_width;+ uint32_t color_height;+ void *color; /* ID3D12Resource*; required for RecordInputs */+ uint32_t color_state; /* D3D12_RESOURCE_STATES at RecordInputs */+ uint32_t flags; /* LMXXF_NR_FRAME_FLAG_* (0 in legacy ABI v1) */+ float transfer_strength; /* Detail strength: 0..1, default 1.0 */+ float color_strength; /* Colour strength: 0..1, default 1.0 */+ uint32_t debug_view; /* 0=normal, 1=proxy, 2=neural solo, 3=diff 20x, 4=tint */+ float model_scale; /* 0.25..1.0, default 1.0 */+ /* Optional exposure (ABI growth; LMXXF_NR_ABI_VERSION is unchanged because the function+ * table is not). struct_size negotiates this: a host whose struct_size stops before these+ * fields simply does not supply them, and the runtime falls back to no exposure and the+ * scalars below at their defaults. */+ void *exposure; /* ID3D12Resource* 1x1 R16_FLOAT/R32_FLOAT, shader-readable; NULL = none */+ uint32_t exposure_state; /* D3D12_RESOURCE_STATES of exposure at RecordInputs */+ float pre_exposure; /* game pre-exposure; finite and > 0, default 1 */+ float exposure_scale; /* exposure scale; finite and > 0, default 1 */+} LmxxfNrFrameInfo;++typedef struct LmxxfNrJob+{+ uint32_t struct_size;+ void *handle;+ void *private_output; /* ID3D12Resource* for SR; null until PrepareFrame succeeds */+} LmxxfNrJob;++/* Network GPU time (ABI growth, LMXXF_NR_ABI_VERSION unchanged; negotiated by struct_size like LmxxfNrFrameInfo).+ * network_ms is the GPU time of the HIP neural network only: hipEvents recorded on the HIP stream after it waited for+ * the D3D12 producer and before it signals the D3D12 consumer. It does NOT include the D3D12 input copy, the codec+ * encode/decode passes, or the D3D12<->HIP handoff waits, so it is not comparable with D3D12 timestamp queries placed+ * around RecordInputs/RecordOutputs (those measure the D3D12 passes only; the network does not run on that queue).+ * Reading never blocks: the value is the most recent span that had completed when GetTimings was called, normally the+ * previous frame (frame_id says which frame; it is LmxxfNrFrameInfo::frame_id of that frame). Frames where the adaptive+ * ViT reuse skipped the ViT part are shorter. Passthrough/fallback frames do not run the network and are not timed.+ * valid = 0 until a timed frame has completed, and when timing is unavailable. Timing is off until the first GetTimings+ * call on the session (recording the events every frame measured slightly slower), so that first call returns valid = 0+ * and later calls report frames enqueued after it; it then stays on, also across an internal HIP recreate. Rare single+ * samples can be far too short (seen: the first frame after a (re)create, and 1 in ~1200 later frames); smooth over a+ * few frames (median) for display. Like the other calls on a session, call it+ * from the thread that drives the frames (or serialize it with them). */+typedef struct LmxxfNrTimings+{+ uint32_t struct_size; /* sizeof(LmxxfNrTimings) */+ uint32_t valid; /* 1 = network_ms/frame_id hold a completed measurement */+ float network_ms;+ uint32_t reserved; /* 0 */+ uint64_t frame_id;+} LmxxfNrTimings;++typedef struct LmxxfNrApi+{+ uint32_t struct_size;+ uint32_t abi_version;+ int32_t (*QueryCapabilities)(LmxxfNrCapabilities *out);+ int32_t (*Create)(const LmxxfNrCreateInfo *info, void **context);+ int32_t (*Destroy)(void *context);+ int32_t (*PrepareSession)(void *context);+ int32_t (*PrepareFrame)(void *context, const LmxxfNrFrameInfo *info, LmxxfNrJob *job);+ int32_t (*RecordInputs)(void *context, void *job, void *command_list);+ int32_t (*EnqueueHip)(void *context, void *job, void *command_queue);+ int32_t (*RecordOutputs)(void *context, void *job, void *command_list);+ int32_t (*ExecuteAfterProducer)(void *context, void *job, void *command_queue);+ int32_t (*CancelUnsubmitted)(void *context, void *job);+ int32_t (*Poll)(void *context, void *job, uint32_t *state);+ int32_t (*Retire)(void *context, void *job);+ int32_t (*ResetHistory)(void *context);+ int32_t (*Drain)(void *context);+ int32_t (*GetStatus)(void *context, char *buf, uint32_t buf_chars);+ int32_t (*GetLastError)(char *buf, uint32_t buf_chars);+ /* Appended (struct_size growth). Present only when the caller's struct_size is sizeof(LmxxfNrApi); a host built+ * against the older header passes LMXXF_NR_API_V1_SIZE and gets the table without it. A runtime that predates it+ * rejects the larger struct_size with LMXXF_NR_INVALID_ARGUMENT: retry with LMXXF_NR_API_V1_SIZE and treat+ * GetTimings as unavailable. GetStatus also appends "net_gpu_ms=X.XX (frame N)" ("off" before the first GetTimings, "n/a" before a timed frame completes). */+ int32_t (*GetTimings)(void *context, LmxxfNrTimings *out);+} LmxxfNrApi;++/* sizeof(LmxxfNrApi) before GetTimings was appended (two uint32_t + 16 function pointers on x64). */+#define LMXXF_NR_API_V1_SIZE 136u++#ifdef _WIN32+#ifdef LMXXF_NR_RUNTIME_EXPORTS+#define LMXXF_NR_EXPORT __declspec(dllexport)+#else+#define LMXXF_NR_EXPORT __declspec(dllimport)+#endif+#else+#define LMXXF_NR_EXPORT+#endif++/* Sole export. Caller sets out->struct_size = sizeof(LmxxfNrApi) (or LMXXF_NR_API_V1_SIZE) before the call. */+LMXXF_NR_EXPORT int32_t LmxxfNrGetApi(uint32_t abi_version, LmxxfNrApi *out);++#ifdef __cplusplus+}+#endifdiff --git a/third_party/lmxxf/VEYRA_ORIGIN.md b/third_party/lmxxf/VEYRA_ORIGIN.mdnew file mode 100644index 00000000..983ace8a--- /dev/null+++ b/third_party/lmxxf/VEYRA_ORIGIN.md@@ -0,0 +1,23 @@+# lmxxf AMD NR origin++- Upstream: https://github.com/lmxxf/dlss5-on-amd-9070xt-porting+- Fixed commit: `78f548749e74824327b8458c57be31a1df78376a`.+- License: MIT, Copyright (c) 2026 Kien; original license in `LICENSE`.+- `LmxxfNrApi.h`: byte-identical copy of upstream `include/LmxxfNrApi.h`.+- Runtime code remains in the external pinned checkout; the Veyra source Git+ contains the public C ABI header, attribution and reproducible build recipe.+- Build adaptation: MSVC `NOMINMAX`, linking `user32.lib` for the upstream hotkey+ reference, and a forced header mapping its sole GNU `noinline` annotation to+ `__declspec(noinline)`. No changes to upstream inference/codec source.+- Veyra-owned host files: `LmxxfNrBackend.h/.cpp`, `NrInstance`/`EnhanceGraph`+ integration, GPU-specific QML choices and local resource preparation scripts.+ They use the existing shared enhancement graph and NR composite/history.++This does **not** license the whole Magpie portable package under MIT. Magpie+has its own GPL license. The NVIDIA-derived `.f16`/`.f32` model weights are+separate binary assets, not MIT source; HIP modules are also kept outside Git.+User-provided 0.39 resources are used only for the recorded local experiment.+No Magpie executable, proxy `dxgi.dll` or ReShade `.addon64` is loaded by Veyra.++See `docs/AMD_NR_INTEGRATION_2026-10-03.md` for asset provenance, ABI limits and+the distinction between host tests and unperformed RX 9000 inference validation.