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++
Trim unused VFG NPP dependencies and preserve full AMD runtime
Veyra Goal Agent2df6dd729b9f
diff --git a/AGENTS.md b/AGENTS.mdindex 40d8d026..6d016623 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -1,5 +1,7 @@# Veyra 项目 Agent 执行规则+> **2026-10-04 追加授权**:用户要求VFG(消息写VSF,按前文VFG理解)和AMD NR尽量瘦身,稳定性优先,再构建新的完整本地测试包、汇报HDR PR合并计划、保存完成后关机。在 `codex/runtime-size-20261004` 按 `docs/RUNTIME_SIZE_PLAN_2026-10-04.md` 执行,基线fc2ca716,tag `checkpoint/pre-runtime-size-20261004`、bundle在E盘archives/runtime-size-20261004。只授权必要依赖加载/打包/定向验证接点;不修改proprietary DLL/模型、不牺牲功能档位或未经实测移除必要文件。HDR仍只方案等审批,无merge/push/Release授权,不派Agent。所有产物E盘;测试每进程≤300秒、构建≤900秒;完成包/报告/源码存档和停止本轮子进程后,按用户明确要求关机。+> **2026-10-04 当前授权**:立即修复极简窗口右侧像素缺口;HDR/Dolby Vision PR #13/#14 只做研究、静态审查和适配/UI方案,待用户审批才修复并入。在 `codex/minimal-edge-hdr-review-20261004` / 当前E盘隔离工作树按 `docs/MINIMAL_EDGE_HDR_REVIEW_PLAN_2026-10-04.md` 执行。黑边所需QML原生宿主窗口几何/裁切、默认极简窗口取整的最小显示几何接点及定向验收获本轮授权,覆盖对应历史冻结;HDR算法/UI/PR合并未授权。复现证据与新增PresentationGeometry/VideoPresenter范围先记录在方案,不改增强/颜色链。保留已验VFG/现场修复、main、桌面、候选和用户配置;不派Agent、不merge/push/Release,所有产物在E盘,测试≤300秒、构建≤900秒。> **2026-10-03 VFG 接入授权**:用户“接入看看,8x也支持上”“所有档位都加上”。在当前 E 盘隔离工作树的 `codex/vfg-integration-20261003`,以 `1802f43565e07f3c3040d3fe745ca2e939aab00f` 为基线,按 `docs/VFG_INTEGRATION_EXECUTION_2026-10-03.md` 接入 NVIDIA VFG、全部 2X–8X 与 Low/Medium/High。必要的 native backend、D3D12/CUDA bridge、共享 graph/pools/leases、settings/preset/session/worker、preview/export、QML/bridge、shader/CMake 与针对性验收获本轮授权,覆盖对应历史冻结;不扩改无关链路,不派子 Agent,不 merge/push/Release。存档 `checkpoint/pre-vfg-integration-20261003` 与 `E:/项目/Veyra/archives/vfg-integration-20261003-start/source-before.bundle`;原五项修复、main、桌面、用户配置与已有候选保持。新 SDK/运行库/模型仍在 E 盘独立 deps,不进源码 Git;默认 Medium,高倍率实验标识、实测与未验边界如实报告。测试≤300s、构建≤900s。diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.mdindex f760117c..37909326 100644--- a/docs/CURRENT_STATUS.md+++ b/docs/CURRENT_STATUS.md@@ -1,5 +1,14 @@# 当前项目状态 / Current Status+## 2026-10-04 VFG / AMD NR 瘦身候选++`codex/runtime-size-20261004` 以黑边已验修复fc2ca716为基线,先存档/写方案。+VFG移除九个当前路径未用NPP,目录497,894,432→210,788,400 bytes;全部档位和插件原字节保持。+720p/4K各463 native checks、331 settings、21 NVENC导出、组合/缺库/GUI/worker冻结通过。+AMD生产噪声/reciprocal表、权重与62 HIP kernel保持;仅ABI/布局/哈希验证,不称实卡推理通过。+当前正在极简新构建回归与完整7z/ZIP打包、独立解压验收;最终数值与源码见本轮DELIVERY索引。+HDR PR仍只方案等审批。未merge/push/Release,所有产物在E盘;完成保存后按用户明确要求关机。+## 2026-10-04 极简像素缺口已修;HDR PR 等审批独立分支 `codex/minimal-edge-hdr-review-20261004` 从已验VFG候选存档开工。diff --git a/docs/RUNTIME_SIZE_ACCEPTANCE_2026-10-04.md b/docs/RUNTIME_SIZE_ACCEPTANCE_2026-10-04.mdnew file mode 100644index 00000000..78aae8a2--- /dev/null+++ b/docs/RUNTIME_SIZE_ACCEPTANCE_2026-10-04.md@@ -0,0 +1,62 @@+# VFG / AMD NR 瘦身验收(2026-10-04)++本轮在 `codex/runtime-size-20261004`,基线 `fc2ca716`,先存档/方案再施工。+只修改 VFG 依赖加载与本地打包/验证脚本,没有改模型、HIP 内核、HDR 算法或功能档位。+包含极简窗口像素缺口修复;HDR/DV PR #13/#14 仍等待审批,未合并 main、未推送、未发布。++## 大小与可删范围++| 部分 | 原运行目录 | 新运行目录 | 处理 |+| --- | ---: | ---: | --- |+| VFG | 497,894,432 bytes(474.83 MiB) | 210,788,400 bytes(201.02 MiB) | 移除九个未使用的 NPP DLL,共 287,106,032 bytes(273.81 MiB,57.7%)。 |+| AMD NR | 615,032,656 bytes(586.54 MiB) | 同原件 | 186 权重、2映射、62 HIP内核及原有回退保留。 |++VFG 原包把通用 CUDA/NPP 图像处理库一起打入。当前后端直接包装编码好的共享 CUDA buffer,+没有调用 NvCVImage_Transfer/NPP 转换;PE import/delay-import 与实际进程模块检查一致。+五个保留文件为 cudart64_12.dll、NVCVImage.dll、nvngxruntime.dll、NVVideoEffects.dll、+nvVFXVideoFrameGeneration.dll,原 SHA/签名/字节不变。小型 nvngxruntime 保留,未为 84KB 扩大裁剪。+207MB 的 VFG 插件是必要运行组件,不拆 PE、不量化模型。全部 2X–8X 和三种质量保留。++AMD 的 `noise.f32`(201,326,592 bytes)是模型输入噪声表;`normalized-output.f32`+(33,554,432 bytes)是时域采样 reciprocal 表。上游生产路径实际读取,删掉会破坏运行。+仅发现两对 7KB shader 完全重复;它们的别名是现有路径合同,保留,不为几KB改上游加载。+默认 skip blocks 也不能据此删权重:其他设置/回退仍可能使用,本机无 RX9000 无法证明安全。+不引入运行时自解压、下载依赖、裁剪显卡架构或降低精度。++无损压缩样本 450,593,392 bytes(AMD两大表/一权重/VFG插件):ZIP9 277,853,065 bytes,+7z LZMA2/32MiB 166,108,485 bytes,比同样本 ZIP 小40.2%。样本不能冒充完整包大小。+最终提供相同载荷的完整 7z 和 ZIP;正式数值/SHA/独立解压结果在交付目录 `DELIVERY.json` / `DELIVERY.md`。+7z 只减传输大小,AMD 解压后的资源量没有减少;每个文件还原后必须匹配原 SHA。++## 当前真实检查++实际机器 RTX5070 / 驱动616.56;不是反馈者616.92。全部 child TEMP/TMP/CUDA cache 在E盘,+VFG/native/export/UI child PATH 限 Windows,无 SDK 路径、无 NPP 文件。++- fresh build 481步:QML、native VFG、NVENC probe、settings,exit0。已有 C4244 警告未掩盖。+- native 720p 和3840×2160,各463 checks / 0 failures:RGBA8/RGB10A2、三质量、2X–8X、+ 七张输出不同、切镜 identity、参数拒绝、设备存活、debug errors检查通过。+ 两进程观测只从精简运行目录加载五个 VFG组件,没有 NPP。+- settings 331 checks / 0 failures,保存/恢复与原枚举合同保持。+- 720p30 的21种真实 D3D12 NVENC HEVC导出全部通过,16–64帧、60–240fps、时长/音轨准确。+- 2K30 AVI + 原生4K NR + 最高SR4K + VFG8、24→192 / 60→480fps、取消、缺失全部runtime通过。+- 单独缺 cudart 的真实导出:记录 LoadLibrary失败、exit1、无最终文件,这是正确拒绝,不是成功导出。+- GUI热切换/list↔node/DLSS6↔VFG8/seek/resize/暂停恢复、预设与重启、缺库基础播放恢复通过。+ 独立 High8 worker在父进程改 Low2 后仍输出64帧/240fps;日志证实冻结质量=2。+- AMD原529记录逐文件哈希、真实C ABI144 bytes/ABI1、62模块布局验证通过。+ caps.hip=0,本机没有RX9000;没有执行 HIP 推理,不能称AMD画质/性能/稳定性验收。++极简新EXE的分数DPR边缘回归、最终7z/ZIP校验及干净解压实跑另记WORKLOG/交付索引;+本文件的包内版本为组包前快照,最终报告在同目录,避免为自身哈希反复改包。+当前应用 SHA256 `88597f61c8d01105533927859726815aaf3c67034e71bddf17852fb13c341bfc`。++## 未验与复现位置++未验:RX9000实际推理/颜色/性能/长稳,Xbox真机有声/长稳,RTX40实卡、616.92,+HDR色度、实显示器DPI移动、物理显示节奏/端到端延迟、VFG影片画质AB与长稳。+软件短测通过不外推这些项目。原高倍率High预览预算/跳帧行为保留,离线导出不丢源帧。++运行 `python -B scripts/acceptance/runtime-size-*.py`;命令/结果在 WORKLOG。+所有 build/tests/logs/tmp/test-packages/verify/archives 位于 `E:/项目/Veyra/<用途>/runtime-size-20261004`。+模型/DLL/SDK不进源码Git;固定来源/许可证原样保留,完整第三方源码公开发布审计不在本地交付范围。+用户要求完成存档后关机,只有所有交付与必要检查完成后才执行。diff --git a/docs/RUNTIME_SIZE_PLAN_2026-10-04.md b/docs/RUNTIME_SIZE_PLAN_2026-10-04.mdnew file mode 100644index 00000000..d4eb089e--- /dev/null+++ b/docs/RUNTIME_SIZE_PLAN_2026-10-04.md@@ -0,0 +1,12 @@+# VFG / AMD NR 瘦身与完整本地测试包++用户追加授权尽量瘦身,以稳定性为先;构建完整测试包并汇报HDR PR合并方案,完成保存后关机。VFG是按前文解释消息里的VSF。HDR仍未批准施工或合并,不扩大为发布。++基线 `fc2ca7163e986f97e53dcab51ffe1ac77bb0615a`,包含极简黑边已验修复和PR审查。独立分支 `codex/runtime-size-20261004`,开工tag `checkpoint/pre-runtime-size-20261004`,完整bundle在 `E:/项目/Veyra/archives/runtime-size-20261004/source-before.bundle`,verify成功,SHA256 `6d2b64b471cb84effd84670a07f3079b5f71f630940926338052099e4cbfd694`。++1. 按文件/压缩后贡献度统计;检查原始DLL的import/delay-import与实际运行依赖闭包、上游代码对AMD权重/kernel的读取。区分模型、诊断产物、备份/未用资产和必要fallback,保留来源/SHA/许可证。+2. 只裁剪可以证明不使用的文件。VFG必要接点限定 `src/pipeline/VfgBackend.cpp` 的依赖加载;AMD若无法在无实卡条件证明可删,则保留必要权重/kernel,不以量化、重编内核、改模型换大小。完整档位、两种RX9000架构与格式兼容保持。+3. 能力需要的runtime保留原字节身份;新产物仅在E盘runtime-size-20261004各用途目录。可评估ZIP/LZMA2等压缩并标注解压兼容性,不引入运行时自解压/联网补模型。+4. fresh/incremental构建当前QML+native VFG测试目标;裁剪候选测试2X–8X×三档、8/10bit、重建/热切换/缺失依赖与真实worker导出。AMD至少重核实际API/layout与模型/kernel清单,推理未验明示。没有收益或验证不充分时保留文件。+5. 完整测试包带现有Xbox/码率/RTSS/取消检测修复、AMD NR、全部VFG和黑边修复,生成manifest/来源/对应源码与新的交付说明。验证独立解压/Windows最小PATH/没有开发SDK环境,运行/退出/worker/页面与黑边;原候选/main/桌面不改。+6. 完成WORKLOG、瘦身数据与HDR PR审批方案、源码存档。停止本轮测试/build子进程,按用户要求关机;不杀其他用户应用来跑测试,不代发消息。diff --git a/docs/RUNTIME_SIZE_USER_GUIDE_2026-10-04.md b/docs/RUNTIME_SIZE_USER_GUIDE_2026-10-04.mdnew file mode 100644index 00000000..ecdde7e6--- /dev/null+++ b/docs/RUNTIME_SIZE_USER_GUIDE_2026-10-04.md@@ -0,0 +1,24 @@+# Veyra 2.0.2 本地完整测试包 · 2026-10-04++这是完整便携包,解压到一个新目录,双击 `veyra_qml_ui.exe`;无需安装Python或开发SDK。+保留原测试包作回退,不直接在旧包运行时覆盖文件。7z为较小下载,ZIP为备用,相同功能与载荷。+7z可用支持LZMA2的解压软件完整解压;不能仅运行压缩包里拖出的EXE。++已包含Xbox音频/重连、导出码率编辑、RTSS兼容背景与NVIDIA App误检测修复,AMD NR、+VFG全部2X–8X/低中高质量,以及极简窗口右侧像素缺口修复。历史2.0.2版本号未作为正式新发布升级。++- VFG:专业列表“补帧”选择 NVIDIA VFG;节点模式同源,默认中档。仅RTX40/50范围,本机仅5070短测。+ 高档8X开销大,预览可能按预算降档/跳帧;离线导出完整处理。提交FPS不是物理屏幕FPS。+- AMD NR:RX9000的NR版本显示“RX 9000 · lmxxf(实验)”,资产位于 `runtime/amd-nr`。+ NVIDIA显卡继续显示三个NVIDIA NR版本;AMD模型不会在5070上获得运行支持。+ AMD内部最高1080p预算,不支持HDR/超预算原生4K NR导出。需要AMD驱动自身的HIP运行支持。+ 资源/ABI已校验,RX9000推理和长稳仍需实卡反馈。+- VFG仅去掉当前路径未用NPP,不改插件/质量档;AMD生产表/权重/两种HIP架构保留原字节。+ 无损压缩只减少传输大小;模型解压后仍占原空间。GPU、模型和主机未验项见验收文档。++本轮HDR/Dolby Vision PR #13/#14仅审查,没有实施或并入。方案在+`docs/HDR_DOVI_PR_REVIEW_2026-10-04.md`:输入自动识别、处理区唯一HDR效果卡、输出状态与显示校准。+先修P5精确颜色/亮度统计与reset,再做预设/worker兼容和UI,取得参考及实机证据后按用户批准范围合并。++这是本地实验测试候选;未merge main、未push、未GitHub Release。许可证与逐文件manifest随包。+交付目录 `DELIVERY.md` / `DELIVERY.json` 是最终完整包大小、SHA、验证结果与源码存档索引。diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex e3ce5cba..fe9db6ea 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -1,5 +1,18 @@# Veyra 工作记录+## 2026-10-04 VFG / AMD NR 瘦身(组包前)++- 用户要求稳定性优先、尽量瘦身、完整本地测试包、HDR PR计划、完成保存后关机。按前文将VSF理解为VFG;不开Agent。分支codex/runtime-size-20261004、基线fc2ca716、tag checkpoint/pre-runtime-size-20261004,bundle verify,SHA256 6d2b64b471cb84effd84670a07f3079b5f71f630940926338052099e4cbfd694;先写RUNTIME_SIZE_PLAN后修改最小依赖加载。+- Python311 -B `runtime-size-audit.py`:PE import/delay-import、字符串和旧ZIP贡献统计;没有NPP直接/延迟依赖,factory保留老效果名称不当作当前VFG需要。只修改VfgBackend.cpp preload15→5;原插件/CUDA/NVCV/NVNGX/core字节不改,移除287,106,032 bytes九NPP。两个生产AMD表确有native_game_frame/native_game_oneshot引用,权重/flags可回退,未为名字/默认skip删文件。+- `runtime-size-build.py build-v1.log` exit0,fresh481步,QML/nativeGPU/NVENCprobe/settings;已有C4244。`runtime-size-stage.py stage` owned完整新便携copy,原2077载荷逐hash核验,tests仅对不可变runtime硬链接复用,新EXE SHA88597f61…41bfc;原包不覆写。+- `runtime-size-native-tests.py native-720-v1 1280 720`与`native-4k-v1 3840 2160`各463/0、exit0;Windows-only PATH,2–8X×三档、RGBA8/RGB10A2、切镜、invalid/device/debug检查;EnumProcessModules仅观察本轮自身PID,五个VFG DLL都来自精简目录、未加载NPP。+- settings-v1.log:331/0;`runtime-size-export-tests.py export-all-v1`:21种D3D12 NVENC HEVC+AAC,16–64帧/60–240fps、时长、音轨/后端日志通过。`runtime-size-combination-tests.py combinations-v1`:2K30AVI+最高SR4K+原生4KNR+VFG8、24/60输入、取消、缺runtime均通过;missing-cudart-only / partial-missing-v1预期exit1无输出、LoadLibrary win32=126,不把报错当成功导出。+- `runtime-size-ui.py ui-slim-v1 package tests/.../app` run/restore/missing exit0;专业列表/节点全部倍率质量,真实DLSS6↔VFG8、seek/resize/暂停、预设重启;High8独立worker冻结输出64帧/240fps且保留音轨。`runtime-size-amd-audit.py`529原记录逐SHA、186weights/62kernels、真实ABI1/144bytes与layout通过,caps.hip=0;无HIP推理。+- 压缩样本原450,593,392 bytes;ZIP9 277,853,065 / 7z-solid-LZMA2-32MiB 166,108,485,约40.2%样本收益。仅包装压缩、不改运行字节;原AMD目录615,032,656 bytes保持。完整包与独立解压验收尚待完成,数据不外推。新版SOURCE/7z/ZIP/manifest和最后交付索引将单独保存。+- 再查PR13/14远端head分别f08934b8/57f2541b,与固定审查版本一致,OPEN/noCI;无PR评论/作者代码执行/HDR实施。推荐P5精确转换→亮度统计/reset→保存/worker兼容→同源列表/节点UI与输出校准→颜色/实机矩阵后经批准合并,详HDR_DOVI_PR_REVIEW。+- `runtime-size-edge-tests.py edges-v1 after`6例通过:5种Qt模拟scale factor GPU与125%软件模式,当前新EXE实际native client右/底gap0,右侧/内侧/中心cyan一致。初始黑边分支30+12+2验收仍保留。本轮不是新的30例或实显示器跨DPI认证。+- 所有新产物为E:/项目/Veyra/{build,tests,logs,tmp,test-packages,verify,archives}/runtime-size-20261004;单测试进程≤300s、构建≤900s,TEMP/TMP/CUDA cache仅子进程E盘。RTX5070/616.56短测;RX9000/Xbox真机/RTX40/616.92/HDR色度/实屏DPI/物理节奏/长稳未验仍明确保留。待最后桌面/main/旧包隔离复核与保存后才执行关机。+## 2026-10-04 极简右侧像素缺口与HDR PR静态审查- 按用户“黑边修掉,HDR先研究/UI方案等通过”分开处理;`a927f92`开`codex/minimal-edge-hdr-review-20261004`,先tag `checkpoint/pre-minimal-edge-hdr-review-20261004`、bundle verify。E盘archives/task/source-before.bundle SHA256 `417c6d03f90e0bd7b518af2f1ea50b9edd8515c91cda340983aa5eb6d6116a94`。开工方案与复现后最小PresentationGeometry/VideoPresenter范围先记录,不扩改HDR/增强链。diff --git a/scripts/acceptance/runtime-size-amd-audit.py b/scripts/acceptance/runtime-size-amd-audit.pynew file mode 100644index 00000000..e5b77e80--- /dev/null+++ b/scripts/acceptance/runtime-size-amd-audit.py@@ -0,0 +1,30 @@+"""Real AMD ABI/layout validation only; no HIP inference on our NVIDIA card."""+import ctypes, hashlib, json, sys+from pathlib import Path+BASE=Path('E:/项目/Veyra');TASK='runtime-size-20261004'+amd=Path(sys.argv[1]) if len(sys.argv)>1 else BASE/'test-packages'/TASK/'Veyra-2.0.2-slim-20261004-win64-portable/runtime/amd-nr'+manifest=json.loads((amd/'amd-nr-local-manifest.json').read_text(encoding='utf8'))+assert manifest['upstream']=='78f548749e74824327b8458c57be31a1df78376a'+for row in manifest['files']:+ p=amd/row['path'];assert p.stat().st_size==row['size'] and hashlib.sha256(p.read_bytes()).hexdigest()==row['sha256'],p+weights=[p for p in (amd/'assets').rglob('*') if p.suffix in ('.f16','.f32')]+kernels=list((amd/'assets/HIP').rglob('*.hsaco'));assert len(weights)==186 and len(kernels)==62+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((amd/'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)+# The upstream Create function validates assets but does not dereference the+# device/queue until PrepareSession. Do not call PrepareSession or execute HIP.+info.device=info.queue=1;info.assets=str((amd/'assets').resolve());ctx=ctypes.c_void_p()+assert ctypes.CFUNCTYPE(ctypes.c_int32,ctypes.POINTER(CreateInfo),ctypes.POINTER(ctypes.c_void_p))(api.Create)(ctypes.byref(info),ctypes.byref(ctx))==0 and ctx.value+assert ctypes.CFUNCTYPE(ctypes.c_int32,ctypes.c_void_p)(api.Destroy)(ctx)==0+result={'filesVerified':len(manifest['files']),'weights':len(weights),'hipModules':len(kernels),'apiBytes':api.size,'abi':api.abi,'caps':{n:getattr(caps,n) for n,_ in caps._fields_},'moduleLayoutPassed':True,'inferenceVerified':False,'runtime':str(amd)}+(BASE/'logs'/TASK/'amd-runtime-audit.json').write_text(json.dumps(result,ensure_ascii=False,indent=2),encoding='utf8')+print('AMD ABI/LAYOUT PASS',json.dumps(result,ensure_ascii=False))diff --git a/scripts/acceptance/runtime-size-archive.py b/scripts/acceptance/runtime-size-archive.pynew file mode 100644index 00000000..6f563756--- /dev/null+++ b/scripts/acceptance/runtime-size-archive.py@@ -0,0 +1,56 @@+"""Lossless ZIP + solid LZMA2 copies, hash every payload after 7z extraction."""+import hashlib, importlib.util, json, subprocess, sys, time, zipfile+from pathlib import Path+import py7zr+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='runtime-size-20261004';LABEL='2.0.2-slim-20261004'+OUT=BASE/'test-packages'/TASK;STAGE=OUT/('Veyra-'+LABEL+'-win64-portable');LOGS=BASE/'logs'/TASK+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)+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/runtime-size-control.py')],check=True)+assert not subprocess.check_output(['git','status','--porcelain'],cwd=ROOT).strip(),'Commit before archiving'+def write(path,data):path.write_text(json.dumps(data,ensure_ascii=False,indent=2)+'\n',encoding='utf8')+if sys.argv[1]=='archive':+ manifest=json.loads((STAGE/'package-manifest.json').read_text(encoding='utf8'))+ files=sorted(p for p in STAGE.rglob('*') if p.is_file())+ expected={r['path'] for r in manifest['files']}|{'package-manifest.json'}+ assert {p.relative_to(STAGE).as_posix() for p in files}==expected+ for p in files:assert not p.is_symlink();pkg.validate_payload(p.relative_to(STAGE).as_posix())+ results=[]+ t=time.monotonic();archive=Path(str(STAGE)+'.zip')+ with zipfile.ZipFile(archive,'x',zipfile.ZIP_DEFLATED,compresslevel=9) as z:+ for p in files:z.write(p,STAGE.name+'/'+p.relative_to(STAGE).as_posix())+ result=pkg.verify_zip(archive);result.update(method='ZIP-deflate9',bytes=archive.stat().st_size,seconds=time.monotonic()-t);results.append(result)+ print('ZIP ALL PAYLOADS PASS',result['bytes'],flush=True)+ t=time.monotonic();archive=Path(str(STAGE)+'.7z');assert not archive.exists()+ with py7zr.SevenZipFile(archive,'w',filters=[{'id':py7zr.FILTER_LZMA2,'preset':5,'dict_size':32*1024*1024}]) as z:+ for i,p in enumerate(files):+ z.write(p,STAGE.name+'/'+p.relative_to(STAGE).as_posix())+ if i and i%250==0:print('7Z PACKING FILES',i,'/',len(files),flush=True)+ print('7Z WRITTEN; EXTRACT/HASH NEXT',archive.stat().st_size,flush=True)+ verify=BASE/'verify'/TASK;verify.mkdir(parents=True,exist_ok=False)+ with py7zr.SevenZipFile(archive,'r') as z:+ names=z.getnames()+ assert len(names)==len(expected) and set(names)=={STAGE.name+'/'+r for r in expected}+ for name in names:pkg.relative(name)+ z.extractall(path=verify)+ app=verify/STAGE.name+ for row in manifest['files']:+ p=app/row['path'];assert p.is_file() and not p.is_symlink() and p.stat().st_size==row['size'] and pkg.digest(p)==row['sha256'],row['path']+ assert pkg.digest(app/'package-manifest.json')==pkg.digest(STAGE/'package-manifest.json')+ result={'archive':str(archive),'sha256':pkg.digest(archive),'bytes':archive.stat().st_size,'method':'7z-solid-LZMA2-32MiB','seconds':time.monotonic()-t,'verifiedFiles':len(manifest['files']),'status':'pass','extractedApp':str(app)};results.append(result)+ for result in results:+ p=Path(result['archive']);Path(str(p)+'.sha256').write_text(result['sha256']+' '+p.name+'\n',encoding='ascii')+ write(LOGS/'archive-audit.json',{'archives':results,'rawBytes':sum(p.stat().st_size for p in files),'codeCommit':manifest['baseCommit'],'appSha256':pkg.digest(STAGE/'veyra_qml_ui.exe')})+ print('BOTH ARCHIVES ALL PAYLOADS PASS',json.dumps(results,ensure_ascii=False),flush=True)+elif sys.argv[1]=='source':+ manifest=json.loads((STAGE/'package-manifest.json').read_text(encoding='utf8'));commit=subprocess.check_output(['git','rev-parse','HEAD'],cwd=ROOT).decode().strip()+ changed=subprocess.check_output(['git','diff','--name-only',manifest['baseCommit'],commit],cwd=ROOT).decode().splitlines()+ assert all(p.startswith('docs/') for p in changed),'Product/recipe changed after package build'+ names=subprocess.check_output(['git','ls-files'],cwd=ROOT).decode().splitlines()+ assert not [p for p in names if Path(p).suffix.lower() in {'.dll','.exe','.lib','.pdb','.whl','.f16','.f32','.i32','.onnx','.hsaco','.cso','.ptx','.addon64'}],'Runtime/model in source'+ source=OUT/('Veyra-'+LABEL+'-source.zip');assert not source.exists()+ subprocess.run(['git','archive','--format=zip','--output',str(source),commit],cwd=ROOT,timeout=60,check=True)+ with zipfile.ZipFile(source) as z:assert z.testzip() is None+ digest=pkg.digest(source);Path(str(source)+'.sha256').write_text(digest+' '+source.name+'\n',encoding='ascii')+ write(LOGS/'source-audit.json',{'source':str(source),'bytes':source.stat().st_size,'sha256':digest,'sourceArchiveCommit':commit,'compiledCodeCommit':manifest['baseCommit'],'onlyDocumentationChanged':changed,'completeDependencySource':False,'sdkRuntimeModelsIncluded':False})+ print('SOURCE ZIP PASS',source,digest,commit,flush=True)+else:raise SystemExit('archive or source')diff --git a/scripts/acceptance/runtime-size-audit.py b/scripts/acceptance/runtime-size-audit.pynew file mode 100644index 00000000..c81d87e2--- /dev/null+++ b/scripts/acceptance/runtime-size-audit.py@@ -0,0 +1,45 @@+"""Read-only dependency/asset audit. No runtime/model is rewritten."""+import gc, hashlib, json, re, subprocess, sys, zipfile+from pathlib import Path+import pefile++ROOT=Path(__file__).resolve().parents[2]; BASE=Path('E:/项目/Veyra'); TASK='runtime-size-20261004'+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/runtime-size-control.py')],check=True)+OLD=BASE/'test-packages/vfg-integration-20261003/Veyra-2.0.2-vfg-20261003-win64-portable'+ARCHIVE=Path(str(OLD)+'.zip'); LOGS=BASE/'logs'/TASK; LOGS.mkdir(parents=True,exist_ok=True)+def digest(p):+ h=hashlib.sha256()+ with p.open('rb') as f:+ while b:=f.read(1024*1024):h.update(b)+ return h.hexdigest()+results={}+for p in sorted((OLD/'runtime/nvidia-vfg').glob('*.dll')):+ pe=pefile.PE(str(p),fast_load=True)+ pe.parse_data_directories(directories=[pefile.DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_IMPORT'],pefile.DIRECTORY_ENTRY['IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT']])+ direct=[x.dll.decode() for x in getattr(pe,'DIRECTORY_ENTRY_IMPORT',[])]+ delay=[x.dll.decode() for x in getattr(pe,'DIRECTORY_ENTRY_DELAY_IMPORT',[])]+ raw=p.read_bytes()+ names=sorted(set(x.decode() for x in re.findall(rb'[A-Za-z0-9_-]{3,}\.dll',raw)))+ results[p.name]={'bytes':p.stat().st_size,'sha256':digest(p),'imports':direct,'delayImports':delay,'dllNameStrings':names}+ pe.close(); del pe,raw; gc.collect()+with zipfile.ZipFile(ARCHIVE) as z:+ stats=[]+ for kind in ('runtime/nvidia-vfg/','runtime/amd-nr/'):+ files=[i for i in z.infolist() if '/'+kind in i.filename and not i.is_dir()]+ stats.append({'kind':kind,'files':len(files),'rawBytes':sum(i.file_size for i in files),'compressedBytes':sum(i.compress_size for i in files),+ 'largestCompressed':[{'path':i.filename.split('/',1)[1],'raw':i.file_size,'compressed':i.compress_size} for i in sorted(files,key=lambda i:i.compress_size,reverse=True)[:15]]})+amd=OLD/'runtime/amd-nr'; assets=[]+for p in sorted(amd.rglob('*')):+ if p.is_file():assets.append({'path':p.relative_to(amd).as_posix(),'bytes':p.stat().st_size,'sha256':digest(p)})+duplicate={}+for r in assets:duplicate.setdefault((r['sha256'],r['bytes']),[]).append(r['path'])+duplicates=[{'sha256':h,'bytes':n,'paths':paths} for (h,n),paths in duplicate.items() if len(paths)>1 and n>1024]+source=BASE/'deps/lmxxf-nr-20261003/src'+references={}+for term in ('normalized-output.f32','noise.f32','noise.f16'):+ r=subprocess.run(['rg','-n','-F',term,str(source)],stdout=subprocess.PIPE,stderr=subprocess.PIPE)+ assert r.returncode in (0,1),r.stderr+ references[term]=r.stdout.decode('utf8',errors='replace').splitlines()+record={'oldArchiveBytes':ARCHIVE.stat().st_size,'stats':stats,'vfgDependencies':results,'amdFiles':assets,'amdDuplicatePayloads':duplicates,'amdRequiredAssetReferences':references}+(LOGS/'dependency-asset-audit.json').write_text(json.dumps(record,ensure_ascii=False,indent=2),encoding='utf8')+print(json.dumps({'oldArchiveBytes':record['oldArchiveBytes'],'stats':stats,'vfgImports':{n:{k:v for k,v in r.items() if k in ('imports','delayImports','dllNameStrings')} for n,r in results.items() if not n.startswith('npp')},'amdDuplicates':duplicates,'references':references},ensure_ascii=False,indent=2))diff --git a/scripts/acceptance/runtime-size-build.py b/scripts/acceptance/runtime-size-build.pynew file mode 100644index 00000000..760ad324--- /dev/null+++ b/scripts/acceptance/runtime-size-build.py@@ -0,0 +1,47 @@+"""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 = 'runtime-size-20261004'+BUILD, TMP, LOGS = (BASE / part / TASK for part in ('build', 'tmp', 'logs'))+CONTROL = ROOT / 'scripts/acceptance/runtime-size-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)')+settings.append('set(VEYRA_CUDA_DRIVER_INCLUDE_DIR [[E:/项目/Veyra/deps/nvidia-vfx-audit-20260921/nvidia/cuda_runtime/include]] CACHE PATH "External CUDA driver headers" FORCE)')+(TMP / 'dependencies.cmake').write_text('\n'.join(settings), encoding='utf8')+targets = sys.argv[2:] or ['veyra_qml_ui', 'veyra_vfg_gpu_tests', 'veyra_vfg_export_probe', 'veyra_vfg_settings_tests']+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/runtime-size-clean-smoke.py b/scripts/acceptance/runtime-size-clean-smoke.pynew file mode 100644index 00000000..b7057f58--- /dev/null+++ b/scripts/acceptance/runtime-size-clean-smoke.py@@ -0,0 +1,66 @@+"""Final 7z extraction identity, native VFG, and six pages in both renderers."""+import hashlib, json, os, subprocess, sys+from pathlib import Path+from PIL import Image+BASE=Path('E:/项目/Veyra');TASK='runtime-size-20261004';LABEL='2.0.2-slim-20261004';ROOT=Path(__file__).resolve().parents[2]+archive=BASE/'test-packages'/TASK/('Veyra-'+LABEL+'-win64-portable.7z')+app=Path(sys.argv[1]).resolve();app.relative_to((BASE/'verify'/TASK).resolve());assert app.is_dir()+verify=app.parent;logs=BASE/'logs'/TASK/'clean-smoke';tmp=BASE/'tmp'/TASK/'clean-smoke'+for p in (logs,tmp):p.mkdir(parents=True,exist_ok=False)+manifest=json.loads((app/'package-manifest.json').read_text(encoding='utf8'))+def verifyFiles():+ for row in manifest['files']:+ f=app/row['path'];assert f.stat().st_size==row['size'] and hashlib.sha256(f.read_bytes()).hexdigest()==row['sha256'],row['path']+verifyFiles()+assert not any(f.suffix in ('.pyd','.addon64','.pdb','.lib','.whl') for f in app.rglob('*') if f.is_file())+command=[sys.executable,'-B',str(ROOT/'scripts/acceptance/runtime-size-ui.py'),'ui-package-final','package',str(app)]+with (logs/'vfg-native-ui.log').open('xb') as log:subprocess.run(command,cwd=ROOT,stdout=log,stderr=subprocess.STDOUT,timeout=290,check=True)+source='''import QtQuick+Item {+ id: test+ property var appWindow: Window.window+ property string evidence: ""+ property bool expectSoftware: false+ property int step: 0+ property bool waiting: false+ property int ticks: 0+ property var pages: ["home","pro","node","exp","set","min"]+ Timer { id: timer; interval: 250; repeat: true; running: true+ onTriggered: {+ if(++test.ticks>100){console.error("CLEAN_SMOKE_FAIL timeout");Qt.quit();return}+ if(!test.evidence.length||test.ticks<8||test.waiting)return+ if(vySoftwareUi!==test.expectSoftware){console.error("CLEAN_SMOKE_FAIL renderer mismatch");Qt.quit();return}+ if(test.step>=test.pages.length){console.log("CLEAN_SMOKE_PASS",test.expectSoftware);timer.stop();Qt.quit();return}+ test.appWindow.page=test.pages[test.step];test.waiting=true;shot.restart()+ }+ }+ Timer { id: shot; interval: 350; onTriggered: {+ test.appWindow.contentItem.grabToImage(result=>{+ if(!result.saveToFile(test.evidence+"/"+test.pages[test.step]+".png")){console.error("CLEAN_SMOKE_FAIL screenshot");Qt.quit();return}+ test.step++;test.waiting=false+ })+ } }+}'''+qml=tmp/'pages.qml';qml.write_text(source,encoding='utf8');main=app/'qml/Veyra/Main.qml';original=main.read_bytes();results=[]+try:+ for mode in ('gpu','software'):+ evidence=verify/(mode+'-evidence');evidence.mkdir();text=original.decode('utf8');at=text.rfind('}')+ loader='\nLoader { source: '+json.dumps(qml.as_uri())+'; onLoaded: { item.evidence='+json.dumps(str(evidence))+'; item.expectSoftware='+str(mode=='software').lower()+' } }\n'+ main.write_text(text[:at]+loader+text[at:],encoding='utf8')+ env=os.environ.copy();env.update(TEMP=str(tmp),TMP=str(tmp),VEYRA_LOG_FILE=str(logs/(mode+'-app.log')),QT_FORCE_STDERR_LOGGING='1',QML_DISABLE_DISK_CACHE='1')+ for key in ('QT_QPA_PLATFORM','QT_QUICK_BACKEND','VEYRA_UI_RHI','VEYRA_VFG_RUNTIME'):env.pop(key,None)+ env['PATH']=os.pathsep.join((env['WINDIR']+'/System32',env['WINDIR'],env['WINDIR']+'/System32/Wbem'))+ if mode=='gpu':env['VEYRA_UI_RHI']='d3d12'+ args=['.\\veyra_qml_ui.exe','--size','1280x720','--reduced-motion','--data-dir',str(verify/(mode+'-profile')),'--exit-after','27000']+ if mode=='software':args.append('--obs-game-capture')+ with (logs/(mode+'-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=40).returncode+ console=(logs/(mode+'-console.log')).read_text(encoding='utf8',errors='replace');assert code==0 and 'CLEAN_SMOKE_PASS' in console and 'CLEAN_SMOKE_FAIL' not in console,console[-3000:]+ files=sorted(evidence.glob('*.png'));assert len(files)==6;pixels=[]+ for file in files:+ im=Image.open(file).convert('RGBA');pixel=im.getpixel((15,80));assert pixel[3]==255 and max(pixel[:3])<160,(file,pixel)+ pixels.append({'page':file.stem,'pixel':pixel,'size':im.size})+ results.append({'renderer':mode,'exit':code,'pages':pixels});print('CLEAN SMOKE PASS',mode,flush=True)+finally:main.write_bytes(original)+verifyFiles()+(logs/'summary.json').write_text(json.dumps({'archive':str(archive),'filesVerified':len(manifest['files']),'portableVfgUi':str(BASE/'logs'/TASK/'ui-package-final/summary.json'),'results':results},indent=2),encoding='utf8')+print('CLEAN VFG PACKAGE PASS',len(manifest['files']),verify,flush=True)diff --git a/scripts/acceptance/runtime-size-combination-tests.py b/scripts/acceptance/runtime-size-combination-tests.pynew file mode 100644index 00000000..dba7d3d4--- /dev/null+++ b/scripts/acceptance/runtime-size-combination-tests.py@@ -0,0 +1,55 @@+"""Real shared graph/NVENC edge cases. Each product invocation is bounded to 290s."""+import json, os, re, shutil, subprocess, sys+FFMPEG=shutil.which("ffmpeg");FFPROBE=shutil.which("ffprobe");assert FFMPEG and FFPROBE+from pathlib import Path+BASE=Path('E:/项目/Veyra');TASK='runtime-size-20261004';APP=BASE/'tests'/TASK/'app'+label=sys.argv[1];out=BASE/'tests'/TASK/label;logs=BASE/'logs'/TASK/label;tmp=BASE/'tmp'/TASK/label+for p in (out,logs,tmp):p.mkdir(parents=True,exist_ok=False)+env=os.environ.copy();env['PATH']=os.pathsep.join((env['WINDIR']+'/System32',env['WINDIR'],env['WINDIR']+'/System32/Wbem'));env.update(TEMP=str(tmp),TMP=str(tmp),CUDA_CACHE_PATH=str(tmp/'cuda-cache'),VEYRA_VFG_RUNTIME=str(BASE/'test-packages/runtime-size-20261004/Veyra-2.0.2-slim-20261004-win64-portable/runtime/nvidia-vfg'))+results=[]+def fixture(rate):+ file=out/f'720p{rate}.mp4'+ with (logs/f'fixture-{rate}.log').open('xb') as log:+ subprocess.run([FFMPEG,'-v','warning','-n','-f','lavfi','-i',f'testsrc2=size=1280x720:rate={rate}','-f','lavfi','-i','sine=frequency=440:sample_rate=48000','-t',str(8/rate),'-c:v','libx264','-preset','fast','-crf','12','-c:a','aac','-shortest',str(file)],env=env,stdout=log,stderr=subprocess.STDOUT,timeout=90,check=True)+ return file+def run(name,source,flags=(),missing=False,runtime=None):+ child=env.copy()+ if missing:child['VEYRA_VFG_RUNTIME']=str(tmp/'missing-runtime')+ if runtime:child['VEYRA_VFG_RUNTIME']=str(runtime)+ file=out/(name+'.mp4');logfile=logs/(name+'.log')+ with logfile.open('xb') as log:+ code=subprocess.run(['.\\veyra_vfg_export_probe.exe',str(source),str(file),'8','1',*flags],executable=str(APP/'veyra_vfg_export_probe.exe'),cwd=APP,env=child,stdout=log,stderr=subprocess.STDOUT,timeout=290).returncode+ text=logfile.read_text(encoding='utf8',errors='replace')+ if missing:+ assert code==1 and not file.exists() and '[vfg]' in text and 'ok=0' in text,text[-6000:]+ elif '--cancel' in flags:+ assert code==0 and not file.exists() and 'cancelled=1' in text,text[-6000:]+ else:+ assert code==0 and 'backend=NVIDIA-VFG' in text and 'quality=1' in text and 'substituting' not in text,text[-6000:]+ assert not re.search(r'\[ERROR\]|device removed|not alive',text),text[-6000:]+ probe=json.loads(subprocess.check_output([FFPROBE,'-v','error','-count_frames','-show_streams','-of','json',str(file)],env=env,timeout=30))+ v=next(s for s in probe['streams'] if s['codec_type']=='video')+ sourceprobe=json.loads(subprocess.check_output([FFPROBE,'-v','error','-count_frames','-show_streams','-of','json',str(source)],env=env,timeout=30))+ sv=next(s for s in sourceprobe['streams'] if s['codec_type']=='video');n,d=map(int,sv['r_frame_rate'].split('/'))+ on,od=map(int,v['r_frame_rate'].split('/'))+ assert int(v['nb_read_frames'])==int(sv['nb_read_frames'])*8 and on/od==n/d*8,probe+ assert abs(float(v['duration'])-int(sv['nb_read_frames'])/(n/d))<1/(on/od),probe+ if '--sr' in flags:assert (v['width'],v['height'])==(3840,2160) and 'nr=1' in text and 'sr=1' in text,text[-6000:]+ (logs/(name+'-probe.json')).write_text(json.dumps(probe,indent=2),encoding='utf8')+ result={'test':name,'exit':code,'status':'pass','log':str(logfile)};results.append(result)+ (logs/'summary.json').write_text(json.dumps(results,indent=2),encoding='utf8');print(result,flush=True)+short=BASE/'tests'/TASK/'export-basic-v2/input.mp4'+if len(sys.argv)<3:+ source=BASE/'tests/field-upgrade-20261003/production-rtss/2k30.avi'+ assert source.exists(),source+ run('2k30-avi-nr-highest-sr4k-vfg8',source,('--nr','--sr'))+ for rate in (24,60):run(f'720p{rate}-vfg8',fixture(rate))+ run('cancel-native8',short,('--cancel',))+ run('missing-runtime-export8',short,missing=True)+else:assert sys.argv[2]=='missing-cudart-only'+partial=tmp/'missing-cudart';partial.mkdir()+for file in (APP/'runtime/nvidia-vfg').glob('*.dll'):+ if file.name!='cudart64_12.dll':(partial/file.name).hardlink_to(file)+run('missing-cudart-export8',short,missing=True,runtime=partial)+assert 'LoadLibrary failed' in (logs/'missing-cudart-export8.log').read_text(encoding='utf8',errors='replace')+print('VFG COMBINATIONS PASS',out)diff --git a/scripts/acceptance/runtime-size-control.py b/scripts/acceptance/runtime-size-control.pynew file mode 100644index 00000000..8ce7e105--- /dev/null+++ b/scripts/acceptance/runtime-size-control.py@@ -0,0 +1,13 @@+"""Only runtime loading/package changes; HDR is still review-only."""+import subprocess+from pathlib import Path+ROOT=Path(__file__).resolve().parents[2]+BASE='fc2ca7163e986f97e53dcab51ffe1ac77bb0615a'+def git(*args):return subprocess.check_output(['git',*args],cwd=ROOT,stderr=subprocess.PIPE).decode().strip()+assert git('branch','--show-current')=='codex/runtime-size-20261004'+assert git('rev-parse','checkpoint/pre-runtime-size-20261004^{commit}')==BASE+paths=set(git('diff','--name-only',BASE).splitlines())|set(git('ls-files','--others','--exclude-standard').splitlines())+extra={p for p in paths if p not in {'AGENTS.md','src/pipeline/VfgBackend.cpp'} and not p.startswith(('docs/','scripts/acceptance/runtime-size-'))}+binary={p for p in paths if Path(p).suffix.lower() in {'.dll','.exe','.lib','.pdb','.zip','.7z','.whl','.f16','.f32','.i32','.bin','.onnx','.hsaco','.cso','.ptx','.addon64'}}+assert not extra|binary,'Runtime scope violation: '+str(extra|binary)+print('RUNTIME SIZE SCOPE PASS',len(paths),'paths; runtime/model bytes and HDR code untouched')diff --git a/scripts/acceptance/runtime-size-edge-tests.py b/scripts/acceptance/runtime-size-edge-tests.pynew file mode 100644index 00000000..4d1b9cd0--- /dev/null+++ b/scripts/acceptance/runtime-size-edge-tests.py@@ -0,0 +1,160 @@+"""Measure actual native-window coverage and composed edge pixels at fractional DPI."""+import ctypes+from ctypes import wintypes+import json+import os+from pathlib import Path+import shutil+import statistics+import subprocess+import sys+import time+from PIL import ImageGrab++ROOT = Path(__file__).resolve().parents[2]+BASE = Path('E:/项目/Veyra')+TASK = 'runtime-size-20261004'+APP = BASE/'tests'/TASK/'app'+REFERENCE = BASE/'test-packages/runtime-size-20261004/Veyra-2.0.2-slim-20261004-win64-portable'+BUILD = BASE/'build'/TASK+label = sys.argv[1]+phase = sys.argv[2] if len(sys.argv)>2 else 'before'+out, logs, tmp = (BASE/k/TASK/label for k in ('tests','logs','tmp'))+for p in (out,logs,tmp): p.mkdir(parents=True,exist_ok=False)+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/runtime-size-control.py')],check=True)+if not APP.exists():+ APP.mkdir()+ for path in REFERENCE.rglob('*'):+ if not path.is_file():continue+ rel=path.relative_to(REFERENCE); dst=APP/rel+ dst.parent.mkdir(parents=True,exist_ok=True)+ if path.suffix.lower() in {'.exe','.qml','.js','.json','.log'} or rel.parts[0] in {'qml','shaders'}:+ shutil.copy2(path,dst)+ else:os.link(path,dst)+shutil.copy2((REFERENCE if phase=='before' else BUILD)/'veyra_qml_ui.exe',APP/'veyra_qml_ui.exe')+media = BASE/'tests'/TASK/'edge-cyan.mp4'+env=os.environ.copy();env.update(TEMP=str(tmp),TMP=str(tmp),CUDA_CACHE_PATH=str(tmp/'cuda-cache'),QML_DISABLE_DISK_CACHE='1',QT_FORCE_STDERR_LOGGING='1')+if not media.exists():+ with (logs/'fixture.log').open('xb') as log:+ subprocess.run(['ffmpeg','-v','warning','-n','-f','lavfi','-i','color=c=cyan:size=1280x720:rate=30','-t','8','-c:v','libx264','-pix_fmt','yuv420p','-crf','12',str(media)],env=env,stdout=log,stderr=subprocess.STDOUT,timeout=45,check=True)+user32=ctypes.WinDLL('user32',use_last_error=True)+callback_type=ctypes.WINFUNCTYPE(wintypes.BOOL,wintypes.HWND,wintypes.LPARAM)+user32.EnumWindows.argtypes=[callback_type,wintypes.LPARAM]+user32.EnumChildWindows.argtypes=[wintypes.HWND,callback_type,wintypes.LPARAM]+user32.GetWindowThreadProcessId.argtypes=[wintypes.HWND,ctypes.POINTER(wintypes.DWORD)]+user32.GetClientRect.argtypes=[wintypes.HWND,ctypes.POINTER(wintypes.RECT)]+user32.ClientToScreen.argtypes=[wintypes.HWND,ctypes.POINTER(wintypes.POINT)]+user32.GetClassNameW.argtypes=[wintypes.HWND,wintypes.LPWSTR,ctypes.c_int]+user32.SetForegroundWindow.argtypes=[wintypes.HWND]+user32.SetWindowPos.argtypes=[wintypes.HWND,wintypes.HWND,ctypes.c_int,ctypes.c_int,ctypes.c_int,ctypes.c_int,wintypes.UINT]+user32.WindowFromPoint.argtypes=[wintypes.POINT]+user32.WindowFromPoint.restype=wintypes.HWND+user32.SetProcessDpiAwarenessContext.argtypes=[wintypes.HANDLE]+user32.SetProcessDpiAwarenessContext(ctypes.c_void_p(-4))+def windows(pid,parent=None):+ found=[]+ @callback_type+ def collect(hwnd,_):+ actual=wintypes.DWORD();user32.GetWindowThreadProcessId(hwnd,ctypes.byref(actual))+ cls=ctypes.create_unicode_buffer(256);user32.GetClassNameW(hwnd,cls,256)+ if actual.value==pid:found.append((hwnd,cls.value))+ return True+ if parent:user32.EnumChildWindows(parent,collect,0)+ else:user32.EnumWindows(collect,0)+ return found+def rect(hwnd):+ client=wintypes.RECT(); assert user32.GetClientRect(hwnd,ctypes.byref(client))+ origin=wintypes.POINT(); assert user32.ClientToScreen(hwnd,ctypes.byref(origin))+ return (origin.x,origin.y,client.right,client.bottom)++cases=[(1,642,'gpu'),(1.25,642,'gpu'),(1.5,643,'gpu'),(1.75,641,'gpu'),(2,643,'gpu'),(1.25,642,'software')]+behaviors=[]+if len(sys.argv)>3 and sys.argv[3]=='full':+ cases=[(scale,width,mode) for mode in ('gpu','software') for scale in (1,1.25,1.5,1.75,2) for width in (641,642,643)]+if len(sys.argv)>3 and sys.argv[3]=='behaviors':+ behaviors=['resize','page-cycle','menu','native-pixels','fullscreen','pro']*2+ cases=[(2 if behavior=='native-pixels' else 1.25,643 if behavior=='native-pixels' else 642,mode)+ for mode in ('gpu','software') for behavior in behaviors[:6]]+if len(sys.argv)>3 and sys.argv[3]=='page-cycle':+ behaviors=['page-cycle','page-cycle']+ cases=[(1.25,642,mode) for mode in ('gpu','software')]+results=[]+main_path=APP/'qml/Veyra/Main.qml'+main_source=(ROOT/'qml/Veyra/Main.qml').read_bytes()+for index,(scale,width,mode) in enumerate(cases):+ behavior=behaviors[index] if behaviors else 'fit'+ name=f'{index}-{mode}-dpr{scale}-w{width}-{behavior}'+ child=env.copy()+ for key in ('QT_QPA_PLATFORM','QT_QUICK_BACKEND','VEYRA_UI_RHI','QT_SCALE_FACTOR','VEYRA_VFG_RUNTIME'):child.pop(key,None)+ child.update(QT_SCALE_FACTOR=str(scale),VEYRA_LOG_FILE=str(logs/(name+'-engine.log')))+ if mode=='gpu':child['VEYRA_UI_RHI']='d3d12'+ # The C++ --size override runs after QML startup and can overwrite the+ # cinema height. Drive the real QML fit after the source has opened instead.+ qml_text=main_source.decode('utf-8'); at=qml_text.rfind('}')+ fixture='\nTimer { interval: 1300; running: true; onTriggered: { root.page="min"; root.widthBeforeNarrow=0; root.width='+str(width)+'; root.fitToFilm(16/9); root.height=Math.round(root.width/(16/9)); root.x=Math.max(0, root.screenArea.x+40); root.y=Math.max(0, root.screenArea.y+40); veyra.logUi("edge-test", "settled="+root.width+"x"+root.height) } }\n'+ def timer(interval,statement):return '\nTimer { interval: '+str(interval)+'; running: true; onTriggered: { '+statement+' } }\n'+ if behavior=='resize':+ fixture+=timer(1700,'root.width=641;')+timer(2100,'root.width=643;')+timer(2500,'root.width=642;')+ elif behavior=='page-cycle':+ fixture+=timer(1700,'root.page="pro";')+timer(2300,'root.page="min"; Qt.callLater(function() { root.widthBeforeNarrow=0; root.width=642; root.fitToFilm(16/9); root.height=Math.round(root.width/(16/9)); });')+ elif behavior=='menu':fixture+=timer(1800,'minPage.openSourceMenuForTest(); veyra.logUi("edge-test", "source-menu="+minPage.sourceMenuOpen);')+ elif behavior=='native-pixels':fixture+=timer(1800,'veyra.aspectMode=1;')+ elif behavior=='fullscreen':fixture+=timer(1800,'root.toggleFullscreen(); veyra.aspectMode=5;')+ elif behavior=='pro':fixture+=timer(1800,'root.page="pro"; root.height=700;')+ main_path.write_text(qml_text[:at]+fixture+qml_text[at:],encoding='utf-8')+ args=[str(APP/'veyra_qml_ui.exe'),'--page','min','--reduced-motion','--data-dir',str(out/(name+'-profile')),'--exit-after','7000' if behaviors else '5000',str(media)]+ if mode=='software':args.append('--obs-game-capture')+ with (logs/(name+'.log')).open('xb') as log:+ proc=subprocess.Popen(args,cwd=APP,env=child,stdout=log,stderr=subprocess.STDOUT)+ deadline=time.monotonic()+3+ root=video=None+ while time.monotonic()<deadline:+ for hwnd,cls in windows(proc.pid):+ if cls.startswith('Qt') and not cls.endswith('ToolSaveBits'):+ children=windows(proc.pid,hwnd)+ candidate=next((h for h,c in children if c=='VeyraQmlVideoHost'),None)+ if candidate:root,video=hwnd,candidate;break+ if video:break+ time.sleep(.08)+ # Raise only our transient test HWND, without activating another app.+ # Foreground-lock restrictions otherwise let unrelated user windows+ # occlude its pixels. Never capture an occluded client.+ if root:assert user32.SetWindowPos(root,ctypes.c_void_p(-1),0,0,0,0,0x13)+ time.sleep(4.2 if behaviors else 2.0)+ assert root and video, name+' missing native windows'+ root_rect,video_rect=rect(root),rect(video)+ x,y,w,h=video_rect if behavior=='pro' else root_rect+ for px,py in ((x+4,y+4),(x+w-5,y+4),(x+4,y+h-5),(x+w-5,y+h-5),(x+w//2,y+h//2)):+ owner=wintypes.DWORD()+ user32.GetWindowThreadProcessId(user32.WindowFromPoint(wintypes.POINT(px,py)),ctypes.byref(owner))+ assert owner.value==proc.pid,name+' test client is occluded; capture skipped'+ # Only the test process's own client, never the user's full desktop.+ image=ImageGrab.grab(bbox=(x,y,x+w,y+h),all_screens=True).convert('RGB')+ image.save(out/(name+'.png'))+ # The cinema pill and restart dialog may cover the middle/lower picture.+ # Sample a vertical run above them, away from rounded top corners.+ # Central rows avoid the top dock. All sample columns are in the test+ # HWND; a native picture at the centre proves the capture is meaningful.+ rows=range(max(96,h//3),min(h-80,h//3+96))+ edges={side: [int(statistics.median(image.getpixel((col,row))[channel] for row in rows)) for channel in range(3)] for side,col in [('left',0),('right',w-1),('rightInner',w-3),('center',w//2)]}+ edges['top']=list(image.getpixel((w//2,3)))+ edges['bottom']=list(image.getpixel((w//2,h-4)))+ code=proc.wait(timeout=12)+ main_path.write_bytes(main_source)+ item={'case':name,'scaleFactor':scale,'mode':mode,'behavior':behavior,'rootClient':root_rect,'videoClient':video_rect,'rightGap':root_rect[0]+root_rect[2]-video_rect[0]-video_rect[2],'bottomGap':root_rect[1]+root_rect[3]-video_rect[1]-video_rect[3],'edges':edges,'exit':code}+ results.append(item)+ (logs/'summary.json').write_text(json.dumps(results,indent=2),encoding='utf-8')+ print(json.dumps(item),flush=True)+ assert code==0,name+' abnormal exit'+ picture=edges['rightInner'] if behavior=='menu' else edges['center']+ # In pro, contain places the image in the vertical centre of the viewport.+ if behavior=='pro':picture=list(image.getpixel((w//2,h//2)))+ assert picture[1]>120 and picture[2]>120,name+' native picture was not captured'+ if phase!='before':+ if behavior=='page-cycle':assert root_rect[2:]==(803,451),name+' cinema transition not settled'+ if behavior!='pro':assert item['rightGap']==0 and item['bottomGap']==0,name+' uncovered client edge'+ if behavior in ('native-pixels','fullscreen'):+ assert max(edges['right'])<20,name+' intentional side bar lost'+ elif behavior=='pro':assert max(edges['top'])<20 and max(edges['bottom'])<20,name+' intentional letterbox lost'+ else:assert edges['right'][1]>120 and edges['right'][2]>120,name+' black content at client edge'+print('MINIMAL EDGE MEASUREMENTS COMPLETE',phase,len(results),flush=True)diff --git a/scripts/acceptance/runtime-size-export-tests.py b/scripts/acceptance/runtime-size-export-tests.pynew file mode 100644index 00000000..94fd6cd5--- /dev/null+++ b/scripts/acceptance/runtime-size-export-tests.py@@ -0,0 +1,30 @@+"""All 21 VFG combinations through the real shared graph and D3D12 NVENC."""+import json, os, re, shutil, subprocess, sys+from pathlib import Path+BASE=Path('E:/项目/Veyra');TASK='runtime-size-20261004';APP=BASE/'tests'/TASK/'app'+label=sys.argv[1];out,logs,tmp=(BASE/p/TASK/label for p in ('tests','logs','tmp'))+for p in (out,logs,tmp):p.mkdir(parents=True,exist_ok=False)+probe=shutil.which('ffprobe');assert probe+env=os.environ.copy();env.update(TEMP=str(tmp),TMP=str(tmp),CUDA_CACHE_PATH=str(tmp/'cuda-cache'),+ VEYRA_VFG_RUNTIME=str(APP/'runtime/nvidia-vfg'))+env['PATH']=os.pathsep.join((env['WINDIR']+'/System32',env['WINDIR'],env['WINDIR']+'/System32/Wbem'))+source=BASE/'tests'/TASK/'export-basic-v2/input.mp4';assert source.exists()+results=[]+for quality in range(3):+ for multiplier in range(2,9):+ name=f'720p30-{multiplier}x-q{quality}';file=out/(name+'.mp4')+ with (logs/(name+'.log')).open('xb') as log:+ code=subprocess.run(['.\\veyra_vfg_export_probe.exe',str(source),str(file),str(multiplier),str(quality)],executable=str(APP/'veyra_vfg_export_probe.exe'),cwd=APP,env=env,stdout=log,stderr=subprocess.STDOUT,timeout=290).returncode+ text=(logs/(name+'.log')).read_text(encoding='utf8',errors='replace')+ assert code==0 and 'backend=NVIDIA-VFG' in text and 'nvenc' in text.lower(),text[-5000:]+ assert not re.search(r'\[ERROR\]|device removed|not alive|substituting',text),text[-5000:]+ data=json.loads(subprocess.check_output([probe,'-v','error','-count_frames','-show_streams','-of','json',str(file)],env=env,timeout=30))+ video=next(s for s in data['streams'] if s['codec_type']=='video');audio=next(s for s in data['streams'] if s['codec_type']=='audio')+ assert video['codec_name']=='hevc' and int(video['nb_read_frames'])==8*multiplier,data+ for key in ('avg_frame_rate','r_frame_rate'):+ n,d=map(int,video[key].split('/'));assert abs(n/d-30*multiplier)<.00001*30*multiplier,data+ assert abs(float(video['duration'])-8/30)<1/(30*multiplier) and abs(float(audio['duration'])-8/30)<.06,data+ results.append({'case':name,'exit':code,'frames':8*multiplier,'probe':data})+ (logs/'summary.json').write_text(json.dumps(results,indent=2),encoding='utf8')+ print('EXPORT PASS',name,flush=True)+print('ALL VFG EXPORTS PASS',len(results),flush=True)diff --git a/scripts/acceptance/runtime-size-isolation.py b/scripts/acceptance/runtime-size-isolation.pynew file mode 100644index 00000000..6e4dda7a--- /dev/null+++ b/scripts/acceptance/runtime-size-isolation.py@@ -0,0 +1,47 @@+"""Small local EXE patch and read-only isolation audit; no full runtime duplication."""+import hashlib+import json+from pathlib import Path+import shutil+import subprocess+import sys+import zipfile++ROOT=Path(__file__).resolve().parents[2]+BASE=Path('E:/项目/Veyra')+TASK='runtime-size-20261004'+LOGS=BASE/'logs'/TASK+OUT=BASE/'test-packages'/TASK+REFERENCE=BASE/'test-packages/vfg-integration-20261003/Veyra-2.0.2-vfg-20261003-win64-portable'+DESKTOP=Path('C:/Users/123/Desktop/Veyra DLSS Video Player')+START=BASE/'archives/field-upgrade-20261003-start'+EXPECTED_BASE='be4da2ff173aa74de8e2e1d5ecc73d40a23584ba8898ffd534e636a8793b3d6b'+def digest(path):+ h=hashlib.sha256()+ with path.open('rb') as f:+ while block:=f.read(1024*1024):h.update(block)+ return h.hexdigest()+def git(*args,cwd=ROOT):return subprocess.check_output(['git',*args],cwd=cwd,stderr=subprocess.PIPE)+def normalized(value):return value.decode('utf-8-sig').replace('\r\n','\n').rstrip('\n')++subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/runtime-size-control.py')],check=True)+LOGS.mkdir(parents=True,exist_ok=True)+if sys.argv[1]=='audit':+ start=json.loads((START/'manifest.json').read_text(encoding='utf-8-sig'))+ untracked=[row for row in start['files'] if row['path'].replace('\\','/').startswith('desktop-untracked/')]+ isolation={+ 'desktopStatusNormalizedEqual':normalized(git('status','--porcelain','--branch',cwd=DESKTOP))==normalized((START/'desktop-status.txt').read_bytes()),+ 'workingPatchBytesEqual':git('diff','--binary',cwd=DESKTOP)==(START/'desktop-working.patch').read_bytes(),+ 'indexPatchBytesEqual':git('diff','--cached','--binary',cwd=DESKTOP)==(START/'desktop-index.patch').read_bytes(),+ 'untrackedSourceHashesEqual':all(digest(DESKTOP/row['path'].replace('\\','/').split('/',1)[1]).upper()==row['sha256'].upper() for row in untracked),+ 'mainPreserved':git('rev-parse','main').decode().strip()=='66cd3e50590766e5a654528ab61e491dc4d30c83',+ }+ manifest=json.loads((REFERENCE/'package-manifest.json').read_text(encoding='utf-8-sig'))+ rows=manifest['files']+ isolation['basePortablePayloadHashesEqual']=all(digest(REFERENCE/row['path']).lower()==row['sha256'].lower() for row in rows)+ isolation['baseExeHashEqual']=digest(REFERENCE/'veyra_qml_ui.exe')==EXPECTED_BASE+ LOGS.joinpath('source-isolation.json').write_text(json.dumps(isolation,indent=2)+'\n',encoding='utf-8')+ print(json.dumps(isolation,indent=2))+ assert all(isolation.values()),'Isolation audit failed'+ print('ISOLATION PASS',len(untracked),'untracked sources;',len(rows),'original payloads unchanged')+else:raise SystemExit('Use audit')diff --git a/scripts/acceptance/runtime-size-modules.py b/scripts/acceptance/runtime-size-modules.pynew file mode 100644index 00000000..69c196b0--- /dev/null+++ b/scripts/acceptance/runtime-size-modules.py@@ -0,0 +1,21 @@+"""List DLL paths for our own test subprocess, never enumerate user processes."""+import ctypes+from ctypes import wintypes+kernel=ctypes.WinDLL('kernel32',use_last_error=True)+psapi=ctypes.WinDLL('psapi',use_last_error=True)+kernel.OpenProcess.argtypes=[wintypes.DWORD,wintypes.BOOL,wintypes.DWORD];kernel.OpenProcess.restype=wintypes.HANDLE+kernel.CloseHandle.argtypes=[wintypes.HANDLE]+psapi.EnumProcessModulesEx.argtypes=[wintypes.HANDLE,ctypes.POINTER(wintypes.HMODULE),wintypes.DWORD,ctypes.POINTER(wintypes.DWORD),wintypes.DWORD]+psapi.GetModuleFileNameExW.argtypes=[wintypes.HANDLE,wintypes.HMODULE,wintypes.LPWSTR,wintypes.DWORD]+def modules(pid):+ handle=kernel.OpenProcess(0x0400|0x0010,False,pid)+ if not handle:return []+ try:+ array=(wintypes.HMODULE*2048)();needed=wintypes.DWORD()+ if not psapi.EnumProcessModulesEx(handle,array,ctypes.sizeof(array),ctypes.byref(needed),3):return []+ paths=[]+ for h in array[:min(needed.value//ctypes.sizeof(wintypes.HMODULE),len(array))]:+ value=ctypes.create_unicode_buffer(32768)+ if psapi.GetModuleFileNameExW(handle,h,value,len(value)):paths.append(value.value)+ return paths+ finally:kernel.CloseHandle(handle)diff --git a/scripts/acceptance/runtime-size-native-tests.py b/scripts/acceptance/runtime-size-native-tests.pynew file mode 100644index 00000000..eb22d012--- /dev/null+++ b/scripts/acceptance/runtime-size-native-tests.py@@ -0,0 +1,25 @@+"""Bounded real-GPU native SDK/interop checks, isolated logs/TEMP on E:."""+import importlib.util, json, os, subprocess, sys, time+from pathlib import Path+BASE=Path('E:/项目/Veyra');TASK='runtime-size-20261004'+logs,tests,tmp=(BASE/p/TASK for p in ('logs','tests','tmp'))+for p in (logs,tests,tmp):p.mkdir(parents=True,exist_ok=True)+label=sys.argv[1] if len(sys.argv)>1 else 'native-v1'+if not label.replace('-','').isalnum():raise SystemExit('invalid label')+env=os.environ.copy();env['PATH']=os.pathsep.join((env['WINDIR']+'/System32',env['WINDIR'],env['WINDIR']+'/System32/Wbem'));env.update(TEMP=str(tmp),TMP=str(tmp),CUDA_CACHE_PATH=str(tmp/'cuda-cache'))+command=[str(BASE/'build'/TASK/'veyra_vfg_gpu_tests.exe'),str(BASE/'test-packages/runtime-size-20261004/Veyra-2.0.2-slim-20261004-win64-portable/runtime/nvidia-vfg'),*(sys.argv[2:] or ['1280','720'])]+spec=importlib.util.spec_from_file_location('modules',Path(__file__).with_name('runtime-size-modules.py'));mod=importlib.util.module_from_spec(spec);spec.loader.exec_module(mod)+loaded=set();start=time.monotonic()+with (logs/(label+'.log')).open('x',encoding='utf8') as out:+ with subprocess.Popen(command,cwd=tests,env=env,stdout=out,stderr=subprocess.STDOUT) as child:+ while child.poll() is None:+ loaded.update(mod.modules(child.pid))+ if time.monotonic()-start>290:child.kill();child.wait();break+ time.sleep(.25)+ code=child.returncode if time.monotonic()-start<=290 else 124+(logs/(label+'.json')).write_text(json.dumps({'command':command,'returncode':code,'timeoutSeconds':290,'log':str(logs/(label+'.log')),'loadedModules':sorted(loaded)},ensure_ascii=False,indent=2),encoding='utf8')+assert not any(Path(p).name.lower().startswith('npp') for p in loaded),'Unexpected NPP module in native test'+assert any(Path(p).name.lower()=='nvvfxvideoframegeneration.dll' for p in loaded),'No VFG plugin observed'+print('NATIVE GPU TEST',code,logs/(label+'.log'))+print('\n'.join((logs/(label+'.log')).read_text(encoding='utf8',errors='replace').splitlines()[-18:]))+raise SystemExit(code)diff --git a/scripts/acceptance/runtime-size-stage.py b/scripts/acceptance/runtime-size-stage.pynew file mode 100644index 00000000..90ef6ef4--- /dev/null+++ b/scripts/acceptance/runtime-size-stage.py@@ -0,0 +1,71 @@+"""Stage a complete owned portable copy with only the audited VFG DLLs."""+import hashlib, importlib.util, json, shutil, subprocess, sys+from pathlib import Path+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='runtime-size-20261004'+OLD=BASE/'test-packages/vfg-integration-20261003/Veyra-2.0.2-vfg-20261003-win64-portable'+STAGE=BASE/'test-packages'/TASK/'Veyra-2.0.2-slim-20261004-win64-portable'+BUILD=BASE/'build'/TASK+KEEP={'cudart64_12.dll','NVCVImage.dll','nvngxruntime.dll','NVVideoEffects.dll','nvVFXVideoFrameGeneration.dll'}+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/runtime-size-control.py')],check=True)+def digest(p):+ h=hashlib.sha256()+ with p.open('rb') as f:+ while b:=f.read(1024*1024):h.update(b)+ return h.hexdigest()+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)+if sys.argv[1]=='stage':+ STAGE.mkdir(parents=True,exist_ok=False)+ old=json.loads((OLD/'package-manifest.json').read_text(encoding='utf8'))+ omitted=[]+ for row in old['files']:+ rel=Path(row['path']);source=OLD/rel+ assert source.stat().st_size==row['size'] and digest(source)==row['sha256'].lower(),rel+ if rel.as_posix().startswith('runtime/nvidia-vfg/') and rel.name not in KEEP:+ omitted.append(row);continue+ pkg.validate_payload(rel.as_posix())+ dest=STAGE/rel;dest.parent.mkdir(parents=True,exist_ok=True)+ shutil.copy2(source,dest)+ shutil.copy2(BUILD/'veyra_qml_ui.exe',STAGE/'veyra_qml_ui.exe')+ for p in BUILD.joinpath('shaders').rglob('*'):+ if p.is_file():+ dst=STAGE/'shaders'/p.relative_to(BUILD/'shaders');dst.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(p,dst)+ vfg=json.loads((STAGE/'vfg-runtime-manifest.json').read_text(encoding='utf8'))+ vfg['files']=[r for r in vfg['files'] if r['name'] in KEEP]+ assert len(vfg['files'])==5+ vfg.update(vfgOnlyDependencySet=True,omittedSdkLibraries=[r['path'].split('/')[-1] for r in omitted],dependencyAudit='docs/RUNTIME_SIZE_ACCEPTANCE_2026-10-04.md')+ (STAGE/'vfg-runtime-manifest.json').write_text(json.dumps(vfg,ensure_ascii=False,indent=2),encoding='utf8')+ tests=BASE/'tests'/TASK/'app';tests.mkdir(parents=True,exist_ok=False)+ for p in STAGE.rglob('*'):+ if not p.is_file():continue+ dst=tests/p.relative_to(STAGE);dst.parent.mkdir(parents=True,exist_ok=True)+ if p.suffix.lower() in {'.exe','.qml','.js','.json','.log'} or p.relative_to(STAGE).parts[0] in {'qml','shaders'}:shutil.copy2(p,dst)+ else:dst.hardlink_to(p)+ for name in ('veyra_vfg_gpu_tests','veyra_vfg_export_probe','veyra_vfg_settings_tests'):shutil.copy2(BUILD/(name+'.exe'),tests/(name+'.exe'))+ fixtures=BASE/'tests'/TASK/'export-basic-v2';fixtures.mkdir(parents=True,exist_ok=True)+ shutil.copy2(BASE/'tests/vfg-integration-20261003/export-basic-v2/input.mp4',fixtures/'input.mp4')+ fixtures=BASE/'tests'/TASK/'ui-v1';fixtures.mkdir(parents=True,exist_ok=True)+ shutil.copy2(BASE/'tests/vfg-integration-20261003/ui-v1/preview-720p30.mp4',fixtures/'preview-720p30.mp4')+ result={'stage':str(STAGE),'testApp':str(tests),'removed':omitted,'removedBytes':sum(r['size'] for r in omitted),'vfgBytes':sum((STAGE/'runtime/nvidia-vfg'/n).stat().st_size for n in KEEP),'appSha256':digest(STAGE/'veyra_qml_ui.exe')}+ (BASE/'logs'/TASK/'stage.json').write_text(json.dumps(result,ensure_ascii=False,indent=2),encoding='utf8')+ print('STAGED',json.dumps({k:v for k,v in result.items() if k!='removed'},ensure_ascii=False),flush=True)+elif sys.argv[1]=='finalize':+ assert not subprocess.check_output(['git','status','--porcelain'],cwd=ROOT).strip(),'Commit tested code and reports first'+ for name in ('RUNTIME_SIZE_PLAN_2026-10-04.md','RUNTIME_SIZE_ACCEPTANCE_2026-10-04.md','RUNTIME_SIZE_USER_GUIDE_2026-10-04.md','MINIMAL_EDGE_ACCEPTANCE_2026-10-04.md','HDR_DOVI_PR_REVIEW_2026-10-04.md','WORKLOG.md','CURRENT_STATUS.md'):shutil.copy2(ROOT/'docs'/name,STAGE/'docs'/name)+ shutil.copy2(ROOT/'docs/RUNTIME_SIZE_USER_GUIDE_2026-10-04.md',STAGE/'LOCAL-TEST-PACKAGE.md')+ manifest=json.loads((OLD/'package-manifest.json').read_text(encoding='utf8'))+ records=[]+ for p in sorted(STAGE.rglob('*')):+ if not p.is_file():continue+ rel=p.relative_to(STAGE).as_posix()+ if rel=='package-manifest.json':continue+ pkg.validate_payload(rel)+ assert p.suffix.lower() not in {'.pyd','.pdb','.lib','.whl','.addon64'},rel+ records.append({'path':rel,'size':p.stat().st_size,'sha256':digest(p)})+ commit=subprocess.check_output(['git','rev-parse','HEAD'],cwd=ROOT).decode().strip()+ manifest.update(candidate='2.0.2-slim-20261004',baseCommit=commit,sourceArchiveCommit=commit,worktreeDirty=False,localOnly=True,releaseReady=False,files=records,+ originalCandidate='2.0.2-vfg-20261003',hdrPrProductChanges=False,slimming='docs/RUNTIME_SIZE_ACCEPTANCE_2026-10-04.md')+ manifest.pop('sourceSnapshot',None)+ manifest['projectSource']={'name':'Veyra-2.0.2-slim-20261004-source.zip','compiledCodeCommit':commit,'documentationMayBeNewer':True,'sdkRuntimeModelsIncluded':False}+ (STAGE/'package-manifest.json').write_text(json.dumps(manifest,ensure_ascii=False,indent=2),encoding='utf8')+ print('FINALIZED',len(records),'files',sum(r['size'] for r in records),'bytes',commit,flush=True)+else:raise SystemExit('stage or finalize')diff --git a/scripts/acceptance/runtime-size-ui.py b/scripts/acceptance/runtime-size-ui.pynew file mode 100644index 00000000..d93c87f5--- /dev/null+++ b/scripts/acceptance/runtime-size-ui.py@@ -0,0 +1,62 @@+"""Real GUI hot switches, persistence and process-isolated VFG export; each run <300s."""+import json, os, re, shutil, subprocess, sys+from pathlib import Path+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='runtime-size-20261004'+APP=BASE/'tests'/TASK/'app';BUILD=BASE/'build'/TASK+FFPROBE=shutil.which('ffprobe');assert FFPROBE+label=sys.argv[1];out=BASE/'tests'/TASK/label;logs=BASE/'logs'/TASK/label;tmp=BASE/'tmp'/TASK/label+packaged=len(sys.argv)>2 and sys.argv[2]=='package'+if packaged:+ APP=Path(sys.argv[3]).resolve();assert APP.is_relative_to(BASE.resolve()) and (APP/'vfg-runtime-manifest.json').is_file()+for p in (out,logs,tmp):p.mkdir(parents=True,exist_ok=False)+env=os.environ.copy();env.update(TEMP=str(tmp),TMP=str(tmp),CUDA_CACHE_PATH=str(tmp/'cuda-cache'),VEYRA_VFG_RUNTIME=str(BASE/'test-packages/runtime-size-20261004/Veyra-2.0.2-slim-20261004-win64-portable/runtime/nvidia-vfg'),QT_FORCE_STDERR_LOGGING='1',QML_DISABLE_DISK_CACHE='1')+for key in ('QT_QPA_PLATFORM','QT_QUICK_BACKEND','VEYRA_UI_RHI'):env.pop(key,None)+if packaged:+ env.pop('VEYRA_VFG_RUNTIME',None)+ windir=Path(env['WINDIR']);env['PATH']=os.pathsep.join(map(str,(windir/'System32',windir,windir/'System32/Wbem')))+else:+ for name in ('veyra_qml_ui.exe',):shutil.copy2(BUILD/name,APP/name)+ shutil.copytree(ROOT/'qml',APP/'qml',dirs_exist_ok=True)+media=out/'preview-720p30.mp4';short=BASE/'tests'/TASK/'export-basic-v2/input.mp4'+previous=BASE/'tests'/TASK/'ui-v1/preview-720p30.mp4'+if previous.exists() and label!='ui-v1':media=previous+else:+ with (logs/'fixture.log').open('xb') as log:subprocess.run(['ffmpeg','-v','warning','-n','-f','lavfi','-i','testsrc2=size=1280x720:rate=30','-t','90','-c:v','libx264','-preset','ultrafast','-crf','28','-an',str(media)],env=env,stdout=log,stderr=subprocess.STDOUT,timeout=90,check=True)+profile=out/'profile';outputs=out/'outputs';outputs.mkdir()+phases=('run','restore','missing')+if len(sys.argv)>2 and not packaged:+ assert sys.argv[2]=='missing-only'+ phases=('missing',)+ shutil.copytree(BASE/'tests'/TASK/'ui-v2/profile',profile)+main=APP/'qml/Veyra/Main.qml';original=main.read_bytes();source=original.decode('utf8');at=source.rfind('}')+results=[]+try:+ for phase in phases:+ child=env.copy();child['VEYRA_LOG_FILE']=str(logs/(phase+'-engine.log'))+ data=profile+ if phase=='missing':+ data=out/'missing-profile';shutil.copytree(profile,data);child['VEYRA_VFG_RUNTIME']=str(tmp/'missing-runtime')+ loader='\nLoader { source: '+json.dumps((ROOT/'scripts/acceptance/vfg-ui.qml').as_uri())+'; onLoaded: { item.media='+json.dumps(str(media))+'; item.shortMedia='+json.dumps(str(short))+'; item.evidence='+json.dumps(str(out))+'; item.phase='+json.dumps(phase)+' } }\n'+ main.write_text(source[:at]+loader+source[at:],encoding='utf8')+ with (logs/(phase+'.log')).open('xb') as log:+ code=subprocess.run(['.\\veyra_qml_ui.exe','--page','pro','--size','1280x900','--reduced-motion','--export-out',str(outputs),'--data-dir',str(data),'--exit-after','240000'],executable=str(APP/'veyra_qml_ui.exe'),cwd=APP,env=child,stdout=log,stderr=subprocess.STDOUT,timeout=270).returncode+ text=(logs/(phase+'.log')).read_text(encoding='utf8',errors='replace')+ marker={'run':'VFG_UI_PASS','restore':'VFG_UI_RESTORE_PASS','missing':'VFG_UI_MISSING_PASS'}[phase]+ assert code==0 and marker in text and 'VFG_UI_FAIL' not in text,text[-5000:]+ if phase=='run':+ pids=re.findall(r'\[export-worker\] started jobId=\d+ pid=(\d+)',text);assert len(pids)==1,pids+ worker=APP/'logs'/('export-worker-'+pids[0]+'.log')+ assert worker.resolve().is_relative_to(APP.resolve())+ workerText=worker.read_text(encoding='utf8',errors='replace')+ assert 'backend=NVIDIA-VFG vfgQuality=2' in workerText and 'multiplier=8 quality=2' in workerText,workerText[-4000:]+ destination=logs/worker.name;assert destination.resolve().is_relative_to((BASE/'logs'/TASK).resolve())+ shutil.move(str(worker),str(destination))+ results.append({'phase':phase,'returncode':code,'marker':marker});print(results[-1],flush=True)+finally:main.write_bytes(original)+if 'run' in phases:+ files=list(outputs.glob('*.mp4'));assert len(files)==1,files+ probe=json.loads(subprocess.check_output([FFPROBE,'-v','error','-count_frames','-show_streams','-of','json',str(files[0])],env=env,timeout=30))+ v=next(s for s in probe['streams'] if s['codec_type']=='video');assert int(v['nb_read_frames'])==64 and v['r_frame_rate']=='240/1',probe+ results.append({'export':str(files[0]),'probe':probe})+(logs/'summary.json').write_text(json.dumps(results,ensure_ascii=False,indent=2),encoding='utf8')+print('VFG UI PRODUCT PASS',out)diff --git a/src/pipeline/VfgBackend.cpp b/src/pipeline/VfgBackend.cppindex 2a539c56..941e6603 100644--- a/src/pipeline/VfgBackend.cpp+++ b/src/pipeline/VfgBackend.cpp@@ -217,9 +217,13 @@ bool VfgBackend::initialize(gfx::D3D12DeviceContext& context,const std::wstring&Impl::Current current(p);if(!current.active)return false;if(!p.cu(p.cuStreamCreateFn(&p.stream,CU_STREAM_NON_BLOCKING),"cuStreamCreate"))return false;const fs::path runtime=runtimeDirectory(root);- const std::array<const wchar_t*,15> dependencies={L"cudart64_12.dll",L"nppc64_12.dll",L"nppial64_12.dll",L"nppicc64_12.dll",L"nppidei64_12.dll",L"nppif64_12.dll",L"nppig64_12.dll",L"nppim64_12.dll",L"nppist64_12.dll",L"nppitc64_12.dll",L"NVCVImage.dll",L"nvngxruntime.dll",L"NVVideoEffects.dll",L"nvVFXVideoFrameGeneration.dll",nullptr};+ // VFG consumes our encoded shared CUDA buffers directly. Create/Init wrap+ // these pixels without NvCVImage_Transfer or other NPP conversion effects.+ // Keep the original core/plugin/CUDA bytes; unrelated SDK image-processing+ // DLLs are not dependencies of this path (native 8/10-bit tests cover it).+ const std::array<const wchar_t*,5> dependencies={L"cudart64_12.dll",L"NVCVImage.dll",L"nvngxruntime.dll",L"NVVideoEffects.dll",L"nvVFXVideoFrameGeneration.dll"};HMODULE core=nullptr,image=nullptr;- for(auto name:dependencies){if(!name)continue;auto dll=load(runtime/name);if(!dll)return false;p.libraries.push_back(dll);+ for(auto name:dependencies){auto dll=load(runtime/name);if(!dll)return false;p.libraries.push_back(dll);if(std::wstring_view(name)==L"NVVideoEffects.dll")core=dll;if(std::wstring_view(name)==L"NVCVImage.dll")image=dll;}#define BIND_VFX(member,name) if(!bind(core,name,p.member))return falseBIND_VFX(create,"NvVFX_CreateEffect");BIND_VFX(destroy,"NvVFX_DestroyEffect");BIND_VFX(setU32,"NvVFX_SetU32");BIND_VFX(setImage,"NvVFX_SetImage");