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 clipped software UI icons without full-window repaint
Veyra Goal Agent29e33dfd5a8a
diff --git a/AGENTS.md b/AGENTS.mdindex 09440477..8e2ff4d2 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -1,5 +1,7 @@# Veyra 项目 Agent 执行规则+> **2026-10-11 软件 UI 残影接手**:用户要求读取刚才 Claude 的 UI 修复聊天并接手,明确不得恢复 2.0.4 高频 UI 绘制导致的性能回退,随后补充超分图标滚动越界。按 docs/UI_SOFTWARE_DAMAGE_PLAN_2026-10-11.md,在 codex/ui-smear-handoff-20261011 从 main 5ba186a 隔离继续必要 QML 图标/虚线边框与宿主日志修复、定向构建测试,覆盖这些具体 UI 接点旧冻结。独立 start 保全 53 既有工作树/496 未提交文件与 Claude 未完成补丁;旧 start/guard 不改,不派 Agent,不动其它 Claude 修复、GPU 优先级、视频/NR/补帧算法、运行库原件/驱动/真实配置。最终使用软件路径缓存 SVG Image,撤回整窗重绘、QuickPrivate 与软件 Shape layer 原型,保持 33ms 有界统计,不增加持续绘制。产物全 E 盘,测试每进程≤300秒、构建≤900秒;无新打包/main合并/push/Release/关机授权。+> **2026-10-10 已验修复合入本地main**:用户在完整测试包交付后明确“合并到main吧”。已将codex/sr-visual-quality-20261010的48d8f34及其11个未合入提交通过--no-ff整合,功能merge为ff80a49,Git树与实测分支完全相同;随后仅更新合并记录/当前状态。本地main包含PGS字幕、播放列表/PR31、BMD原生开关、设置恢复/输入焦点/布局/关闭项编辑等已验修复,SR画质实验保持撤回。范围与验收见docs/MERGE_MAIN_2026-10-10.md;46工作树/495脏文件存档到E盘archives/merge-fixes-20261010/start.json,除本轮main外均保持。新构建明确配置DeckLink SDK,打包使用已验zlib/PS5 slices256版FFmpeg,不无意退回旧依赖。此次只本地合并和文档收尾,不push/Release/换版本/重打包/关机,不改运行库原件/用户配置,不删旧分支或工作树;历史“尚未合并”仅代表当时。> **2026-10-10 超分实验撤回与本地测试包**:用户要求停止超分继续优化、去掉负优化并汇报,随后明确“弄好了打个测试包给我”。本轮所有SR生产实验(局部/整帧静态运动校验、额外纹理/pass、DLSS档位及FSR曝光实验)全部撤回到c664a67,保留此前已验功能修复和共同参考测试工具。本地制作2.0.6-fixes-20261010完整NVIDIA测试包与对应源码,逐文件核对既有批准runtime、patched FFmpeg的zlib/PS5 slices256、许可证、私有配置冷启动与ZIP;覆盖下条“不打测试包”。不新发正式版、不merge/push/Release/关机,不派Agent,不动45既有工作树/495脏文件/main或真实配置。不得把重复帧误差改善说成一般视频画质提升。diff --git a/apps/veyra-qml/main.cpp b/apps/veyra-qml/main.cppindex 03a9e04d..9c370009 100644--- a/apps/veyra-qml/main.cpp+++ b/apps/veyra-qml/main.cpp@@ -501,13 +501,8 @@ static int runApplication(int argc, char** argv, QString& restartProgram, QStrinconst bool overlayCompat = !obsGameCapture && overlayCompatAuto&& (rivaTuner || overlayCompatRestart) && !forcedRenderer[0];const bool softwareUi = obsGameCapture || overlayCompat;- if (softwareUi) {- // Partial software damage updates can leave transformed/clipped controls- // behind while scrolling. Repaint a complete UI frame when it changes;- // do not request continuous frames or alter the native video pipeline.- qputenv("QSG_SOFTWARE_RENDERER_FORCE_PARTIAL_UPDATES", "0");- veyra::log::info("app", "software UI partial updates disabled (scroll damage repair)");- }+ if (softwareUi)+ veyra::log::info("app", "software UI: cached raster paths; normal partial updates; no additional frame requests");if (obsGameCapture) {QQuickWindow::setSceneGraphBackend(QStringLiteral("software"));veyra::log::info("app", "OBS game capture compatibility: software UI; native D3D12 video unchanged");diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.mdindex a1ef8603..dc774f1d 100644--- a/docs/CURRENT_STATUS.md+++ b/docs/CURRENT_STATUS.md@@ -1,5 +1,11 @@# 当前项目状态 / Current Status+## 2026-10-11 软件 UI 残影及超分图标裁剪++在 `codex/ui-smear-handoff-20261011` 接手 Claude 未完成修复。已复现 Qt6.8.3 软件 Shape 的空裁剪越界;旧环境变量没有实际作用。最终仅软件图标/虚线边框改用缓存 SVG Image,GPU 保留 Shape。整窗重绘、条件重绘、软件 Shape layer 原型均撤回;没有新持续绘制或修改 33ms 统计策略。++真实生产页150% DPI滚动回归:原版相关区域残留1237像素、完整重绘后头部越界209像素,修复后OBS/RTSS选择路径均0。GTA4K30/原版NR1080p/普通class2短测:GPU UI NR 5.919→5.899ms、UI35→35次/秒;软件UI NR 5.863→5.836ms、UI38→37.5次/秒,进程CPU未增长。不将单次小幅差异宣传为普遍性能收益。构建和定向回归通过,现场完整overlay环境仍待复测;详见[修复记录](UI_SOFTWARE_DAMAGE_REPORT_2026-10-11.md)。本轮未合入main、未打新包或发布,原包及既有工作树保持。+## 2026-10-10 已验修复合入本地main用户在本地测试包交付后授权合并main。`codex/sr-visual-quality-20261010`的实测tip `48d8f34`及11个未合入提交已通过功能merge `ff80a49`合入,合并Git树与实测树完全相同;后续只增加文档记录。包含内嵌PGS/压缩字幕、播放列表/文件夹导入及PR31采集音频、Blackmagic原生可保存开关、设置切换恢复、数字输入快捷键、多语言布局和关闭效果器编辑不重建;现有HDR补帧兼容开关默认关闭。超分画质实验全部撤回,无本轮新的普遍画质收益。diff --git a/docs/UI_SOFTWARE_DAMAGE_PLAN_2026-10-11.md b/docs/UI_SOFTWARE_DAMAGE_PLAN_2026-10-11.mdnew file mode 100644index 00000000..97584483--- /dev/null+++ b/docs/UI_SOFTWARE_DAMAGE_PLAN_2026-10-11.md@@ -0,0 +1,33 @@+# 软件 UI 滚动残影、图标裁剪与性能保护++用户要求接手 Claude 刚才的 UI 修复,避免恢复 2.0.4 的高频 UI 绘制回退,随后补充超分图标滚出页面后没有遮挡。只修 OBS / RTSS 软件 UI 的绘制和裁剪;不改视频、NR、补帧、GPU 优先级、其它 Claude 分支或真实配置。本轮没有新打包/合并/推送/发布/关机。++## 接手事实与定位++- Claude 会话 fea88e5a-198c-4f0f-b9db-ac275fa983ae 最后实际定位于 2026-10-11 14:54,14:55 额度耗尽。原工作树只有 main.cpp 未完成编辑:删除无效环境变量、引入两个 Qt 私有头,尚未实现替代修复或构建。+- main 基线 5ba186a;独立分支 codex/ui-smear-handoff-20261011。E:/项目/Veyra/archives/ui-smear-handoff-20261011/start.json 保全 53 个既有工作树、496 份未提交文件、Claude 原始补丁、Git bundle 和原包 EXE。旧基线/guard 不改。+- 当前 Qt 6.8.3 的 Qt6Quick.dll 没有实现 QSG_SOFTWARE_RENDERER_FORCE_PARTIAL_UPDATES,旧日志声称关闭局部更新并不成立。+- 固定 Qt 源码显示软件 Shape RenderNode 在 clip region 为空时跳过设裁剪却继续 drawPath,软件 RenderNode 又不同于普通 Image/Glyph 对空 damage 的处理。实际生产页面已复现残留、完整重绘仍把超分图标画到固定头部,说明只扩大重绘区域不足以修正裁剪。+- 2.0.4 回退来自持续统计动画跟随 320Hz 屏幕绘制。已验 VTelemetryValue.qml 保持 33ms 有界插值;历史 GTA NR 6.964 → 6.559ms 不是本轮收益。++## 最终实施++1. 软件渲染时,VIcon 将相同 Lucide PathSvg 数据、颜色/透明度、填充或描边生成 SVG data URI,按屏幕 DPR 光栅化为缓存 Image。由 Qt 普通 Image 节点遵守父级 clip 和局部 damage;GPU 模式保留原 Shape。+2. 专业页“添加 NR 层”的虚线边框采用同样的软件 Image / GPU Shape 分支。其它页面 Shape 中 VBackdrop 已有软件矩形路径,保持原样。+3. 删除宿主无效环境变量和错误日志,记录真实绘制策略。没有 Qt DLL 修改、新依赖、QuickPrivate、新动画/绘制定时器或 update/requestUpdate。QtSvg 和 qsvg 插件已在原包内。+4. 整窗重绘原型撤回:相同 NR 短测中 CPU 从 0.197661 增到 0.325101 CPU 秒/秒,约 +64.5%,且仍存在裁剪越界。条件重绘及软件 Shape layer 原型也撤回;layer 还出现图标绘制位置异常。原型补丁/日志保留追溯,不计最终通过。++## 验证及失败判定++- 私有测试 EXE 驱动实际 Main/ProPage 的 Flickable;不把测试驱动编进生产 EXE。150% DPI,展开第一 NR 层及三个 NR 层形成真实长列表,80 次 1.25px 滚动;通过 QScreen 读取已呈现窗口像素。QQuickWindow::grabWindow 会主动绘制,不能用来证明没有残影。+- 比较滚动后与 resize 触发的完整重绘参考;另比较滚动前后固定头部,尤其检查完整重绘后超分图标是否越界。要求修复路径相关区域像素差为零、图标 Image.Ready、两条兼容路径正确。GPU 监控读数变化在独立区域记录,不当残影。+- 使用用户 GTA 4K 视频、原版 NR、内部 1080p、普通 GPU 优先级做同配置顺序短测,记录 UI 提交次数、进程 CPU 时间和 NR GPU 时间。实际读取 GPU 调度 class=2;不提高优先级掩盖回退。+- 保持 VTelemetryValue 文件 SHA。若增加持续绘制、出现可重复性能退步或仍有图标越界,则修正/撤回,不通过降低画质换取成功。+- 每测试进程 ≤300 秒、构建 ≤900 秒;产物全在 E:/项目/Veyra/{build,tests,logs,tmp,reports,archives}/ui-smear-handoff-20261011。收尾核对既有工作树、原包与运行库。实测结论和用户现场待验分开记录于同轮 REPORT。++## 固定版本依据++- [Qt 6.8.3 软件 Shape 的空裁剪处理](https://github.com/qt/qtdeclarative/blob/v6.8.3/src/quickshapes/qquickshapesoftwarerenderer.cpp)+- [Qt 6.8.3 软件 RenderNode 与普通节点的 damage 处理](https://github.com/qt/qtdeclarative/blob/v6.8.3/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp)+- [Qt 6.8.3 软件渲染损伤区域](https://github.com/qt/qtdeclarative/blob/v6.8.3/src/quick/scenegraph/adaptations/software/qsgabstractsoftwarerenderer.cpp)+- docs/STABILITY_EXPORT_PRIORITY_REPORT_2026-10-06.mddiff --git a/docs/UI_SOFTWARE_DAMAGE_REPORT_2026-10-11.md b/docs/UI_SOFTWARE_DAMAGE_REPORT_2026-10-11.mdnew file mode 100644index 00000000..ad7354f9--- /dev/null+++ b/docs/UI_SOFTWARE_DAMAGE_REPORT_2026-10-11.md@@ -0,0 +1,49 @@+# 软件 UI 残影与超分图标裁剪修复记录++最终生产改动只有 main.cpp、VIcon.qml、ProPage.qml。OBS / RTSS 软件 UI 中,相同图标路径先光栅化成缓存 SVG Image,普通 Image 节点处理父级裁剪;GPU UI 保留原 Shape。虚线 NR 添加边框同样处理。旧无效环境变量及误导日志删除,CMake、引擎、NR、补帧、GPU 优先级、运行库不改;VTelemetryValue 的 33ms 策略字节不变。++## 原因及撤回++Claude 仅删除旧变量并加入两个私有头,未完成替代实现。Qt6Quick.dll 实际没有读取 QSG_SOFTWARE_RENDERER_FORCE_PARTIAL_UPDATES,因此以前的“局部更新已关闭”日志不是事实。++[Qt 6.8.3 软件 Shape](https://github.com/qt/qtdeclarative/blob/v6.8.3/src/quickshapes/qquickshapesoftwarerenderer.cpp) 在空 clip 时跳过 setClipRegion 仍 drawPath;[软件 RenderNode](https://github.com/qt/qtdeclarative/blob/v6.8.3/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderablenode.cpp) 对空 damage 的处理与普通 Image 不同。实际完整重绘仍把超分星形和箭头画到固定头部,证明全窗重绘不能解决裁剪。++已撤回完整/条件重绘及软件 Shape layer 原型。完整重绘原型虽然 NR 没变慢,一次配对 CPU 0.197661 → 0.325101 CPU 秒/秒,增加约64.5%,仍有图标越界;layer 还出现位置异常。原型 performance.json、withdrawn-adaptive-repaint.patch 留作失败记录,不能当最终证据。最终没有私有 QtQuick 依赖、绘制钩子、新 Timer/动画、update/requestUpdate 或每帧整窗刷屏。SVG 插件是原包已有依赖。++## 实际滚动和裁剪++scripts/acceptance/ui-software-damage-test.py pixels-expanded:真实 Main/ProPage、1280×800逻辑尺寸、150% DPI,3个NR层/首层展开,80次1.25px滚动至100px。独立私有EXE只加测试驱动;QScreen读已呈现窗口,截图没有触发渲染。滚动后与同位置完整重绘参考比较,另用固定头部与初始图像比较,避免将“重绘参考本身也越界”误当成功。++| 软件路径 | 滚动区域及边缘残留像素(最大通道差>10) | 完整重绘后固定头部改变像素 |+| --- | ---: | ---: |+| 原 OBS QML | 1237 | 209 |+| 修复 OBS QML | 0 | 0 |+| 修复 RTSS 选择路径 | 0 | 0 |++37个可见图标全部 Image.Ready;人工核对超分/NR/HDR图标、箭头及工具栏位置,未见异常。RTSS整窗差62像素来自独立GPU状态区域,相关裁剪区域为0。空闲3秒只有3/6次自然状态更新,未形成持续高频绘制。RTSS测试验证兼容选择路径,没有重新注入RTSS DLL、没有重做OBS实际抓流。记录:reports同名/pixels-expanded.json、clipping.json;PNG与每个probe.json在logs同名/pixels-*-raster2。++## GTA 1080p NR 性能保护++顺序执行 performance-final,用户原始 GTA 4K30 视频,原版NVIDIA NR、单层内部1080p、强度1/风格0,画面调控/SR/FG关闭,普通GPU调度实际读取class2。RTX5070/616.56、本机320Hz显示环境。每例40秒有效播放、墙钟53–56秒;每例29个前台有效一秒样本,NR为一秒均值的中位数。CPU是进程CPU秒/墙钟秒(一个CPU核的时间口径),不是整机百分比或纯UI耗时。++| 路径 | NR GPU ms | NR变化 | UI提交次数/秒 | 进程CPU秒/秒 |+| --- | --- | --- | --- | --- |+| 普通 GPU UI | 5.919221 → 5.898998 | -0.34% | 35 → 35 | 0.265282 → 0.270664 (+2.03%) |+| OBS 软件 UI | 5.863204 → 5.835594 | -0.47% | 38 → 37.5 | 0.258953 → 0.223809 (-13.57%) |++两种路径视频提交FPS均30,不是物理显示刷新率。普通GPU用原包EXE+QML对照当前EXE+QML;软件路径使用同一当前EXE,仅切换原/新VIcon与ProPage,隔离本次QML修复。UI没有恢复到320Hz;本次短测未看到NR回退、软件CPU没有增长。小幅NR差异不能当算法收益;软件CPU的本次差值也不能推广为所有机器都降低同样比例。没有以提高优先级或减少NR画质掩盖问题。++原始证据 reports同名/performance-final.json;logs同名/perf-final-* 的命令、日志、29个样本和GPU调度读取完整保存。原版NR SHA e16bcf15e16e13f527491cdf7845b2fe6521a738d8f7c9c721866a8496e1fc8e;统计QML SHA e88541114240fad417f7d1f08bde0b8236964ff7e9005c8fc8214743c006958b。++## 构建、保护和限制++ui-software-damage-build.py:实际CMake配置通过;仅重编本次变更main.cpp,重链接已验不可变引擎/依赖对象,不冒称全工程clean重编。构建9秒,独立probe构建8秒,旧缓存/库输入SHA不变。正式EXE SHA bed99662e2be2dbde65fd41fd946cb5c4a627b42f50d305e0a47127e4356273a。生产EXE不含测试驱动。++初次SVG回归发现sourceSize.height引用同组sourceSize.width造成绑定循环,已改为两个独立DPR表达式;失败logs/pixels-fixed-obs-raster保留,最终raster2没有绑定循环。更早expanded像素测试因时间点不一致导致参考位置不同,保留pixels-expanded-invalid-timing.json,不计通过;最终改为滚动完成回调后截图并核对contentY/contentHeight一致。++1626文件原包每次前后SHA核对通过;测试使用私有app/data-dir,测试Main注入已原子恢复。旧53工作树/496未提交文件与main保护守卫另行收尾核对。没有改DLL/SDK/模型/驱动或真实用户配置。所有产物E盘,只有一份以硬链接复用不可变原包的私有运行目录;没有新用户包、main合并、push或Release。对应验证源SHA、构建回执/不可变输入和证据SHA在reports同名/validation.json,最终commit/bundle/守卫见final.json。++本机短测和生产页面复现修复已闭环;反馈者完整overlay环境、不同DPI/主题/驱动、长时间运行及全部播放入口仍需现场回归,不声称这些都已经验收。NV显存问题不属于本次修复。+++本轮临时缓存清理被自动审批拒绝:目标E:/项目/Veyra/tmp/ui-smear-handoff-20261011的PowerShell递归删除返回blocked by policy,命令未执行。560文件/80127256逻辑字节保留,未绕过重试,不计为已释放磁盘;cleanup.json如实记录。修复、构建和验收结果不受影响。diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex ba29ad24..8fb2c43b 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -9020,3 +9020,20 @@ package.py smoke:未改生产QML,私有data-dir、系统PATH、缓存/日志在E:/项目/Veyra/worktrees/main-merge-20261002执行`git merge --no-ff codex/sr-visual-quality-20261010 -m "Merge tested 2.0.6 subtitle, playlist, capture and settings fixes"`,功能merge ff80a49ad199334cafb79de79a8ee1b1f66c8aee,无冲突。`git diff --exit-code codex/sr-visual-quality-20261010 HEAD`通过,完整Git树与实测分支相同;因此复用已验证16EXE构建、13组回归、两种界面实际播放和ZIP核验,不声称新跑测试。之后只补AGENTS/CURRENT_STATUS/本WORKLOG/docs/MERGE_MAIN_2026-10-10.md四份文档。字幕/播放列表/PR31/BMD开关/设置恢复/焦点/布局/关闭项编辑等一并合入,SR画质实验仍全部撤回。合并完成/收尾标签、source-after.bundle verify与最终main在reports/merge-fixes-20261010/final.json。新守卫逐项核对其余45工作树/495脏文件、48d8f34源分支、产品与实测版本一致、仅四文档变化、main干净和原测试包SHA1350c723d56bd8aba13afbb09f959f591f1e6ce819f324e4b3fcb7dbc9103b9c,旧包714646109字节不动。后续构建明确外置DeckLink SDK,打包明确使用已验zlib/PS5 slices256/dav1d FFmpeg前缀与对应源码。没有push/Release/版本变更/重打包/删除分支工作树/关机,实卡与显存增长未解边界保持。++## 2026-10-11 接手Claude软件UI残影与超分图标裁剪++用户要求读取刚才Claude的UI修复记录并接手,避免回到2.0.4高频UI拖慢NR,随后补充超分图标滚动未被遮挡。只读取相关本机会话fea88e5a-198c-4f0f-b9db-ac275fa983ae,最后实际方案是beforeRendering扩大整窗damage,额度耗尽时只删无效环境变量/加私有头,未实现或构建。保存原补丁SHA fa64f180581d3aa5de2483bfcc65a1946c968b2e5dc958954202afd414749d31;独立不可变start保护53旧工作树/496脏文件/main5ba186a,开工tag/source-before.bundle通过。新树codex/ui-smear-handoff-20261011,全产物E:/项目/Veyra/{build,tests,logs,tmp,reports,archives}/ui-smear-handoff-20261011,不派Agent、不改真实配置/原件,不合并/推送/打包/发布/关机。++固定Qt6.8.3源码和实际Qt6Quick.dll确认旧QSG_SOFTWARE_RENDERER_FORCE_PARTIAL_UPDATES没有读取点。完整/条件重绘原型已撤回:虽不加新帧请求,原型配对CPU 0.197661→0.325101秒/秒(+64.5%),而且完整重绘仍在父clip外绘制超分图标。软件Shape layer还出现位置异常,也撤回。实际问题指向Qt软件Shape在空clip时仍drawPath及RenderNode对空damage的处理;原型performance.json/withdrawn-adaptive-repaint.patch保留,不计最终通过。最终仅VIcon/添加NR层虚线在软件模式按DPR缓存相同SVG为普通Image,GPU原Shape不变;宿主删除无效变量/误导日志。CMake与所有engine/shader/source/NR/FG/GPU优先级字节保持,无QuickPrivate或绘制钩子、新Timer/动画/update请求。++以py -3.11 -I运行scripts/acceptance/ui-software-damage-build.py:logs同名/build-20261011-153617/receipt.json,CMake实际配置/main编译/重链接均exit0,9秒,50项不可变输入SHA不变;只是本次main.cpp重编,不冒称clean全工程重编。GUI SHA bed99662e2be2dbde65fd41fd946cb5c4a627b42f50d305e0a47127e4356273a。--probe构建154018回执8秒,独立EXE SHA24e666a7e3af72caff67f5cfce4b6c66d4702e973fa302c143c7590ea159011f;生产EXE不含驱动。++以py -3.11 -B运行ui-software-damage-test.py pixels-expanded及clipping:最终logs/pixels-*-raster2,实际Main/ProPage、150% DPI、3NR层/首层展开、80次滚动至100px;QScreen只读已呈现像素,不触发重画,contentY/contentHeight前后相同。原OBS残留1237相关像素、完整重绘后固定头部改变209;固定OBS/RTSS两路径均0。37个图标Ready,无QML错误;RTSS整窗62像素变化为独立GPU监控区域,不能当残影。人工核对超分图标、箭头和工具栏。没有重做RTSS真实注入或OBS捕获。早期expanded抓图时机错误的pixels-expanded-invalid-timing.json保留;第一版SVG同组sourceSize.height绑定width造成循环,已改为两个独立DPR表达式,失败raster日志保留,最终raster2没有循环。++ui-software-damage-test.py performance-final四例顺序40秒有效播放、各53–56秒墙钟,用户GTA原4K30、原版NR1080p/单层/强度1/风格0,SR/FG/画面调控关,GPU实际class2。每例29个前台有效一秒样本;NR一秒均值中位数,GPU UI 5.919221→5.898998ms(-0.34%)、UI35→35次/秒、CPU0.265282→0.270664秒/秒(+2.03%);软件UI 5.863204→5.835594ms(-0.47%)、UI38→37.5、CPU0.258953→0.223809(-13.57%)。四例视频提交30fps,不冒充物理刷新率;小幅差异仅本机短测,不宣称算法提速或跨机收益。普通GPU原包EXE/QML对照当前产品;软件用同一EXE仅原/新两个QML对照。统计VTelemetryValue SHA e88541114240fad417f7d1f08bde0b8236964ff7e9005c8fc8214743c006958b字节保持,未回到320Hz。++原包1626文件每次测试前后SHA通过,私有运行目录硬链接复用不可变原件、变更文件原子替换,注入Main已恢复。reports同名/finalize.py逐项核对生产范围、50输入、最终EXE/源码/证据SHA、clip0、normal调度和29样本;短测保守守卫不允许UI额外>3次/秒、NR>3%、CPU>15%,全部通过,不将阈值内差异当普遍等效证明。validation.json保存构建回执/生产源/证据身份,最终控制检查、commit/checkpoint/bundle与本轮缓存整理另记final.json。只有本机生产页复现与短测通过,现场overlay/其它DPI/驱动/长时间播放未全部验收;NV显存问题不在此次范围。+++本轮临时缓存清理被自动审批拒绝:目标E:/项目/Veyra/tmp/ui-smear-handoff-20261011的PowerShell递归删除返回blocked by policy,命令未执行。560文件/80127256逻辑字节保留,未绕过重试,不计为已释放磁盘;cleanup.json如实记录。修复、构建和验收结果不受影响。diff --git a/qml/Veyra/ProPage.qml b/qml/Veyra/ProPage.qmlindex 8eaf1008..f1c27a88 100644--- a/qml/Veyra/ProPage.qml+++ b/qml/Veyra/ProPage.qml@@ -1423,7 +1423,30 @@ VPage {readonly property bool full: veyra.nrLayers.length >= 4opacity: full ? 0.45 : 1color: addHover.hovered && !full ? Theme.accentSoft : "transparent"+ readonly property bool softwareRendering: (typeof vySoftwareUi !== "undefined" && vySoftwareUi)+ || GraphicsInfo.api === GraphicsInfo.Software+ readonly property color outline: addHover.hovered && !addLayer.full ? Theme.accent : Qt.rgba(1, 1, 1, 0.2)+ Image {+ anchors.fill: parent+ visible: addLayer.softwareRendering+ // Software Shape ignores empty clips. A cached image keeps+ // this dashed path inside the inspector like the icons.+ source: {+ if (!visible || width <= 1 || height <= 1) return ""+ const c = addLayer.outline+ const paint = "rgb(" + Math.round(c.r * 255) + "," + Math.round(c.g * 255) + "," + Math.round(c.b * 255) + ")"+ return "data:image/svg+xml;charset=utf-8," + encodeURIComponent(+ '<svg xmlns="http://www.w3.org/2000/svg" width="' + width + '" height="' + height + '">'+ + '<rect x="0.5" y="0.5" width="' + (width-1) + '" height="' + (height-1)+ + '" rx="10" fill="none" stroke="' + paint + '" stroke-opacity="' + c.a+ + '" stroke-width="1" stroke-dasharray="5 4"/></svg>')+ }+ sourceSize.width: Math.max(1, Math.ceil(width * Screen.devicePixelRatio))+ sourceSize.height: Math.max(1, Math.ceil(height * Screen.devicePixelRatio))+ cache: true+ }Shape {+ visible: !addLayer.softwareRenderinganchors.fill: parentShapePath {strokeWidth: 1diff --git a/qml/Veyra/VIcon.qml b/qml/Veyra/VIcon.qmlindex f39a60b3..a44687d5 100644--- a/qml/Veyra/VIcon.qml+++ b/qml/Veyra/VIcon.qml@@ -2,6 +2,7 @@// to `size` (16 by default), no fill, stroke 1.7 in the current colour, round caps and// joins. The stroke width is in viewBox units, as in the SVG, so it scales with size.import QtQuick+import QtQuick.Windowimport QtQuick.Shapesimport "IconData.js" as IconData@@ -14,17 +15,43 @@ Item {// .play svg: fill:currentColor; stroke:none (the filled play/pause glyphs).property bool filled: falsereadonly property bool known: IconData.paths[name] !== undefined+ readonly property bool softwareRendering: (typeof vySoftwareUi !== "undefined" && vySoftwareUi)+ || GraphicsInfo.api === GraphicsInfo.SoftwareimplicitWidth: sizeimplicitHeight: size+ function softwareSvg() {+ const paint = "rgb(" + Math.round(color.r * 255) + "," + Math.round(color.g * 255) + "," + Math.round(color.b * 255) + ")"+ const svg = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"'+ + ' fill="' + (filled ? paint : "none") + '" stroke="' + (filled ? "none" : paint)+ + '" opacity="' + color.a + '" stroke-width="' + strokeWidth + '" stroke-linecap="round" stroke-linejoin="round">'+ + '<path d="' + IconData.paths[name] + '"/></svg>'+ return "data:image/svg+xml;charset=utf-8," + encodeURIComponent(svg)+ }++ Image {+ objectName: "software-icon-image"+ width: icon.size; height: icon.size+ visible: icon.known && icon.softwareRendering+ source: visible ? icon.softwareSvg() : ""+ sourceSize.width: Math.max(1, Math.ceil(icon.size * Screen.devicePixelRatio))+ sourceSize.height: Math.max(1, Math.ceil(icon.size * Screen.devicePixelRatio))+ cache: true+ smooth: true+ }+Shape {+ // Qt 6.8.3's software Shape render node still paints when its clip is+ // empty. Rasterize the same SVG path once: the normal image node then+ // respects ancestor clips and damage regions, including while scrolling.+ // The GPU path stays vector based. No timer or full-window repaint.width: 24height: 24scale: icon.size / 24transformOrigin: Item.TopLeftpreferredRendererType: Shape.CurveRenderer- visible: icon.known+ visible: icon.known && !icon.softwareRenderingShapePath {fillColor: icon.filled ? icon.color : "transparent"strokeColor: icon.filled ? "transparent" : icon.colordiff --git a/scripts/acceptance/ui-software-damage-build.py b/scripts/acceptance/ui-software-damage-build.pynew file mode 100644index 00000000..943dd2b6--- /dev/null+++ b/scripts/acceptance/ui-software-damage-build.py@@ -0,0 +1,124 @@+"""Scoped UI build: main.cpp only; all engine objects are accepted immutable inputs.++Also configures the real CMake project: no QuickPrivate or full-redraw dependency.+--probe compiles a PRIVATE copy of main.cpp with the test-only renderer probe.+"""+from pathlib import Path+import ctypes, hashlib, json, os, re, subprocess, sys, time++ROOT = Path(__file__).resolve().parents[2]+BASE = Path('E:/项目/Veyra'); TASK = 'ui-smear-handoff-20261011'+OUT = BASE / 'build' / TASK; TMP = BASE / 'tmp' / TASK / 'build'+LOG = BASE / 'logs' / TASK / ('build-' + time.strftime('%Y%m%d-%H%M%S'))+PRIOR = BASE / 'logs/sr-visual-quality-20261010/build-20261010-153535/receipt.json'+CACHE = BASE / 'build/vfg-next-20261007'+for p in (OUT, TMP, LOG): p.mkdir(parents=True, exist_ok=True)+began = time.monotonic(); commands = []; inputs = {}++def sha(p):+ with Path(p).open('rb') as f: return hashlib.file_digest(f, 'sha256').hexdigest()++def protect(p):+ p = Path(p); assert p.is_file(), p+ inputs[str(p)] = sha(p); return p++shell = ctypes.WinDLL('shell32')+shell.CommandLineToArgvW.argtypes = [ctypes.c_wchar_p, ctypes.POINTER(ctypes.c_int)]+shell.CommandLineToArgvW.restype = ctypes.POINTER(ctypes.c_wchar_p)+ctypes.windll.kernel32.LocalFree.argtypes = [ctypes.c_void_p]++def args(s):+ n = ctypes.c_int(); p = shell.CommandLineToArgvW(s, ctypes.byref(n))+ result = [p[i] for i in range(n.value)]; ctypes.windll.kernel32.LocalFree(p); return result++env = dict(os.environ); env.update(TEMP=str(TMP), TMP=str(TMP), VSLANG='1033')+setup = subprocess.run(['cmd.exe', '/u', '/d', '/c', r'call C:\PROGRA~2\MICROS~3\2022\BUILDT~1\VC\Auxiliary\Build\vcvars64.bat >nul && set'],+ stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True, encoding='utf-16-le', errors='replace', env=env, check=True)+for line in setup.stdout.splitlines():+ if '=' in line:+ k, v = line.split('=', 1)+ if k and not k.startswith('='): env[k] = v+env.update(TEMP=str(TMP), TMP=str(TMP))++def run(command, label, cwd=TMP):+ commands.append(command)+ with (LOG / (label + '.log')).open('wb') as stream:+ result = subprocess.run(command, cwd=cwd, env=env, stdout=stream, stderr=subprocess.STDOUT,+ timeout=min(300, 890 - (time.monotonic() - began)))+ print(label, result.returncode, flush=True)+ if result.returncode:+ print((LOG / (label + '.log')).read_text(encoding='utf8', errors='replace')[-7000:]); raise SystemExit(result.returncode)++prior = json.loads(protect(PRIOR).read_text(encoding='utf8'))+link = next(c for c in prior['commands'] if 'vs_link_exe' in c and any(v.endswith('veyra_qml_ui.exe') for v in c))+cmake = str(protect(link[0]))+ninja = re.search(r'^CMAKE_MAKE_PROGRAM:FILEPATH=(.*)$', (CACHE / 'CMakeCache.txt').read_text(encoding='utf8'), re.M).group(1)+protect(ninja)+conf = OUT / 'cmake'+if sys.argv[1:] != ['--probe']:+ configure = [cmake, '-S', str(ROOT), '-B', str(conf), '-G', 'Ninja', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_MAKE_PROGRAM=' + ninja,+ '-DCMAKE_PREFIX_PATH=C:/veyra-deps/qt-veyra/6.8.3/msvc2022_64;C:/veyra-deps/xbox-installed/x64-windows-static',+ '-DVEYRA_BUILD_QML_UI=ON', '-DVEYRA_BUILD_QT_PROBE=OFF', '-DVEYRA_ENABLE_EXPERIMENTAL_DLSSNR=ON',+ # FFmpeg's installed FindFFMPEG.cmake cannot resolve its non-ASCII prefix.+ # Use the same 9.0.1 import/header ABI as the accepted build. The private+ # runtime comes from the already verified zlib/PS5-slices256 package.+ '-DVEYRA_FFMPEG_ROOT=C:/veyra-deps/ffmpeg-ps5-dav1d-installed',+ '-DVEYRA_LIBASS_ROOT=E:/veyra-ascii-20261005/installed/x64-windows-static',+ '-DVEYRA_DECKLINK_SDK_DIR=E:/项目/Veyra/deps/decklink-sdk-obs31-20261009',+ '-DVEYRA_MAGEWELL_SDK_DIR=E:/项目/Veyra/deps/magewell/3.3.1.1596']+ for option in ('REMOTEPLAY', 'MOONLIGHT', 'XBOX', 'DLSS_FG', 'DLSS_SR', 'NVOF'):+ configure.append('-DVEYRA_ENABLE_' + option + '=OFF')+ sdk = Path('C:/Users/123/Desktop/Veyra DLSS Video Player/third_party_local')+ for key, path in {'DLSS_SDK_ROOT':'nvidia/DLSS_SDK_310.7.0', 'NVOF_SDK_ROOT':'nvidia/Optical_Flow_SDK_5.0.7',+ 'NVENC_HEADERS_ROOT':'nvidia/nv-codec-headers-13.0', 'XESS_ROOT':'intel/xess-3.0.2'}.items():+ configure.append('-DVEYRA_' + key + '=' + (sdk / path).as_posix())+ run(configure, 'configure-real-project')+old = args(subprocess.check_output([ninja, '-t', 'commands', 'CMakeFiles/veyra_qml_ui.dir/apps/veyra-qml/main.cpp.obj'], cwd=CACHE, text=True, encoding='utf8').splitlines()[-1])+new = args(subprocess.check_output([ninja, '-t', 'commands', 'CMakeFiles/veyra_qml_ui.dir/apps/veyra-qml/main.cpp.obj'], cwd=conf, text=True, encoding='utf8').splitlines()[-1])+privateIncludes = [v for v in new if v.startswith(('-I', '-external:I')) and '/6.8.3' in v.replace('\\', '/')]+assert not any('QtQuick/6.8.3' in v.replace('\\', '/') for v in privateIncludes), 'withdrawn QuickPrivate dependency remains'+source = protect(ROOT / 'apps/veyra-qml/main.cpp')+name = 'veyra_qml_ui'+if sys.argv[1:] == ['--probe']:+ probe = protect(ROOT / 'tests/qml/SoftwareUiDamageProbe.h')+ text = source.read_text(encoding='utf8')+ text = text.replace('#include "../veyra/resource.h"', '#include "' + (ROOT / 'apps/veyra/resource.h').as_posix() + '"')+ text = '#include "' + probe.as_posix() + '"\n' + text+ needle = ' if (testSize.isValid()) window->resize(testSize);'+ assert text.count(needle) == 1+ text = text.replace(needle, needle + '\n installSoftwareUiDamageProbe(window, &bridge);')+ source = OUT / 'probe-main.cpp'; source.write_text(text, encoding='utf8'); protect(source)+ name = 'veyra_ui_damage_probe'+obj = OUT / (name + '.obj')+compile = old[:1] + ['/utf-8', '/I' + str(ROOT / 'include'), '/I' + str(ROOT / 'src')] + privateIncludes+compile += [v for v in old[1:-1] if not v.startswith(('/Fo', '/Fd')) and v != '/showIncludes']+compile += ['/Fo' + str(obj), '/Fd' + str(OUT / (name + '.compile.pdb')), str(source)]+run(compile, 'compile-main')+oldRsp = protect(next(v[1:] for v in link if v.startswith('@')))+text = oldRsp.read_text(encoding='utf8')+oldMain = prior['overrides']['CMakeFiles/veyra_qml_ui.dir/apps/veyra-qml/main.cpp.obj']['path']+assert text.count(oldMain) == 1+for item in args('link ' + text)[1:]:+ if Path(item).suffix.lower() in ('.obj', '.res', '.lib') and Path(item).is_file(): protect(item)+text = text.replace(oldMain, str(obj))+rsp = OUT / (name + '.rsp'); rsp.write_text(text, encoding='utf8')+manifest = OUT / ('manifest-' + name); manifest.mkdir(exist_ok=True)+command = []+for value in link:+ if value.startswith('--intdir='): value = '--intdir=' + str(manifest)+ elif value.startswith('@'): value = '@' + str(rsp)+ elif value.startswith(('/out:', '/implib:', '/pdb:')):+ prefix, path = value.split(':', 1); value = prefix + ':' + str(OUT / (name + Path(path).suffix))+ command.append(value)+run(command, 'link-main', CACHE)+for path, digest in inputs.items(): assert sha(path) == digest, 'input changed: ' + path+qt = Path('C:/veyra-deps/qt-veyra/6.8.3/msvc2022_64/bin/Qt6Quick.dll')+assert b'QSG_SOFTWARE_RENDERER_FORCE_PARTIAL_UPDATES' not in qt.read_bytes(), 'recheck Qt variable support'+receipt = {'head': subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=ROOT, text=True).strip(),+ 'source': str(source), 'sourceSha256': sha(source), 'exe': str(OUT / (name + '.exe')), 'exeSha256': sha(OUT / (name + '.exe')),+ 'privateIncludesFromCMake': privateIncludes, 'commands': commands, 'inputsUnchanged': inputs,+ 'qmlTelemetrySha256': sha(ROOT / 'qml/Veyra/VTelemetryValue.qml'), 'qtQuickSha256': sha(qt),+ 'seconds': time.monotonic() - began, 'probeOnly': name != 'veyra_qml_ui'}+(LOG / 'receipt.json').write_text(json.dumps(receipt, ensure_ascii=False, indent=2), encoding='utf8')+(BASE / 'reports' / TASK / ('probe-build.json' if receipt['probeOnly'] else 'build.json')).write_text(json.dumps({'receipt': str(LOG / 'receipt.json')}, indent=2), encoding='utf8')+print(json.dumps({k: receipt[k] for k in ('exe', 'exeSha256', 'seconds', 'probeOnly')}, ensure_ascii=False))diff --git a/scripts/acceptance/ui-software-damage-test.py b/scripts/acceptance/ui-software-damage-test.pynew file mode 100644index 00000000..b98fc71b--- /dev/null+++ b/scripts/acceptance/ui-software-damage-test.py@@ -0,0 +1,219 @@+"""Serial private GUI tests. Never opens or edits the user's installed app/profile."""+from pathlib import Path+import ctypes, hashlib, json, os, re, shutil, statistics, subprocess, sys, time+from ctypes import wintypes+import psutil+import numpy as np+from PIL import Image++ROOT = Path(__file__).resolve().parents[2]+BASE = Path('E:/项目/Veyra'); TASK = 'ui-smear-handoff-20261011'+TEST = BASE / 'tests' / TASK; APP = TEST / 'app'+BUILD = BASE / 'build' / TASK+DONOR = BASE / 'test-packages/fixes-20261010/Veyra-2.0.6-fixes-20261010-NVIDIA-win64-portable'+LOG = BASE / 'logs' / TASK+MEDIA = Path('E:/Ai/知识/小七姐/GTAVI_An_Extended_Look_4K_Native.mp4')++def sha(p):+ with Path(p).open('rb') as f: return hashlib.file_digest(f, 'sha256').hexdigest()++def replace(source, target):+ swap = target.with_name(target.name + '.swap'); shutil.copy2(source, swap); os.replace(swap, target)++def write(target, data):+ swap = target.with_name(target.name + '.swap'); swap.write_bytes(data); os.replace(swap, target)++def verify_donor():+ rows = json.loads((DONOR / 'package-manifest.json').read_text(encoding='utf8'))['files']+ for row in rows: assert sha(DONOR / row['path']) == row['sha256'], row['path']+ return len(rows)++def no_player():+ for proc in psutil.process_iter(['name', 'exe']):+ assert not (proc.info['name'] or '').lower().startswith(('veyra', 'fg-presentation', 'flash-pixel')), proc.info++def stage():+ if not APP.exists():+ shutil.copytree(DONOR, APP, copy_function=os.link)+ for n in ('veyra_qml_ui.exe', 'veyra_ui_damage_probe.exe'):+ replace(BUILD / n, APP / n)++def qml_variant(old):+ for file in ('VIcon.qml', 'ProPage.qml'):+ replace((DONOR if old else ROOT) / 'qml/Veyra' / file, APP / 'qml/Veyra' / file)++def environment(name):+ tmp = BASE / 'tmp' / TASK / name; tmp.mkdir(parents=True, exist_ok=True)+ env = {k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_', 'QT_', 'QSG_'))}+ env.update(PATH=str(APP) + os.pathsep + env['PATH'], TEMP=str(tmp), TMP=str(tmp),+ CUDA_CACHE_PATH=str(tmp / 'cuda'), QML_DISK_CACHE_PATH=str(tmp / 'qml'), QML_DISABLE_DISK_CACHE='1',+ QT_FORCE_STDERR_LOGGING='1', QT_SCALE_FACTOR='1', VEYRA_TEST_IGNORE_RTSS='1')+ return env++def profile(name, mode, reduced):+ folder = TEST / 'profiles' / name; folder.mkdir(parents=True, exist_ok=False)+ prefs = {'language':'en', 'autoResume':False, 'rememberPosition':False, 'prewarmEnhancement':False,+ 'gpuPriority':'normal', 'overlayCompat':'auto' if mode == 'rtss' else 'off',+ 'obsGameCapture':mode == 'obs', 'reducedMotion':reduced, 'subtitleEnabled':False, 'sentinel':name}+ (folder / 'qml-preferences.v1.json').write_text(json.dumps(prefs), encoding='utf8')+ return folder++def errors(text):+ return [line for line in text.splitlines() if re.search(r'REGRESSION_FAIL|ReferenceError:|TypeError:|\[ERROR\s*\]|\[FATAL\s*\]|D3D12 ERROR|D3D12 CORRUPTION|Binding loop|Error decoding|Cannot open:|Failed to get image', line)]++def pixels(detailed=False):+ rows = []+ for name, mode, partial in [('pixels-old-obs', 'obs', True), ('pixels-fixed-obs', 'obs', False), ('pixels-fixed-rtss', 'rtss', False)]:+ if detailed: name += '-raster2'+ no_player(); out = LOG / name; out.mkdir(parents=True, exist_ok=False)+ env = environment(name); env.update(VEYRA_TEST_DAMAGE_EVIDENCE=str(out), VEYRA_LOG_FILE=str(out / 'player.log'))+ if detailed: env['QT_SCALE_FACTOR'] = '1.5'+ qml_variant(partial)+ command = [str(APP / 'veyra_ui_damage_probe.exe'), '--data-dir', str(profile(name, mode, True)), '--page', 'pro', '--size', '1280x800', '--reduced-motion', '--exit-after', '15000']+ if mode == 'rtss': command.append('--overlay-compat-restart')+ with (out / 'console.log').open('wb') as stream:+ run = subprocess.run(command, cwd=APP, env=env, stdout=stream, stderr=subprocess.STDOUT, timeout=25)+ text = (out / 'console.log').read_text(encoding='utf8', errors='replace')+ assert run.returncode == 0 and not errors(text), text[-6000:]+ probe = json.loads((out / 'probe.json').read_text(encoding='utf8'))+ assert probe['foundInspector'] and probe['overflow'] > 100 and probe['scrollSteps'] == 80, probe+ assert probe['scrolledSaved'] and probe['referenceSaved'], probe+ assert not probe['scrolledGrabTriggeredRender'] and not probe['referenceGrabTriggeredRender'], probe+ assert probe['firstLayerExpanded'] and probe['nrLayers'] == 3, probe+ assert abs(probe['scrolledContentY']-probe['referenceContentY']) < 0.1, 'reference changed scroll position'+ assert abs(probe['scrolledContentHeight']-probe['referenceContentHeight']) < 0.1, 'reference changed layout'+ a = np.asarray(Image.open(out / 'scrolled.png').convert('RGB')).astype(np.int16)+ b = np.asarray(Image.open(out / 'reference.png').convert('RGB')).astype(np.int16)+ initial = np.asarray(Image.open(out / 'initial.png').convert('RGB')).astype(np.int16)+ assert a.shape == b.shape+ delta = np.max(np.abs(a - b), axis=2)+ scale = a.shape[1] / 1280+ # Include inspector borders and fixed header/footer where scroll damage+ # leaks; exclude the unrelated system GPU-monitor status light.+ roi = delta[:, int((probe['inspectorX']-15)*scale):]+ top = a[int(60*scale):int(probe['inspectorY']*scale), int(probe['inspectorX']*scale):int((probe['inspectorX']+65)*scale)]+ outsideBlue = (top[:,:,2] > top[:,:,0]+25) & (top[:,:,2] > top[:,:,1]+20) & (top[:,:,2] > 80)+ headerDifference = np.max(np.abs(a-initial), axis=2)[int(60*scale):int(probe['inspectorY']*scale), int(probe['inspectorX']*scale):]+ diff = np.clip(np.abs(a - b) * 5, 0, 255).astype(np.uint8)+ Image.fromarray(diff).save(out / 'difference-x5.png')+ row = {'case':name, 'mode':mode, 'partial':partial, 'exitCode':run.returncode,+ 'pixelsDifferentOver10':int((delta > 10).sum()), 'pixelFractionOver10':float((delta > 10).mean()),+ 'inspectorAndEdgesPixelsOver10':int((roi > 10).sum()),+ 'srBluePixelsAboveViewport':int(outsideBlue.sum()),+ 'fixedHeaderPixelsChangedOver10':int((headerDifference > 10).sum()),+ 'meanAbsChannelDifference':float(np.abs(a-b).mean()), 'probe':probe, 'command':command,+ 'pathConfirmed': 'RTSS compatibility: software UI' in text if mode == 'rtss' else 'OBS game capture compatibility: software UI' in text}+ (out / 'result.json').write_text(json.dumps(row, ensure_ascii=False, indent=2), encoding='utf8')+ assert row['pathConfirmed'], text[-4000:]+ if not partial:+ assert probe['initialRasterIcons'] > 0 and probe['initialRasterIconsNotReady'] == 0, probe+ assert probe['scrolledRasterIconsNotReady'] == 0, probe+ assert row['inspectorAndEdgesPixelsOver10'] == 0 and row['fixedHeaderPixelsChangedOver10'] == 0, row+ rows.append(row); print(json.dumps(row, ensure_ascii=False), flush=True)+ (BASE / 'reports' / TASK / ('pixels-expanded.json' if detailed else 'pixels.json')).write_text(json.dumps(rows, ensure_ascii=False, indent=2), encoding='utf8')++def priority(proc):+ fn = ctypes.WinDLL('gdi32').D3DKMTGetProcessSchedulingPriorityClass+ fn.argtypes = [wintypes.HANDLE, ctypes.POINTER(ctypes.c_int)]; fn.restype = wintypes.LONG+ value = ctypes.c_int(-1); status = fn(int(proc._handle), ctypes.byref(value))+ return {'status':hex(status & 0xffffffff), 'value':value.value}++def clipping():+ # Reuse the already captured PRESENTED frames; no extra rendering or replay.+ rows = json.loads((BASE / 'reports' / TASK / 'pixels-expanded.json').read_text(encoding='utf8'))+ result = []+ for row in rows:+ out = LOG / row['case']; p = row['probe']+ first = np.asarray(Image.open(out / 'initial.png').convert('RGB')).astype(np.int16)+ full = np.asarray(Image.open(out / 'reference.png').convert('RGB')).astype(np.int16)+ scale = first.shape[1] / 1280+ header = np.max(np.abs(first-full), axis=2)[int(60*scale):int(p['inspectorY']*scale), int(p['inspectorX']*scale):]+ count = int((header > 10).sum())+ # Old software Shape paints into this fixed header even on FULL repaint.+ assert count > 0 if row['partial'] else count == 0, (row['case'], count)+ result.append({'case':row['case'], 'fixedHeaderPixelsChangedAfterFullRepaintOver10':count,+ 'initialSha256':sha(out / 'initial.png'), 'referenceSha256':sha(out / 'reference.png')})+ (BASE / 'reports' / TASK / 'clipping.json').write_text(json.dumps(result, ensure_ascii=False, indent=2), encoding='utf8')+ print(json.dumps(result, ensure_ascii=False), flush=True)++def focus(proc):+ user = ctypes.WinDLL('user32'); windows = []+ callback = ctypes.WINFUNCTYPE(wintypes.BOOL, wintypes.HWND, wintypes.LPARAM)+ def collect(hwnd, _):+ pid = wintypes.DWORD(); user.GetWindowThreadProcessId(hwnd, ctypes.byref(pid))+ if pid.value == proc.pid and user.IsWindowVisible(hwnd): windows.append(hwnd)+ return True+ user.EnumWindows(callback(collect), 0)+ user.SetForegroundWindow.argtypes = [wintypes.HWND]+ if windows: user.SetForegroundWindow(windows[0])++def performance(final=False):+ results = []; main = APP / 'qml/Veyra/Main.qml'; saved = main.read_bytes()+ perfQml = APP / 'qml/Veyra/RegressionPerf.qml'+ replace(ROOT / 'scripts/acceptance/stability-export-priority-perf.qml', perfQml)+ try:+ cases = [('perf-gpu-old', 'gpu', False, True), ('perf-gpu-fixed', 'gpu', False, False),+ ('perf-obs-old', 'obs', True, False), ('perf-obs-fixed', 'obs', False, False)]+ if final: cases = [('perf-final-gpu-old', 'gpu', False, True), ('perf-final-gpu-fixed', 'gpu', False, False),+ ('perf-final-obs-old', 'obs', True, False), ('perf-final-obs-fixed', 'obs', False, False)]+ for name, mode, partial, old in cases:+ no_player(); out = LOG / name; out.mkdir(parents=True, exist_ok=False)+ replace(DONOR / 'veyra_qml_ui.exe' if old else BUILD / 'veyra_qml_ui.exe', APP / 'veyra_qml_ui.exe')+ qml_variant(partial or old)+ saved = (DONOR / 'qml/Veyra/Main.qml').read_bytes()+ config = {'modern':True, 'seconds':40, 'media':MEDIA.as_posix(), 'display':2, 'reducedMotion':False, 'page':'pro', 'oldUi':False}+ text = saved.decode('utf8'); at = text.rfind('}')+ write(main, (text[:at] + '\n Loader { source:"RegressionPerf.qml"; onLoaded:item.config=' + json.dumps(config, ensure_ascii=True) + ' }\n' + text[at:]).encode('utf8'))+ env = environment(name); env.update(VEYRA_LOG_FILE=str(out / 'player.log'), VEYRA_VERBOSE_FRAME_LOGS='1')+ command = [str(APP / 'veyra_qml_ui.exe'), '--data-dir', str(profile(name, mode, False)), '--page', 'pro', '--size', '1280x800', '--exit-after', '95000']+ meters = []; began = time.monotonic()+ with (out / 'console.log').open('wb') as stream:+ proc = subprocess.Popen(command, cwd=APP, env=env, stdout=stream, stderr=subprocess.STDOUT)+ watched = psutil.Process(proc.pid)+ try:+ while proc.poll() is None and time.monotonic() - began < 105:+ elapsed = time.monotonic() - began+ if elapsed > 2: focus(proc)+ try:+ cpu = watched.cpu_times()+ meters.append({'elapsed':elapsed, 'cpu':cpu.user+cpu.system, 'priority':priority(proc)})+ except psutil.NoSuchProcess: break+ time.sleep(1)+ if proc.poll() is None: proc.kill()+ rc = proc.wait(timeout=8)+ finally:+ if proc.poll() is None: proc.kill(); proc.wait(timeout=8)+ text = (out / 'player.log').read_text(encoding='utf8', errors='replace')+ samples = [json.loads(line.split('REGRESSION_SAMPLE ', 1)[1]) for line in text.splitlines() if 'REGRESSION_SAMPLE ' in line]+ samples = [r for r in samples if r['ready'] and 10 <= r['position'] <= 39]+ assert rc == 0 and 'REGRESSION_PASS' in text and not errors(text) and len(samples) >= 15, text[-6000:]+ timings = {}+ names = sorted({r['label'] for s in samples for r in s['stages'] if r['measured']})+ for stage in names:+ values = [r['ms'] for s in samples for r in s['stages'] if r['measured'] and r['label'] == stage]+ timings[stage] = {'medianOneSecondMeans':statistics.median(values), 'min':min(values), 'max':max(values), 'n':len(values)}+ stableCpu = [r for r in meters if 15 <= r['elapsed'] <= 40]+ uiRate = [b['uiFrames']-a['uiFrames'] for a,b in zip(samples, samples[1:])]+ row = {'case':name, 'mode':mode, 'partial':partial, 'originalExe':old, 'exeSha256':sha(APP / 'veyra_qml_ui.exe'),+ 'command':command, 'seconds':time.monotonic()-began, 'exitCode':rc, 'timings':timings,+ 'uiFramesPerSecondMedian':statistics.median(uiRate), 'submitFpsMedian':statistics.median(s['fps'] for s in samples),+ 'activeSamples':sum(s['active'] for s in samples), 'samples':len(samples),+ 'processCpuSecondsPerSecond':(stableCpu[-1]['cpu']-stableCpu[0]['cpu'])/(stableCpu[-1]['elapsed']-stableCpu[0]['elapsed']),+ 'priorityReadings':meters, 'nrSha256':sha(APP / 'runtime/experimental/nr-original/nvngx_dlssnr.dll'),+ 'telemetrySha256':sha(APP / 'qml/Veyra/VTelemetryValue.qml')}+ assert all(r['priority'] == {'status':'0x0', 'value':2} for r in meters if r['elapsed'] > 10), 'normal GPU priority changed'+ (out / 'result.json').write_text(json.dumps(row, ensure_ascii=False, indent=2), encoding='utf8')+ (out / 'samples.json').write_text(json.dumps(samples, ensure_ascii=False, indent=2), encoding='utf8')+ results.append(row); print(json.dumps({k:v for k,v in row.items() if k != 'priorityReadings'}, ensure_ascii=False), flush=True)+ finally:+ write(main, saved); replace(BUILD / 'veyra_qml_ui.exe', APP / 'veyra_qml_ui.exe'); qml_variant(False)+ (BASE / 'reports' / TASK / ('performance-final.json' if final else 'performance.json')).write_text(json.dumps(results, ensure_ascii=False, indent=2), encoding='utf8')++if __name__ == '__main__':+ assert sys.argv[1:] in (['pixels'], ['pixels-expanded'], ['clipping'], ['performance'], ['performance-final'])+ no_player(); count = verify_donor(); stage()+ if sys.argv[1] == 'clipping': clipping()+ elif sys.argv[1].startswith('pixels'): pixels('expanded' in sys.argv[1])+ else: performance('final' in sys.argv[1])+ assert verify_donor() == count+ print('Donor files unchanged:', count, flush=True)diff --git a/tests/qml/SoftwareUiDamageProbe.h b/tests/qml/SoftwareUiDamageProbe.hnew file mode 100644index 00000000..6f2b4421--- /dev/null+++ b/tests/qml/SoftwareUiDamageProbe.h@@ -0,0 +1,132 @@+// Private test executable only: installed into a copy of app main by the build script.+// QScreen::grabWindow reads PRESENTED pixels. QQuickWindow::grabWindow would render+// afresh and could hide the very backing-store corruption being tested.+#pragma once+#include <QDebug>+#include <QDir>+#include <QElapsedTimer>+#include <QFile>+#include <QJsonDocument>+#include <QJsonObject>+#include <QPointer>+#include <QQuickItem>+#include <QQuickWindow>+#include <QScreen>+#include <QTimer>+#include <algorithm>+#include <memory>++inline QQuickItem* damageProbeFind(QQuickItem* root, const QString& name) {+ if (!root) return nullptr;+ if (root->objectName() == name) return root;+ for (auto* child : root->childItems())+ if (auto* found = damageProbeFind(child, name)) return found;+ return nullptr;+}++inline void damageProbeImages(QQuickItem* root, int& count, int& notReady) {+ if (!root) return;+ if (root->objectName() == QStringLiteral("software-icon-image") && root->isVisible()) {+ ++count;+ if (root->property("status").toInt() != 1) ++notReady; // Image.Ready+ }+ for (auto* child : root->childItems()) damageProbeImages(child, count, notReady);+}++inline void installSoftwareUiDamageProbe(QQuickWindow* window, QObject* bridge) {+ const auto evidence = qEnvironmentVariable("VEYRA_TEST_DAMAGE_EVIDENCE");+ if (evidence.isEmpty()) return;+ QDir().mkpath(evidence);+ struct State {+ QPointer<QQuickItem> flick;+ QTimer* scroll = nullptr;+ QElapsedTimer render;+ int frames = 0, steps = 0, idleStart = 0;+ qint64 renderNs = 0;+ QJsonObject result;+ };+ const auto state = std::make_shared<State>();+ QTimer::singleShot(700, window, [bridge, state] {+ while (bridge->property("nrLayers").toList().size() < 3) {+ int added = -1;+ if (!QMetaObject::invokeMethod(bridge, "addEffect", Q_RETURN_ARG(int, added), Q_ARG(QString, QStringLiteral("nr"))) || added < 0) break;+ }+ bridge->setProperty("nrEnabled", true);+ state->result["nrLayers"] = bridge->property("nrLayers").toList().size();+ });+ QTimer::singleShot(1300, window, [window, state] {+ auto* card = damageProbeFind(window->contentItem(), QStringLiteral("nr-card-1"));+ state->result["firstLayerExpanded"] = card && card->setProperty("open", true);+ });+ QObject::connect(window, &QQuickWindow::beforeRendering, window, [state] { state->render.start(); }, Qt::DirectConnection);+ QObject::connect(window, &QQuickWindow::afterRendering, window, [state] {+ ++state->frames; state->renderNs += state->render.nsecsElapsed();+ }, Qt::DirectConnection);+ const auto capture = [window, state, evidence](const QString& name) {+ const int before = state->frames;+ const auto pixels = window->screen()->grabWindow(window->winId());+ const bool saved = !pixels.isNull() && pixels.save(evidence + "/" + name + ".png");+ state->result[name + "Saved"] = saved;+ state->result[name + "GrabTriggeredRender"] = state->frames != before;+ if (state->flick) {+ state->result[name + "ContentY"] = state->flick->property("contentY").toDouble();+ state->result[name + "ContentHeight"] = state->flick->property("contentHeight").toDouble();+ }+ state->result["pixelWidth"] = pixels.width();+ state->result["pixelHeight"] = pixels.height();+ int images = 0, notReady = 0;+ damageProbeImages(window->contentItem(), images, notReady);+ state->result[name + "RasterIcons"] = images;+ state->result[name + "RasterIconsNotReady"] = notReady;+ };+ const auto finish = [state, evidence] {+ state->result["framesInThreeIdleSeconds"] = state->frames - state->idleStart;+ state->result["totalFrames"] = state->frames;+ state->result["renderMs"] = double(state->renderNs) / 1000000.0;+ state->result["scrollSteps"] = state->steps;+ const auto json = QJsonDocument(state->result).toJson(QJsonDocument::Compact);+ QFile file(evidence + "/probe.json"); if (file.open(QIODevice::WriteOnly)) file.write(json);+ qInfo().noquote() << "SOFTWARE_DAMAGE_PROBE" << json;+ QCoreApplication::quit();+ };+ QTimer::singleShot(2000, window, [window, state, capture, finish] {+ auto* bar = damageProbeFind(window->contentItem(), QStringLiteral("pro-inspector-scrollbar"));+ auto* flick = bar ? bar->parentItem() : nullptr;+ while (flick && !flick->property("contentY").isValid()) flick = flick->parentItem();+ state->flick = flick;+ state->result["foundInspector"] = flick && flick->isVisible();+ if (!flick) return;+ state->result["overflow"] = flick->property("contentHeight").toDouble() - flick->height();+ const auto top = flick->mapToScene(QPointF());+ state->result["inspectorX"] = top.x(); state->result["inspectorY"] = top.y();+ state->result["inspectorWidth"] = flick->width(); state->result["inspectorHeight"] = flick->height();+ flick->setProperty("interactive", false);+ flick->setProperty("contentY", 0.0);+ state->scroll = new QTimer(window); state->scroll->setInterval(16);+ QObject::connect(state->scroll, &QTimer::timeout, window, [window, state, capture, finish] {+ if (!state->flick) { state->scroll->stop(); return; }+ ++state->steps;+ const double maximum = std::max(0.0, state->flick->property("contentHeight").toDouble() - state->flick->height());+ state->flick->setProperty("contentY", std::min(maximum, state->steps * 1.25));+ if (state->steps >= 80) {+ state->scroll->stop();+ QTimer::singleShot(700, window, [window, state, capture, finish] {+ capture("scrolled"); state->result["framesBeforeReference"] = state->frames;+ const double scrollY = state->flick->property("contentY").toDouble();+ window->resize(window->width() + 1, window->height());+ QTimer::singleShot(200, window, [window, state, capture, finish, scrollY] {+ window->resize(window->width() - 1, window->height());+ QTimer::singleShot(400, window, [window, state, capture, finish, scrollY] {+ state->flick->setProperty("contentY", scrollY);+ QTimer::singleShot(700, window, [window, state, capture, finish] {+ capture("reference"); state->idleStart = state->frames;+ QTimer::singleShot(3000, window, finish);+ });+ });+ });+ });+ }+ });+ QTimer::singleShot(250, window, [state, capture] { capture("initial"); state->scroll->start(); });+ });+}