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: finish capture review with bounded display queries and verified frame saves
Veyra Goal Agent26aa9dd786dc
diff --git a/AGENTS.md b/AGENTS.mdindex 630cd8f8..61381b18 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -1,5 +1,7 @@# Veyra 项目 Agent 执行规则+> **2026-10-26 Codex接手Claude采集审查**:用户要求接续Claude整体排查剩余工作。b2eb77d干净树新开codex/capture-review-handoff-20261026,按docs/CAPTURE_REVIEW_HANDOFF_PLAN_2026-10-26.md完成同帧AA对照、确认缺陷修复与验收报告;继承用户只做一轮采集(原轮已完成,不重复实卡)、单Agent、全E盘、-j2<=900秒/单测<=300秒、真实配置/端点音量/运行库/模型/驱动不改、不停止用户进程。原Claude分支、main与软件UI默认独立分支保留,不merge main/push/Release/封包,Lecram仍暂停。+> **2026-10-26 采集链路审查与抗锯齿修复(Claude,用户授权)**:用户要求整体审查采集链路及效果器衔接,排除类似VRR轮询的性能拖累,尽量降延迟,修复“抗锯齿开了没变化”,并用采集卡实测一轮(效果器全开)。从main 68def10在claude/capture-review-20261026按docs/CAPTURE_REVIEW_PLAN_2026-10-26.md施工,起点标签checkpoint/pre-capture-review-20261026。允许必要的执行计划/图/展示/采集音频日志/QML四语/定向测试接点。用户的E:/App包与配置只读,其采集进程不停止、不抢设备;实测前由用户自己让出采集卡。单Agent、全E盘、-j2构建<=900秒/单测<=300秒,不改运行库/模型/驱动,无merge/push/Release,Lecram暂停;用户随后追加:HDR显示状态也按VRR改为事件触发,专业模式左下“信号”区放一个公用的“刷新显示器状态”按钮并显示系统HDR开关与可变刷新状态,VRR原刷新按钮挪到这里;顺带排查采集卡声音偏大。为此把claude/vrr-event-query-20261025并入本分支(不进main);claude/software-ui-default-20261026仍保留未并入。> **2026-10-25 VRR事件触发查询(Claude)**:用户要求可变刷新/刷新率不再定时查询,改为事件触发并在“可变刷新”旁加“重新检测”按钮,引擎和界面都去掉2秒轮询。从main 68def10在claude/vrr-event-query-20261025按docs/VRR_EVENT_QUERY_PLAN_2026-10-25.md施工,起点标签checkpoint/pre-vrr-event-query-20261025;允许必要的呈现器/引擎/桥接/QML/翻译/CMake/定向测试接点,覆盖这些范围旧冻结。补帧调度、显示同步策略、33ms/250ms刷新不变,不加定时器。单Agent、全E盘、复用build/claude-screen-recording-20261022构建-j2<=900秒/单测<=300秒;不改运行库/模型/驱动/真实配置,无merge/push/Release,Lecram暂停。本机屏幕不支持VRR,真实VRR生效须用户设备验证。diff --git a/docs/CAPTURE_REVIEW_HANDOFF_PLAN_2026-10-26.md b/docs/CAPTURE_REVIEW_HANDOFF_PLAN_2026-10-26.mdnew file mode 100644index 00000000..a8a26d32--- /dev/null+++ b/docs/CAPTURE_REVIEW_HANDOFF_PLAN_2026-10-26.md@@ -0,0 +1,9 @@+# 采集链路整体排查接手++用户要求读取Claude已完成工作并完成后续。原会话8ec1c944-fff6-4d57-af33-3ea3ca27c6ab最后交接与源码b2eb77d已核对;从干净claude/capture-review-20261026新开codex/capture-review-handoff-20261026,checkpoint/pre-capture-review-handoff-20261026,原分支保留。产物统一E:/项目/Veyra/{用途}/codex-capture-review-handoff-20261026。++- 保留Claude的AA列表顺序、VRR/HDR事件查询及信号卡片刷新UI,复核实际启用的效果与计数,不能把源PTS/GPU提交/捕获估计当屏幕端到端延迟。+- 已完成135.6秒采集,其中60秒稳态;遵守用户“不要测很多轮,一轮就够”,不重跑实卡,不停止/争抢用户进程。离线用已有截图固定同一帧,完成real-frame真实NR/AA顺序对照,补HDR/合成边缘定向GPU契约。原节点截图不算AA前置证据,但可作为无效果输入;实际HDR截图转SDR后须明确不等价原HDR处理。+- 复核遗留问题:HDR截图路径提示与实际JXR不符、全屏恢复尺寸抖动、区域/格式日志。只修确认的最小接点;尤其不能通过改变Windows音量/AGC掩盖采集增益。声音+30dB依据原端点探针与软件映射核对。+- 审查事件查询是否仍在渲染路径等待;已有缓存不应因过期而等待慢驱动,冷启动遵守既有100ms上限。失败/超时/换屏使用已有保守颜色合同。+- 新改动做相应构建/测试,单Agent,-j2/<=900秒,单测试<=300秒。保留失败和原证据,写报告/WORKLOG/FINAL.json。主线68def10、软件UI默认独立分支保持;继承本任务不合main、不push、不Release、不封包,Lecram暂停。diff --git a/docs/CAPTURE_REVIEW_REPORT_2026-10-26.md b/docs/CAPTURE_REVIEW_REPORT_2026-10-26.mdnew file mode 100644index 00000000..40035144--- /dev/null+++ b/docs/CAPTURE_REVIEW_REPORT_2026-10-26.md@@ -0,0 +1,61 @@+# 采集链路审查、抗锯齿与显示状态:Claude工作接手完成++当前分支 `codex/capture-review-handoff-20261026` 从Claude干净提交 `b2eb77d` 接续;原 `claude/capture-review-20261026` 保留。主线仍是 `68def10`,没有合main、push、Release或封包。软件UI默认分支 `claude/software-ui-default-20261026` 的 `ea148bf` 已完成但保持独立;Lecram仍暂停。准确源码、构建、文件身份与检查结果在 `E:/项目/Veyra/reports/codex-capture-review-handoff-20261026/FINAL.json`;原任务目录的FINAL.json指向这份接手结果。++## 接手内容和完成情况++| 内容 | 状态与证据 |+| --- | --- |+| AA列表顺序 | Claude的d807407已把有NR时的AA移至NR组后;无NR仍在源尺寸/SR前。列表普通/NR先行、节点、分块图片合同保留。此次补完同帧真实NR/AA、SDR合成边缘与HDR GPU验证。 |+| VRR事件查询 | Claude的5a80948/309bd58经39e4de4合入当前任务分支;不是合入main。按显示器缓存、后台单在途、事件作废、有限重试,无固定2秒驱动轮询。 |+| HDR与信号卡片 | b2eb77d把HDR/峰值并入同一服务;专业页左下信号区共用刷新按钮与HDR/VRR/Hz信息。此次补修缓存过期等待与HDR独立失败恢复。 |+| 截图格式提示 | 新增完成结果savedFramePath,经既有快照/Facade发布;UI在编码成功后才公布真实文件及通知,HDR的.jxr不再误报.png。UI不额外轮询磁盘、不解码截图来猜测保存完成,原33ms/250ms节奏保持。 |+| 最大化/全屏恢复 | 复现了Windows短暂报告Windowed导致极简尺寸动画重启。screenSized覆盖Fullscreen/Maximized及恢复中的短暂状态,Qt.callLater在本次切换结束后清理;没有新增轮询定时器。实际Qt/Windows窗口恢复与截图测试通过。 |+| 声音偏大 | 只读端点探针再次确认G50为+30.00dB、scalar=1、范围-96..+30dB、hwSupport=0x2。没有修改端点、用户音量或添加AGC。 |+| 报告与验收 | 原先未完成的离线AA对照、完整工作记录与FINAL索引已补齐;失败和无效比较保留,不伪装通过。 |++## 抗锯齿的实际结论++原实卡截图不能用于严格开关对比:相同配置连拍仍有约37%像素变化;所谓“无NR”只关掉所选层,另一层仍运行;所谓“AA在NR前”的节点步骤切入的是空链。原报告aa-shots.json已标出这些问题,此次不重跑采集。++改用那张空链HDR截图作为固定、未做NR/AA的捕获画面。先将原scRGB浮点数据按80nit单位/203nit参考白/Reinhard映射成SDR sRGB8,再将**同一个**2560x1440输入分别送入产品真实GPU图:原画、仅SMAA高、仅NR两次、AA→NR、NR→AA。NR使用原测试夹具的单层Realtime/关闭时域/零运动诊断配置,不冒充用户的原生HDR、多层NR和实时运动条件。++- 两次独立NR输出逐像素一致,排除了这次离线对照的NR重复噪声。+- NR→AA输出中,任意RGB量化变化22485像素;超过一个8bit量化等级的变化19402像素(约全帧0.53%)。边缘平均变化0.001299,非边缘0.0000215,约60倍,证明后置AA确实执行且主要作用在边缘。+- AA→NR改变了更多区域;这不是质量优劣分数。NR会重新生成内容,前置AA的影响可能被改写,但不能把“完全抵消”当成所有素材都已证明的根因。+- 640x360合成SMAA高测试有2215个变化像素,208229个平坦像素逐字节不变;已知超采样轮廓参考的误差32.191→6.762。仅对这张合成图成立,不能宣传成真实游戏画质提高79%。+- 独立HDR SMAA测试通过:有限浮点、平坦高光、1000nit亮度及超709负分量保留。++所以“AA开关完全没效果”不成立;但这种边缘处理本就可能很细微,不能承诺像DLAA/TAA一样全面重建画面。没有做偏好盲测、时域运动画质或所有模型/素材的质量排名。++证据:`aa-gpu.json`、`fixed-frame-analysis.json`、`fixed-frame-comparison.png`;源帧/SDR输入SHA在prepared.json。图像为固定ROI对照,不是不同时间的直播截图拼接。++## 显示查询与性能审查++发现HDR接入后,图重建遇到过期缓存会等共享查询最多一秒,其中包含可能很慢的VRR驱动调用。已改为同屏旧缓存立即使用并异步更新;只有首次完全没有缓存时最多等待100ms,之后沿用原有目标屏保守HDR合同。没有改FG期限、预算或60→30采样策略。++另修HDR单独失败却被当作有效缓存永久保留的问题:即使VRR成功,HDR输出描述失败也触发同一代最多两次自动重试,耗尽后等待新事件/手动刷新。真实HDR关闭(false)与查询未知(nullopt)保持区分。新增CPU用例覆盖未知、不捏造SDR、延后重试、上限及手动恢复。++原135.6秒实卡轮次(本轮没有再次占用采集卡)的60秒稳态中:NR + SMAA + 调色 + VFG2X、HDR、2560x1440p60输入、60→30处理后提交约60fps;显示查询0、HDR轮询0、engine-stall计数0,无ERROR,slotWait=0。报告的GPU相关P95包括NR5.23ms、光流1.67ms、FG3.11ms;回调到Present返回P9530.28ms,其中调度等待17.58ms、GPU ready10.58ms。++**覆盖纠偏:这不是全部效果同时开启的实卡验收。** 原脚本只强制开启AA和调色,继承了NR和VFG;SR GPU计时为0,且未强制开启美颜。不能把此轮扩展为SR/美颜同时开启、所有效果/所有后端均已实卡通过。用户要求只做一轮采集,故复用现有轮次并如实保留覆盖缺口。++约37ms是原日志中的驱动时间戳年龄,17.58ms是本轮时序的等待,均不能直接宣称硬件物理下限;插帧确需后帧,但具体等待取决于源帧率和策略。各窗口P95也不能直接相加当HDMI到屏幕延迟。320Hz是显示模式读数,60fps是软件提交,不是屏幕扫描/光学测量。++“每帧SetWindowRgn”也不符合原稳态证据:整轮112条,60秒稳态0条;源码已有区域缓存,主要在界面动画/切换时变化。本轮没有为此移除必要的区域更新或掩盖日志。格式两次发现分别服务UI枚举和打开时协商/验证,不是稳态逐帧查询;没有为省启动日志删除设备契约核验。++## 音频:已确认什么,尚未确认什么++旧探针与此次只读探针均为+30dB(理论振幅倍率约31.6),明显高于0dB。0x2表示硬件静音,未声明硬件音量;[微软QueryHardwareSupport文档](https://learn.microsoft.com/en-us/windows/win32/api/endpointvolume/nf-endpointvolume-iaudioendpointvolume-queryhardwaresupport)及[EndpointVolume说明](https://learn.microsoft.com/en-us/windows/win32/api/endpointvolume/nn-endpointvolume-iaudioendpointvolume)说明,缺少硬件音量时Windows会在共享模式提供软件音量处理。这不等于Veyra自己又加了30dB;没有在Veyra源码找到对应的端点放大操作。音频输入超1.0也不直接等于已剪裁。++建议用户在Windows声音→录制→HDMI(KUHAIMI G50)→属性→级别,切换dB显示后先设0dB,再听/看日志;本次没有代改系统设置,也没有用自动限幅/静音掩盖问题。缺少修改端点后的A/B与原始无增益参考,因此不声称已经证明声音偏大的唯一原因。++## 验证、失败与交付边界++构建复用`build/claude-screen-recording-20261022`,2.1.0-cr2,-j2;完整定向配置构建45.2秒,保存结果接点最终构建41.4秒。六个目标均通过:EffectChain、AsyncDisplayQuery(含HDR新增三项)、UI合同、i18n、Repair272、QtQuick115。extract.py --check为2674条,四语缺失/占位问题0。Snapshot最终改动重建并重跑UI/Repair;其余无关已过项目不反复重测。++Qt/Windows窗口程序化测试(非物理键鼠、非实卡)验证:极简最大化→全屏→恢复原尺寸,恢复期间不启用cinema尺寸动画,无setGeometry错误;SDR截图PNG、真正PQ输入/HDR输出的截图JXR,实际文件、lastScreenshot和通知一致。最终ui-sdr-r4/ui-hdr-r4各约8秒。没有修改Windows HDR开关或用户真实配置。++失败保留:第一次误写HDR用例名hdr-smaa-high退出2,改为实际存在的hdr-smaa后通过,只补跑该用例;绘图时本机matplotlib缺packaging、内置Python缺matplotlib,通过工具返回的内置site-packages补依赖路径后生成,不安装全局包。最初全屏修复只覆盖稳定visibility仍复现Windowed中间态,补恢复状态保护后通过。首个10bit HEVC夹具未写入PQ VUI,实际是SDR,不能算HDR通过;保留该文件,改显式x265 VUI并用ffprobe校验后才验收真正HDR路径。最初截图完成使用文件轮询,最终改为引擎完成快照,避免UI磁盘轮询/解码和状态文案竞态。++运行组件177项SHA核对不变;旧Claude提交/VRR/软件UI分支/main及旧源码工作树不覆盖。单测试<=300秒,所有新产物在E盘本任务用途目录,没有推送、合main、封包或修改驱动/模型。原实卡结果属于Claude的b2eb77d,接手后新修复由定向离线/窗口测试覆盖,不冒充最终代码又做了一轮实卡或整机长期验收。diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.mdindex 1c2dc76c..19a0d6e1 100644--- a/docs/CURRENT_STATUS.md+++ b/docs/CURRENT_STATUS.md@@ -1,5 +1,9 @@# 当前项目状态 / Current Status+## 2026-10-26 采集审查接手完成(隔离分支)++当前施工在`codex/capture-review-handoff-20261026`,继承Claude的AA后置、事件式VRR/HDR与信号卡片刷新,补完同帧AA对照、截图实际完成路径、HDR缓存/失败重试及全屏最大化恢复修复。完整证据与覆盖纠偏见[采集审查报告](CAPTURE_REVIEW_REPORT_2026-10-26.md)。主线仍68def10,软件UI默认ea148bf独立保留,未合main/push/封包。原实卡轮次只覆盖NR/AA/调色/VFG,不能称全部效果;本次不重复实卡。Lecram暂停。+## 2026-10-25 近期功能与修复本地整合用户已授权合入本地main:录制/AMD超分关闭、90°旋转、NR每层手动百分比、FG后台VRR查询、NR视频导出尺寸、#67 NVAPI生命周期,以及本轮采集无时戳预备样本/全屏与播放列表键归属修复。Windows构建、9个定向测试目标、115项QML、真实NR切换/关闭/重开、4K37%+NVOF导出与原生全屏操作通过。CV710原卡/原3090关闭问题仍需现场复测,不冒充已确认根因。详见[整合报告](CAPTURE_AUDIO_MAIN_REPORT_2026-10-25.md);准确main与包身份在E盘reports/capture-audio-main-20261025。正式发布仍为2.1.0;无push/Release,Lecram暂停。以下“未合main”为各历史时点记录,不覆盖本次整合。diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex 30234d6a..73607d5a 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -10011,3 +10011,22 @@ computer-use技能原生按键/点击:软件专业F11/Esc、顶部还原、极构建:复用 `build/claude-screen-recording-20261022`,标签 2.1.0-vrr1,8 个目标 190 秒通过(日志 `logs/claude-vrr-event-query-20261025/build-20261026-001118`,EXE SHA256 cc35f381…e062)。测试:异步查询 33 项、实时预览、呈现线程、UI 合同、Repair 272 项、翻译均 0 失败;QtQuick 115 passed / 0 failed。第一次 QtQuick 运行缺离屏参数,日志为空,不算通过,补参数后重跑。`extract.py --check` 2667 条,0 缺译、0 占位符问题。实机:`scripts/acceptance/vrr-event-query.py --case native|novrr`,私有配置,真实 1080p30 + VFG 2X。15 秒播放和空闲期间 0 次查询;每个事件 1 次查询,真实屏幕整轮 6 次、模拟不支持 VRR 4 次。对照 fg1 的日志是 28.5 秒 15 次、间隔 2.0 秒。第一轮脚本先执行动作后打标记、并用 250 ms 采样抓“检测中”状态,两处判定有误,修正脚本后两轮通过,产品代码未改。本机屏幕现报告 VRR 等级 3,窗口模式下驱动未报告生效,真实 VRR 生效与全屏切换待用户设备验证。证据 `reports/claude-vrr-event-query-20261025`,截图 `tests/claude-vrr-event-query-20261025/shots`。无用户包、无 merge/push/Release,Lecram 暂停。+++## 2026-10-26 Codex接续Claude采集链路排查++用户要求接续Claude因额度中断的整体软件/采集链路排查。读取本机Claude会话8ec1c944-fff6-4d57-af33-3ea3ca27c6ab最后交接,核对实际b2eb77d(非摘要中旧未提交状态)。干净claude/capture-review-20261026新开codex/capture-review-handoff-20261026,存checkpoint/pre-capture-review-handoff-20261026;全refs/工作树HEAD、原capture-round/aa-shots/tests JSON存archives/codex-capture-review-handoff-20261026。继承不合main/push/Release/封包、单Agent、不重复实卡一轮、不动用户配置/端点音量/运行库/模型/驱动,Lecram暂停。软件UI默认ea148bf仍独立。++补完固定同帧离线AA验证:用原空节点链的HDR截图作无NR/AA输入,scRGB按203nit/Reinhard转SDR8bit,再跑实际产品GPU图。NR两次完全一致;SMAA后置任意变化22485像素、超过1个8bit等级19402(约0.53%),边缘平均变化约非边缘60倍。前置AA影响更多区域不能当质量优劣或“完全抵消”证明。sdr-smaa-high:2215像素变化、208229平坦像素不变,合成参考误差32.191->6.762;hdr-smaa验证有限值/平坦高光/1000nit与负色域保留。不是原HDR实卡画质或运动盲测。详细图/数据在reports本任务fixed-frame-*;命令capture-review-handoff.py prepare/aa/analyze。++追加确认修复:HDR图重建缓存过期原等1秒,改旧缓存立即使用、只首次无缓存最多100ms;HDR独立查询失败不能永久当有效缓存,最多2次延后重试后等事件,新增3个CPU回归。最大化->全屏->恢复在Windows中间Windowed态触发极简几何动画,direct visibility+fullRestorePending/Qt.callLater保护;最终无尺寸警告。截图以引擎savedFramePath完成结果/Facade比较发布实际编码路径,HDR通知JXR、SDR通知PNG;不用UI线程文件轮询/解码,也不在请求时宣布成功。++构建build-recording-handoff.py --task codex-capture-review-handoff-20261026 --root 当前E树 --build-dir E:/项目/Veyra/build/claude-screen-recording-20261022 --reconfigure --label 2.1.0-cr2:-j2 45.2秒通过;最终截图快照接点重建41.4秒。六目标通过:EffectChain、AsyncDisplay(含新增HDR失败)、UI contract、i18n、Repair272、QtQuick115(Windows/software32.7秒);最终Snapshot后仅重跑受影响UI/Repair。提取2674条、缺译/占位0。实际Qt/Windows窗口程序化测试(非物理键鼠/非采集)ui-sdr-r4和ui-hdr-r4各约8秒,最大化尺寸恢复、暂停画面、保存文件/lastScreenshot/通知一致;HDR实际HDR10/PQ,写.jxr。所有测试进程<300秒。++纠正原交接:“全效果”实卡其实只有NR/AA/调色/VFG,SR计时0且美颜未强制开启,故不能扩大成全部效果同时通过;原60秒稳态查询0、stall0的证据保留,本轮不再采集。37ms驱动年龄/17.58ms调度等待不是已证硬件物理下限,P95不能相加冒充屏幕延迟。区域日志整轮112条但稳态0,并非正常播放每帧刷盘;双格式发现服务枚举与打开核验,不删保护。++只读复查G50端点仍+30.00dB/hw0x2,微软文档说明共享模式缺硬件音量时由Windows音频引擎软件实现,不是Veyra又放大30dB。未改端点,建议用户自行0dB后复核,未做音量A/B,不能说唯一原因已证实。音频probe原源只Get/Query,无Set,输出reports本任务audio-endpoints-now.txt。++失败均保留:误用hdr-smaa-high用例名退出2,按--list改实际hdr-smaa,仅补该例;matplotlib缺packaging、内置Python缺matplotlib,通过已提供runtime site-packages补依赖,无全局安装;第一版全屏稳定visibility保护仍在中间Windowed失败,再加恢复状态保护后通过;首HDR视频无PQ VUI不能算HDR通过,改x265显式VUI并ffprobe确认后实测;截图完成初稿文件轮询改为引擎完成快照,最终UI两例重验。图/旧失败均是E盘必要证据,未覆盖Claude原JSON/实际原日志。++收尾报告docs/CAPTURE_REVIEW_REPORT_2026-10-26.md;脚本finalize-capture-review-handoff.py验证受保护旧refs/其它树HEAD、177运行组件/源码QML恢复、最终EXE与构建一致、三GPU/六合同/两窗口例、无运行库入Git,生成本任务FINAL与原Claude任务FINAL指针。准确新提交见FINAL,不合main/push/发布/打包。diff --git a/include/veyra/engine/EngineController.h b/include/veyra/engine/EngineController.hindex fdee0ee3..d9fab437 100644--- a/include/veyra/engine/EngineController.h+++ b/include/veyra/engine/EngineController.h@@ -70,6 +70,9 @@ struct PlayerSnapshot {// Known injected components loaded when the growth was seen (gfx::riskyInjections).std::wstring vramInjected;std::wstring status=L"请打开视频或图片";+ // Set only after the encoder has finished. The actual extension can differ+ // from the request (HDR screenshots are JXR); no UI-thread file polling.+ std::wstring savedFramePath;EnhancementSettings desired,applied;bool applying=false;bool nrActive=false,srActive=false,fgActive=false;bool nrAutoActive=false;diff --git a/qml/Veyra/Main.qml b/qml/Veyra/Main.qmlindex 34df5758..51b76225 100644--- a/qml/Veyra/Main.qml+++ b/qml/Veyra/Main.qml@@ -57,7 +57,10 @@ Window {// Maximized behaves like fullscreen for geometry: the screen owns the size,// so the cinema aspect rule must not fight the window manager.readonly property bool maximized: visibility === Window.Maximized- readonly property bool screenSized: fullTarget || maximized+ // Use visibility directly: leaving fullscreen clears fullTarget before the+ // Maximized binding settles. The cinema animation must not resize a screen+ // sized window during that transition.+ readonly property bool screenSized: fullTarget || fullRestorePending || visibility === Window.FullScreen || visibility === Window.Maximizedfunction toggleMaximized() {// The dock's restore button must also leave fullscreen, using the same// saved window state and cleanup as F11 / the transport button.@@ -128,7 +131,7 @@ Window {// mode exists to avoid.onHeightChanged: videoHost.syncRect()onMaximizedChanged: {- if (!maximized && cinema && !fullTarget) height = Math.round(pictureHeight)+ if (visibility === Window.Windowed && cinema && !fullTarget && !fullRestorePending) height = Math.round(pictureHeight)videoHost.syncRect()}onPageChanged: {@@ -394,6 +397,9 @@ Window {// cinema rule would otherwise snap that fullscreen size back to the film.property bool fullTarget: falseproperty int fullRestoreVisibility: Window.Windowed+ // Windows may briefly report Windowed while restoring a maximized window.+ // Keep cinema sizing out of that native transition, without a polling timer.+ property bool fullRestorePending: falseproperty bool fullLocked: false// Fullscreen quick-adjust panel (Home): the professional mode's own controls// over the picture - the list inspector (with the performance orbs) in list@@ -472,7 +478,7 @@ Window {if (!fullscreen) {fullLocked = falsecloseQuickPanel()- if (cinema && !maximized) height = Math.round(pictureHeight)+ if (cinema && visibility === Window.Windowed && !fullRestorePending) height = Math.round(pictureHeight)}fullControls = truefullHide.restart()@@ -490,8 +496,10 @@ Window {fullTarget = truevisibility = Window.FullScreen} else {+ fullRestorePending = fullRestoreVisibility === Window.MaximizedfullTarget = falsevisibility = fullRestoreVisibility+ Qt.callLater(function() { root.fullRestorePending = false })}veyra.logUi("ui-fullscreen", "enabled=" + fullscreen)}diff --git a/scripts/acceptance/capture-review-handoff-ui.qml b/scripts/acceptance/capture-review-handoff-ui.qmlnew file mode 100644index 00000000..7702b6a4--- /dev/null+++ b/scripts/acceptance/capture-review-handoff-ui.qml@@ -0,0 +1,59 @@+import QtQuick+import QtQuick.Window+Item {+ id: test+ property var shell+ property int phase: 0+ property int ticks: 0+ property int total: 0+ property int maxWidth: 0+ property int maxHeight: 0+ property string screenshotNotice: ""+ function fail(reason) { console.error("REVIEW_UI_FAIL",reason); timer.stop(); Qt.quit() }+ function next(p) { phase=p; ticks=0 }+ Connections {+ target: test.shell || null+ ignoreUnknownSignals: true+ function onScreenSizedChanged() {+ if(test.phase>=2&&test.phase<=4&&!test.shell.screenSized)+ test.fail("cinema resize was enabled during maximized/fullscreen restoration")+ }+ }+ Connections {+ target: veyra+ function onNotice(text,error) {+ if(text.indexOf("截图保存到:")===0)test.screenshotNotice=text+ }+ }+ Timer {+ id: timer+ interval: 250; repeat: true; running: test.shell!==undefined&&test.shell!==null+ onTriggered: {+ ++test.ticks+ if(++test.total>120){test.fail("timeout");return}+ if(test.phase===0){+ if(!veyra.running||veyra.applying||test.ticks<6)return+ if(!veyra.paused)veyra.togglePlayPause()+ test.shell.goPage("min");test.next(1)+ } else if(test.phase===1&&test.ticks>=3){+ test.shell.visibility=Window.Maximized;test.next(2)+ } else if(test.phase===2&&test.ticks>=3){+ if(test.shell.visibility!==Window.Maximized){test.fail("not maximized");return}+ test.maxWidth=test.shell.width;test.maxHeight=test.shell.height+ test.next(3);test.shell.toggleFullscreen()+ } else if(test.phase===3&&test.ticks>=3){+ if(!test.shell.fullscreen){test.fail("not fullscreen");return}+ test.next(4);test.shell.toggleFullscreen()+ } else if(test.phase===4&&test.ticks>=6){+ if(test.shell.visibility!==Window.Maximized||test.shell.width!==test.maxWidth||test.shell.height!==test.maxHeight){test.fail("maximized geometry not restored");return}+ console.log("REVIEW_UI_RESTORE",test.shell.width,test.shell.height,veyra.paused)+ test.next(5);veyra.takeScreenshot()+ } else if(test.phase===5&&veyra.lastScreenshot.length>0&&test.screenshotNotice.length>0){+ const file=veyra.lastScreenshot.split(/[\\/]/).pop()+ if(test.screenshotNotice.indexOf(file)<0){test.fail("notice and saved file disagree");return}+ console.log("REVIEW_UI_SCREENSHOT",JSON.stringify({file:veyra.lastScreenshot,notice:test.screenshotNotice,color:veyra.colorStatus}))+ console.log("REVIEW_UI_PASS");timer.stop();Qt.quit()+ }+ }+ }+}diff --git a/scripts/acceptance/capture-review-handoff.py b/scripts/acceptance/capture-review-handoff.pynew file mode 100644index 00000000..dc6fb5dc--- /dev/null+++ b/scripts/acceptance/capture-review-handoff.py@@ -0,0 +1,126 @@+"""One fixed captured frame, offline GPU diagnostics, never opens a capture device."""+from pathlib import Path+import argparse,hashlib,json,os,shutil,subprocess,time,sys+import numpy as np+from PIL import Image+B=Path('E:/项目/Veyra');T='codex-capture-review-handoff-20261026';R=Path(__file__).resolve().parents[2]+A=B/'tests'/T/'app';O=B/'reports'/T;L=B/'logs'/T;TMP=B/'tmp'/T;D=B/'build/claude-screen-recording-20261022'+arg=argparse.ArgumentParser();arg.add_argument('stage',choices=['prepare','aa','analyze','contracts','ui']);arg.add_argument('--case');arg.add_argument('--run',default='final');arg.add_argument('--extra-python-packages');args=arg.parse_args()+if args.extra_python_packages:sys.path.append(args.extra_python_packages)+for p in [O,L,TMP]:p.mkdir(parents=True,exist_ok=True)+def sha(p):+ with p.open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()+def replace(dst,src):+ dst.parent.mkdir(parents=True,exist_ok=True)+ if dst.exists():dst.unlink()+ shutil.copyfile(src,dst)+def env_for(name):+ tmp=TMP/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_','QML_'))}+ env.update(TEMP=str(tmp),TMP=str(tmp),APPDATA=str(tmp/'AppData'),LOCALAPPDATA=str(tmp/'LocalAppData'),CUDA_CACHE_PATH=str(TMP/'cuda'),QT_FORCE_STDERR_LOGGING='1',QML_DISABLE_DISK_CACHE='1')+ env['PATH']=str(B/'deps/qt/6.8.3/msvc2022_64/bin')+';'+str(B/'deps/ffmpeg-filter-issues41-45-20261016/bin')+';'+env['PATH']+ return env+if args.stage=='prepare':+ donor=B/'releases/release-2.1.0-20261019/runtime-base/NVIDIA';m=json.loads((donor/'package-manifest.json').read_text('utf8'))+ if not A.exists():+ for e in m['files']:+ rel=e['path']+ if rel.startswith('logs/') or any(x.startswith('user-data-') for x in Path(rel).parts):continue+ p=A/rel;p.parent.mkdir(parents=True,exist_ok=True);os.link(donor/rel,p)+ for name in ['veyra_qml_ui','veyra_anti_alias_gpu_tests']:replace(A/(name+'.exe'),D/(name+'.exe'))+ for folder in ['qml','i18n']:+ for p in (R/folder).rglob('*'):+ if p.is_file():replace(A/folder/p.relative_to(R/folder),p)+ runtime=[e for e in m['files'] if Path(e['path']).suffix.lower() in ['.dll','.onnx','.tflite','.hsaco','.dxil']]+ assert all(sha(A/e['path'])==e['sha256'] for e in runtime)+ # The old "AA-before" live shot had an empty graph: it is not ordering+ # evidence, but is useful here as a fixed, unenhanced captured picture.+ source=B/'tmp/claude-capture-review-20261026/shots-raw/veyra-20261026-052849-047.f32'+ rgba=np.fromfile(source,np.float32).reshape(1440,2560,4);rgb=rgba[...,:3]+ assert np.isfinite(rgb).all()+ linear=np.maximum(rgb,0)*(80/203);linear=linear/(1+linear)+ coded=np.where(linear<=.0031308,12.92*linear,1.055*np.power(linear,1/2.4)-.055)+ ppm=B/'tests'/T/'fixed-captured-frame.ppm';Image.fromarray(np.rint(np.clip(coded,0,1)*255).astype(np.uint8)).save(ppm)+ receipt=dict(runtimeFilesVerified=len(runtime),frame=str(ppm),source=str(source),sourceSha256=sha(source),frameSha256=sha(ppm),width=2560,height=1440,conversion='scRGB 80nit units -> reference 203nit -> Reinhard -> sRGB8; SDR diagnostic, not original HDR processing')+ (O/'prepared.json').write_text(json.dumps(receipt,ensure_ascii=False,indent=1),'utf8');print(json.dumps(receipt,ensure_ascii=False))+elif args.stage=='aa':+ assert not any(x.lower().startswith('"veyra') for x in subprocess.check_output(['tasklist','/fo','csv','/nh'],text=True,errors='replace').splitlines()),'user player is running; do not compete'+ result=json.loads((O/'aa-gpu.json').read_text('utf8')) if args.case and (O/'aa-gpu.json').exists() else []+ if args.case and not (O/'aa-gpu-initial.json').exists():shutil.copyfile(O/'aa-gpu.json',O/'aa-gpu-initial.json')+ result=[x for x in result if x['case']!='hdr-smaa-high' and x['case']!=args.case]+ for case in ([args.case] if args.case else ['real-frame','sdr-smaa-high','hdr-smaa']):+ env=env_for(case);env.update(VEYRA_AA_FRAME=str(B/'tests'/T/'fixed-captured-frame.ppm'),VEYRA_AA_FRAME_OUT=str(B/'tests'/T/'aa-fixed-frame'))+ log=L/(case+'.log');start=time.monotonic()+ with log.open('wb') as f:rc=subprocess.run([str(A/'veyra_anti_alias_gpu_tests.exe'),'--case',case],cwd=A,env=env,stdout=f,stderr=subprocess.STDOUT,timeout=280).returncode+ row=dict(case=case,exit=rc,seconds=round(time.monotonic()-start,3),log=str(log));result.append(row);print(json.dumps(row),flush=True)+ (O/'aa-gpu.json').write_text(json.dumps(result,ensure_ascii=False,indent=1),'utf8')+ if rc:raise SystemExit(rc)+elif args.stage=='contracts':+ for p in (R/'tests/qml/quick').glob('tst_*.qml'):replace(D/'qml-tests'/p.name,p)+ names=args.case.split(',') if args.case else ['effect_chain','async_display_query','ui_contract','ui_i18n','repair_contract','qml_quick']+ results=[x for x in json.loads((O/'contracts.json').read_text('utf8')) if x['name'] not in names] if args.case else []+ if args.case and not (O/'contracts-pre-snapshot.json').exists():shutil.copyfile(O/'contracts.json',O/'contracts-pre-snapshot.json')+ for name in names:+ env=env_for('contracts-'+name)+ if name=='qml_quick':env.update(QT_QPA_PLATFORM='windows',QT_QUICK_BACKEND='software')+ log=L/(name+'.log');start=time.monotonic()+ with log.open('wb') as f:rc=subprocess.run([str(D/('veyra_'+name+'_tests.exe'))],cwd=D,env=env,stdout=f,stderr=subprocess.STDOUT,timeout=280).returncode+ row=dict(name=name,exit=rc,seconds=round(time.monotonic()-start,3),log=str(log));results.append(row);print(json.dumps(row),flush=True)+ (O/'contracts.json').write_text(json.dumps(results,ensure_ascii=False,indent=1),'utf8')+ assert all(x['exit']==0 for x in results)+elif args.stage=='ui':+ assert not any(x.lower().startswith('"veyra') for x in subprocess.check_output(['tasklist','/fo','csv','/nh'],text=True,errors='replace').splitlines()),'user player is running'+ # Small tagged PQ clip, generated locally. No camera/capture/device access.+ hdr=B/'tests'/T/'hdr-pq-tagged.mp4';env=env_for('media')+ if not hdr.exists():+ with (L/'media.log').open('wb') as f:+ subprocess.run([shutil.which('ffmpeg'),'-v','error','-f','lavfi','-i','testsrc2=size=640x360:rate=30','-t','10','-vf','format=yuv420p10le','-c:v','libx265','-preset','ultrafast','-x265-params','pools=2:frame-threads=2:log-level=error:colorprim=9:transfer=16:colormatrix=9','-color_primaries','bt2020','-color_trc','smpte2084','-colorspace','bt2020nc',str(hdr)],env=env,stdout=f,stderr=subprocess.STDOUT,check=True,timeout=120)+ stream=json.loads(subprocess.check_output([shutil.which('ffprobe'),'-v','error','-select_streams','v:0','-show_streams','-of','json',str(hdr)],text=True))['streams'][0]+ assert stream.get('color_transfer')=='smpte2084' and stream.get('color_primaries')=='bt2020','the fixture must really carry PQ VUI metadata'+ if (O/'ui.json').exists() and not (O/'ui-initial.json').exists():shutil.copyfile(O/'ui.json',O/'ui-initial.json')+ if (O/'ui.json').exists():shutil.copyfile(O/'ui.json',O/('ui-before-'+args.run+'.json'))+ main=A/'qml/Veyra/Main.qml';original=main.read_bytes();results=[x for x in json.loads((O/'ui.json').read_text('utf8')) if x['case']!=args.case] if args.case else []+ source=original.decode('utf8');pos=source.rfind('}')+ loader='\nLoader { source: '+json.dumps(Path(__file__).with_name('capture-review-handoff-ui.qml').as_uri())+'; onLoaded: item.shell=root }\n'+ main.write_text(source[:pos]+loader+source[pos:],'utf8')+ try:+ for case,media in [('sdr',B/'tests/nr-manual-scale-20261024/media/nr-1080p30.mp4'),('hdr',hdr)]:+ if args.case and args.case!=case:continue+ profile=B/'tests'/T/('ui-'+case+'-'+args.run);assert not profile.exists();profile.mkdir()+ shots=profile/'screenshots'+ (profile/'qml-preferences.v1.json').write_text(json.dumps(dict(language='zh-CN',autoResume=False,prewarmEnhancement=False,screenshotDir=str(shots))),'utf8')+ env=env_for('ui-'+case+'-'+args.run);env.update(QT_QUICK_BACKEND='software',VEYRA_LOG_FILE=str(L/('ui-'+case+'-'+args.run+'-engine.log')))+ log=L/('ui-'+case+'-'+args.run+'.log');start=time.monotonic()+ with log.open('wb') as f:rc=subprocess.run([str(A/'veyra_qml_ui.exe'),'--data-dir',str(profile),'--page','min','--size','1280x800','--obs-game-capture','--exit-after','38000',str(media)],cwd=A,env=env,stdout=f,stderr=subprocess.STDOUT,timeout=50).returncode+ text=log.read_text('utf8',errors='replace');m=__import__('re').search(r'REVIEW_UI_SCREENSHOT (\{.*\})',text)+ saved=json.loads(m[1]) if m else {};p=Path(saved['file']) if saved else None+ passed=rc==0 and 'REVIEW_UI_PASS' in text and 'REVIEW_UI_FAIL' not in text and 'Unable to set geometry' not in text and p and p.is_file() and p.stat().st_size>0+ if case=='sdr':passed=passed and p.suffix=='.png'+ if case=='hdr':passed=passed and saved and 'HDR' in saved.get('color','') and 'SDR' not in saved.get('color','') and p.suffix=='.jxr'+ row=dict(case=case,exit=rc,passed=bool(passed),seconds=round(time.monotonic()-start,3),log=str(log),screenshot=saved);results.append(row);print(json.dumps(row,ensure_ascii=False),flush=True)+ (O/'ui.json').write_text(json.dumps(results,ensure_ascii=False,indent=1),'utf8')+ if not passed:raise AssertionError(text[-3000:])+ finally:main.write_bytes(original)+elif args.stage=='analyze':+ folder=B/'tests'/T/'aa-fixed-frame';names=['plain','aa','nr','nr-again','aa-before-nr','aa-after-nr']+ frames={name:np.asarray(Image.open(folder/(name+'.ppm')).convert('RGB'),dtype=np.float32)/255 for name in names}+ luma=lambda v:[email protected]([.2126,.7152,.0722],np.float32)+ base=luma(frames['nr']);grad=np.hypot(np.diff(base,axis=1,prepend=base[:,:1]),np.diff(base,axis=0,prepend=base[:1]))+ edges=grad>.06;assert int(edges.sum())>1000+ metrics={}+ for name,reference in [('aa','plain'),('nr-again','nr'),('aa-before-nr','nr'),('aa-after-nr','nr')]:+ d=np.abs(frames[name]-frames[reference]);y=np.mean(d,axis=2)+ metrics[name]=dict(changedPixels=int(np.count_nonzero(np.max(d,axis=2)>1/255+.00001)),meanAbs=float(d.mean()),edgeMeanAbs=float(y[edges].mean()),flatMeanAbs=float(y[~edges].mean()))+ assert metrics['aa']['changedPixels']>500 and metrics['aa-after-nr']['changedPixels']>500+ assert metrics['aa-after-nr']['edgeMeanAbs']>metrics['nr-again']['edgeMeanAbs']*2+ (O/'fixed-frame-analysis.json').write_text(json.dumps(dict(size=[2560,1440],metrics=metrics,note='One identical SDR-tonemapped captured input. Image changes prove the effect executes; this alone is not a ground-truth quality score or live HDR comparison.'),indent=1),'utf8')+ # Scientific comparison figure: a fixed ROI and nearest-neighbour zoom.+ import matplotlib;matplotlib.use('Agg')+ import matplotlib.pyplot as plt+ x,y,w,h=1152,800,256,192+ fig,axes=plt.subplots(1,4,figsize=(16,4.2),layout='constrained')+ for ax,name in zip(axes,['plain','nr','aa-before-nr','aa-after-nr']):+ ax.imshow(frames[name][y:y+h,x:x+w],interpolation='nearest');ax.set_title(name);ax.axis('off')+ fig.suptitle('Same captured input, SDR diagnostic; fixed ROI (1152, 800, 256, 192)')+ fig.savefig(O/'fixed-frame-comparison.png',dpi=150);plt.close(fig)+ print(json.dumps(metrics))diff --git a/scripts/acceptance/finalize-capture-review-handoff.py b/scripts/acceptance/finalize-capture-review-handoff.pynew file mode 100644index 00000000..7c3571cb--- /dev/null+++ b/scripts/acceptance/finalize-capture-review-handoff.py@@ -0,0 +1,44 @@+"""Verify receipts, protected refs, restored fixture files and immutable runtimes."""+from pathlib import Path+import hashlib,json,subprocess+B=Path('E:/项目/Veyra');T='codex-capture-review-handoff-20261026';R=Path(__file__).resolve().parents[2]+O=B/'reports'/T;S=B/'archives'/T;A=B/'tests'/T/'app';D=B/'build/claude-screen-recording-20261022'+def sha(p):+ with p.open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()+def git(*args):return subprocess.check_output(['git','-C',str(R),*args],text=True,encoding='utf8').strip()+assert not git('status','--porcelain'),'commit the reviewed source first'+assert git('branch','--show-current')=='codex/capture-review-handoff-20261026'+assert git('rev-parse','main')=='68def10a9c5cdc3af626a0b784029275ebda323f'+assert git('rev-parse','claude/capture-review-20261026')=='b2eb77dfe7c25bcc595d82970f7d95ba977171f9'+before=dict(line.split(' ',1)[::-1] for line in (S/'refs-before.txt').read_text('utf8').splitlines())+after=dict(line.split(' ',1)[::-1] for line in git('show-ref').splitlines())+assert all(after.get(k)==v for k,v in before.items()),'a protected pre-existing ref changed'+other=0+for block in (S/'worktrees-before.txt').read_text('utf8').strip().split('\n\n'):+ fields=dict(line.split(' ',1) for line in block.splitlines() if ' ' in line)+ p=Path(fields['worktree'])+ if p.resolve()==R.resolve():continue+ head=subprocess.check_output(['git','-C',str(p),'rev-parse','HEAD'],text=True).strip();assert head==fields['HEAD'],str(p);other+=1+contracts=json.loads((O/'contracts.json').read_text('utf8'));gpu=json.loads((O/'aa-gpu.json').read_text('utf8'));ui=json.loads((O/'ui.json').read_text('utf8'))+assert len(contracts)==6 and all(x['exit']==0 for x in contracts)+assert {x['case'] for x in gpu}=={'real-frame','sdr-smaa-high','hdr-smaa'} and all(x['exit']==0 for x in gpu)+assert {x['case'] for x in ui}=={'sdr','hdr'} and all(x['passed'] for x in ui)+assert next(x for x in ui if x['case']=='hdr')['screenshot']['file'].endswith('.jxr')+assert sha(A/'veyra_qml_ui.exe')==sha(D/'veyra_qml_ui.exe')+for folder in ['qml','i18n']:+ for p in (R/folder).rglob('*'):+ if p.is_file():assert p.read_bytes().replace(b'\r\n',b'\n')==(A/folder/p.relative_to(R/folder)).read_bytes().replace(b'\r\n',b'\n'),str(p)+donor=B/'releases/release-2.1.0-20261019/runtime-base/NVIDIA';manifest=json.loads((donor/'package-manifest.json').read_text('utf8'))+runtime=[x for x in manifest['files'] if Path(x['path']).suffix.lower() in ['.dll','.onnx','.tflite','.hsaco','.dxil']]+for x in runtime:assert sha(A/x['path'])==sha(donor/x['path'])==x['sha256'],x['path']+original=B/'reports/claude-capture-review-20261026'+for name in ['tests.json','capture-round.json','aa-shots.json']:assert sha(original/name)==sha(S/name),name+with (O/'i18n-check.log').open('wb') as f:+ checked=subprocess.run(['python','-X','utf8','-B','-I','scripts/i18n/extract.py','--check'],cwd=R,stdout=f,stderr=subprocess.STDOUT,timeout=90)+assert checked.returncode==0+delta=git('diff','--name-only','b2eb77d','HEAD').splitlines()+assert not any(Path(x).suffix.lower() in ['.dll','.lib','.onnx','.pdb','.hsaco'] for x in delta)+result=dict(completed=True,sourceCommit=git('rev-parse','HEAD'),sourceWorktree=str(R),branch=git('branch','--show-current'),mainUnchanged=git('rev-parse','main'),claudeHeadPreserved=git('rev-parse','claude/capture-review-20261026'),preExistingRefsPreserved=len(before),otherWorktreeHeadsPreserved=other,sourceFilesChanged=delta,exeSha256=sha(A/'veyra_qml_ui.exe'),runtimeFilesUnchanged=len(runtime),contracts=contracts,gpu=gpu,ui=ui,sourceQmlRestored=True,realCaptureRepeated=False,originalCaptureReportPreserved=True,allEffectsCaptureVerified=False,unverifiedCaptureEffects=['SR','Beauty'],audioEndpointChanged=False,lecramPaused=True,merged=False,pushed=False,published=False,packageCreated=False,report=str(R/'docs/CAPTURE_REVIEW_REPORT_2026-10-26.md'))+(O/'FINAL.json').write_text(json.dumps(result,ensure_ascii=False,indent=1),'utf8')+(original/'FINAL.json').write_text(json.dumps(dict(completedBy='Codex handoff',sourceCommit=result['sourceCommit'],branch=result['branch'],details=str(O/'FINAL.json'),report=result['report'],realCaptureRepeated=False,allEffectsCaptureVerified=False,mainUnchanged=result['mainUnchanged'],merged=False,pushed=False,published=False,packageCreated=False),ensure_ascii=False,indent=1),'utf8')+print(json.dumps({k:result[k] for k in ['sourceCommit','branch','mainUnchanged','preExistingRefsPreserved','otherWorktreeHeadsPreserved','runtimeFilesUnchanged','realCaptureRepeated','allEffectsCaptureVerified','packageCreated']},ensure_ascii=False))diff --git a/src/engine/DisplayStateService.cpp b/src/engine/DisplayStateService.cppindex 9359ee4d..d09f3543 100644--- a/src/engine/DisplayStateService.cpp+++ b/src/engine/DisplayStateService.cpp@@ -109,6 +109,7 @@ void DisplayStateService::collectLocked(){job.reason,monitorName(job.monitor),job.generation,state.refreshHz,gfx::vrrLevel(state.vrr),state.vrr.status,state.color.hdr?(*state.color.hdr?"on":"off"):"unknown",state.color.peakValid?int(state.color.peakNits):-1,state.refreshMs,state.vrrMs,state.colorMs));if(state.vrr.status!=0)failedLocked(entry,job,std::format("NVAPI status={}",state.vrr.status));+ else if(!state.color.hdr.has_value())failedLocked(entry,job,"HDR output description unavailable");else if(entry.failedGeneration==job.generation)entry.failures=0;}}catch(const std::exception& error){failedLocked(entry,job,std::format("exception: {}",error.what()));}diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cppindex 7caeef29..5e598e22 100644--- a/src/engine/EngineController.cpp+++ b/src/engine/EngineController.cpp@@ -365,7 +365,7 @@ bool EngineController::requestSettings(EnhancementSettings s,std::optional<ChaindesiredNodeOrder_=order;desired_=s;snapshot_.desired=s;snapshot_.applying=snapshot_.applied!=desired_;if(acceptedRevision)*acceptedRevision=s.revision;return true;}-void EngineController::saveFrame(const std::wstring& path){std::lock_guard lock(mutex_);savePath_=path;}+void EngineController::saveFrame(const std::wstring& path){std::lock_guard lock(mutex_);savePath_=path;snapshot_.savedFramePath.clear();}bool EngineController::requestRecording(const RecordingSettings& options,std::wstring& error){return recorder_->start(options,error);}void EngineController::stopRecording(){recorder_->stop();}RecordingStatus EngineController::recordingSnapshot()const{return recorder_->status();}@@ -713,13 +713,15 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s// Windows HDR comes from the shared display state (the same background// query as refresh and VRR, asked again only on a display change, a// monitor change or 刷新显示器状态). A new graph waits for a missing or- // stale answer once, like the synchronous query it replaces.+ // answer once (100ms maximum). A stale target-local cache stays+ // usable while the worker refreshes it; a settings transaction must+ // never wait for an unrelated slow VRR/driver call to finish.auto displayHdrActive=[&]{const HMONITOR target=displayStates_.monitorOf(window);auto known=displayStates_.state(target);if(!known||known->generation!=displayStates_.generation()){displayStates_.request(window,"hdr-output");- known=displayStates_.wait(target,std::chrono::seconds(1));+ if(!known)known=displayStates_.wait(target,std::chrono::milliseconds(100));}const std::optional<bool> queried=known?known->color.hdr:std::nullopt;if(known)hdrDisplaySerial=known->serial;@@ -1563,8 +1565,12 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,sstd::wstring save;EnhancementSettings requested;std::optional<ChainRuntimeOrder> requestedOrder;{std::lock_guard lock(mutex_);requested=desired_;requestedOrder=desiredNodeOrder_;if(hasOutput)save.swap(savePath_);}if(!save.empty()){try{sink::RgbaImage result;const auto e=std::filesystem::path(save).extension().wstring();+ const auto saved=[this](const std::wstring& path,const std::wstring& message){+ {std::lock_guard lock(mutex_);snapshot_.savedFramePath=path;}+ status(message);+ };drainLivePresentation();- if(graph->hdrOutput()){auto hdrPath=std::filesystem::path(save);hdrPath.replace_extension(L".jxr");if(sink::saveHdrScreenshot(hdrPath.wstring(),ctx,ring,graph->videoFrameResource(out.videoSlot)))status(L"HDR截图已保存:"+hdrPath.wstring());else status(L"HDR截图保存失败,请查看日志",false);}else if(!sink::readRgba8(ctx,ring,graph->videoFrameResource(out.videoSlot),result)||!sink::saveImage(save,result,e==L".jpg"||e==L".jpeg"))status(L"保存失败(目标文件可能已存在),播放已保留",false);else{status(L"图片已保存:"+save);veyra::log::info("image-save",std::format("saved extent={}x{} revision={}",gd.workWidth,gd.workHeight,options.settings.revision));}}+ if(graph->hdrOutput()){auto hdrPath=std::filesystem::path(save);hdrPath.replace_extension(L".jxr");if(sink::saveHdrScreenshot(hdrPath.wstring(),ctx,ring,graph->videoFrameResource(out.videoSlot)))saved(hdrPath.wstring(),L"HDR截图已保存:"+hdrPath.wstring());else status(L"HDR截图保存失败,请查看日志",false);}else if(!sink::readRgba8(ctx,ring,graph->videoFrameResource(out.videoSlot),result)||!sink::saveImage(save,result,e==L".jpg"||e==L".jpeg"))status(L"保存失败(目标文件可能已存在),播放已保留",false);else{saved(save,L"图片已保存:"+save);veyra::log::info("image-save",std::format("saved extent={}x{} revision={}",gd.workWidth,gd.workHeight,options.settings.revision));}}catch(const std::exception& e){veyra::log::warn("image-save",std::format("save exception; retaining session: {}",e.what()));status(L"保存异常,播放已保留;可再次保存",false);}}if(isImage)requested.multiplier=1;if(requested.revision==options.settings.revision&&requested!=options.settings){diff --git a/src/ui/PlayerUiFacade.cpp b/src/ui/PlayerUiFacade.cppindex ef045503..b85dc0b7 100644--- a/src/ui/PlayerUiFacade.cpp+++ b/src/ui/PlayerUiFacade.cpp@@ -48,7 +48,7 @@ bool sameSnapshot(const veyra::engine::PlayerSnapshot& a, const veyra::engine::Preturn sameNetwork(a.network, b.network) &&a.transport == b.transport && a.sessionId == b.sessionId && a.position == b.position &&a.duration == b.duration && a.frames == b.frames && a.generated == b.generated &&- a.status == b.status && a.backendWarning == b.backendWarning && a.sourceNotice == b.sourceNotice &&+ a.status == b.status && a.savedFramePath == b.savedFramePath && a.backendWarning == b.backendWarning && a.sourceNotice == b.sourceNotice &&a.applying == b.applying && a.rejectedRevision == b.rejectedRevision &&a.desired == b.desired && a.applied == b.applied && a.nrActive == b.nrActive &&a.srActive == b.srActive && a.fgActive == b.fgActive && a.failed == b.failed &&diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cppindex 632ff8f0..9339db9e 100644--- a/src/ui/QmlPlayerBridge.cpp+++ b/src/ui/QmlPlayerBridge.cpp@@ -375,6 +375,8 @@ struct QmlPlayerBridge::Impl {// Custom: how many remembered titles survive; the oldest fall off first.int kHdrTitleProfileLimit = 60;QString lastScreenshot;+ QString pendingScreenshot;+ qint64 pendingScreenshotDeadline=0;bool holdKeyDown = false;int positionTicks = 0;// A reopened file resumes here once its session is running.@@ -4306,7 +4308,7 @@ int QmlPlayerBridge::imageBatchTotal() const { return int(impl_->imageFiles.sizeint QmlPlayerBridge::imageBatchFailures() const { return impl_->imageFailures; }QString QmlPlayerBridge::imageBatchStatus() const { return impl_->imageStatus; }void QmlPlayerBridge::saveFrameDialog() {- if(!impl_->pendingFrameExport.isEmpty()||imageBatchActive()){emit notice(tr("请等待当前图片导出完成"),true);return;}+ if(!impl_->pendingFrameExport.isEmpty()||!impl_->pendingScreenshot.isEmpty()||imageBatchActive()){emit notice(tr("请等待当前图片导出完成"),true);return;}if (!hasSource()) { emit notice(tr("没有可保存的画面"), true); return; }if (impl_->chain.mode == engine::ChainMode::Node) {emit notice(tr("图片导出只接受列表模式;请切回列表模式再导出"), true); return;@@ -4351,6 +4353,19 @@ void QmlPlayerBridge::cancelImageBatch() {}void QmlPlayerBridge::tickImageBatch() {auto& i = *impl_;+ if(!i.pendingScreenshot.isEmpty()){+ const QString written=QDir::fromNativeSeparators(QString::fromStdWString(i.snapshot.savedFramePath));+ const QString hdr=QFileInfo(i.pendingScreenshot).path()+QLatin1Char('/')+QFileInfo(i.pendingScreenshot).completeBaseName()+QStringLiteral(".jxr");+ if(written==i.pendingScreenshot||written==hdr){+ i.lastScreenshot=written;i.pendingScreenshot.clear();+ veyra::log::info("ui-screenshot","saved path="+written.toStdString());+ emit preferencesChanged();+ emit notice(tr("截图保存到:%1").arg(QDir::toNativeSeparators(written)),false);+ }+ if(!i.pendingScreenshot.isEmpty()&&QDateTime::currentMSecsSinceEpoch()>i.pendingScreenshotDeadline){+ i.pendingScreenshot.clear();emit notice(tr("图片保存未确认完成,请查看诊断"),true);+ }+ }if(!i.pendingFrameExport.isEmpty()){QString path=i.pendingFrameExport;if(!QFileInfo(path).isFile())path=QFileInfo(path).path()+QLatin1Char('/')+QFileInfo(path).completeBaseName()+QStringLiteral(".jxr");@@ -6761,16 +6776,18 @@ void QmlPlayerBridge::stepFrame(int direction) {void QmlPlayerBridge::takeScreenshot() {if (!hasSource()) { emit notice(tr("没有正在播放的画面,无法截图"), true); return; }+ if(!impl_->pendingScreenshot.isEmpty()||!impl_->pendingFrameExport.isEmpty()||imageBatchActive()){emit notice(tr("请等待当前图片导出完成"),true);return;}const QString folder = screenshotDirectory();if (!QDir().mkpath(folder)) { emit notice(tr("截图目录不可用:%1").arg(folder), true); return; }const QString name = QStringLiteral("veyra-%1.png").arg(QDateTime::currentDateTime().toString(QStringLiteral("yyyyMMdd-HHmmss-zzz")));const QString path = QDir(folder).filePath(name);impl_->engine.saveFrame(wideOf(QDir::toNativeSeparators(path)));- impl_->lastScreenshot = path;+ impl_->pendingScreenshot=path;+ impl_->pendingScreenshotDeadline=QDateTime::currentMSecsSinceEpoch()+30000;+ impl_->lastScreenshot.clear();veyra::log::info("ui-screenshot", "requested path=" + path.toStdString());emit preferencesChanged();- emit notice(tr("截图保存到:%1").arg(QDir::toNativeSeparators(path)), false);}// --- shell preferences (P4-f / P4-c / P4-d) --------------------------------diff --git a/tests/unit/AsyncDisplayQueryTests.cpp b/tests/unit/AsyncDisplayQueryTests.cppindex fa8eaf56..0efcd361 100644--- a/tests/unit/AsyncDisplayQueryTests.cpp+++ b/tests/unit/AsyncDisplayQueryTests.cpp@@ -60,7 +60,7 @@ int wmain(int argc,wchar_t** argv){using veyra::engine::DisplayState;using veyra::engine::DisplayStateService;const auto windowA=reinterpret_cast<HWND>(uintptr_t(0x10)),windowB=reinterpret_cast<HWND>(uintptr_t(0x20));const auto monitorA=reinterpret_cast<HMONITOR>(uintptr_t(0x1000)),monitorB=reinterpret_cast<HMONITOR>(uintptr_t(0x2000));- std::atomic<unsigned> calls{0};std::atomic<int> status{0};std::atomic<bool> moved{false},raise{false};+ std::atomic<unsigned> calls{0};std::atomic<int> status{0};std::atomic<bool> moved{false},raise{false},missingHdr{false};std::mutex gateMutex;std::condition_variable gateWake;bool gateOpen=true;auto setGate=[&](bool open){{std::lock_guard lock(gateMutex);gateOpen=open;}gateWake.notify_all();};auto fakeQuery=[&](HWND window,HMONITOR monitor){@@ -71,6 +71,7 @@ int wmain(int argc,wchar_t** argv){state.vrr.known=true;state.vrr.capsKnown=state.vrr.supportsVrr=state.vrr.currentlyCapable=true;state.vrr.status=status.load();// Windows HDR on monitor A only; the panel peak comes from the same answer.state.color.hdr=window==windowA;state.color.peakValid=true;state.color.peakNits=window==windowA?1000:400;+ if(missingHdr)state.color.hdr.reset();return state;};auto monitorOf=[&](HWND window){return window==windowA?monitorA:window==windowB?monitorB:HMONITOR(nullptr);};@@ -149,6 +150,20 @@ int wmain(int argc,wchar_t** argv){check(notAnswering&¬Answering->generation<service.generation()&&Clock::now()-quick<std::chrono::milliseconds(100),"waiting without a query for the monitor returns at once");}+ // HDR can fail independently of a successful VRR call. Keep it unknown+ // and use the same bounded retry policy instead of caching it forever.+ {+ missingHdr=true;DisplayStateService service(fakeQuery,monitorOf,std::chrono::milliseconds(50));+ const auto before=calls.load();+ service.request(windowA,"hdr-failure");auto unknown=service.wait(monitorA,std::chrono::milliseconds(500));+ check(unknown&&!unknown->color.hdr.has_value()&&!service.request(windowA,"test"),"missing HDR is unknown, not fabricated SDR; retry is delayed");+ unsigned retries=0;+ for(unsigned i=0;i<4;++i){std::this_thread::sleep_for(std::chrono::milliseconds(70));if(service.request(windowA,"test")){++retries;service.wait(monitorA,std::chrono::milliseconds(500));}}+ check(retries==2&&calls==before+3,"HDR failure retries twice and never becomes a permanent polling loop");+ missingHdr=false;service.invalidate("manual");service.request(windowA,"manual");+ auto recovered=service.wait(monitorA,std::chrono::milliseconds(500));+ check(recovered&&recovered->color.hdr==true&&!service.request(windowA,"test"),"manual refresh recovers HDR and caches the valid answer");+ }// Destruction waits for the running driver call, never for the queue.setGate(false);std::jthread opener([&]{std::this_thread::sleep_for(std::chrono::milliseconds(30));setGate(true);});