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++
diagnostics: capture input and presented pixels for FG black flashes
Veyra Goal Agent3fd3cde2b04f
diff --git a/docs/FG_SOURCE_FLASH_PLAN_2026-10-08.md b/docs/FG_SOURCE_FLASH_PLAN_2026-10-08.mdnew file mode 100644index 00000000..46f0f78f--- /dev/null+++ b/docs/FG_SOURCE_FLASH_PLAN_2026-10-08.md@@ -0,0 +1,26 @@+# 补帧+源时间戳闪黑排查++用户提供 `veyra-qml(41).log` 和手机录像,报告补帧开启且采用源时间戳时闪黑,关闭补帧或采集 60→30 时不闪。当前阶段是定位故障;没有可复现的根因之前,不把假说写成产品修复。++## 范围和保全++- 只读核对真实日志、录像、当前共享 graph/presenter、GPU fence 和历史重置;独立诊断程序只添加像素取样,不改变补帧算法、准入、源时间戳或显示策略。+- 产品基底为当前 main 对应的 `71723e0249a17764696796fd204a6eb69d6da276`;main 文档 tip `dbfceab` 保持。从该 tip 建立 `codex/fg-source-flash-20261008`,只存诊断源文件/启动脚本/记录;没有产品修复合并或新的发布授权。+- 原桌面工作区、其它工作树、发布/候选包、SDK/DLL/模型、驱动与用户配置保持。不派 Agent,不制造压力或竞争 GPU 负载。测试串行且单进程≤300秒。+- 所有输出在 `E:/项目/Veyra/{reports,tests,logs,tmp,test-packages}/fg-source-flash-20261008`。运行库共享原件的只读硬链接,只有一份任务专用 GUI 运行目录;配置、缓存和日志隔离。+- `pre-document-state.json` 在创建本轮文档工作树之前固定35个原工作树/495个脏文件。此基线不冒充工具排查前的开工快照;此前产品静态库/源码/候选的保全以实际构建和用例收据为证据。++## 执行和判断++1. 按进程、设置 revision、补帧后端、内容节奏分段,区分手动重建、场景切换、生成帧失效/过期和真正的设备/Present 错误。+2. 逐帧检查手机录像,确认是否整屏黑闪;不从30fps录像推断物理黑闪持续时间,不把手机创建时间直接硬对齐应用日志。+3. 独立原生 EXE 复用当前产品静态库。对确定非黑的4K P010/PQ输入,比较源60/隔帧30、重复/静止内容、光流后端和原版NR路径。Draw后只在GPU复制九个分布位置,结束后一次读取;不逐帧等待CPU。+4. 若本机未复现,提供真实QML播放器诊断EXE,同时采样“增强原帧/生成帧进入presenter的纹理”和“Draw后的交换链buffer”。保存source ID、epoch/revision、PTS、wall time、buffer index和提交fence。用已知黑场正例验证检测有效。+5. 现场按原设置复现15–20秒并关闭,取得像素和事件CSV后定位:输入已黑→继续查graph/provider/交接;输入正常而buffer黑→查blit/描述符/资源复用;两者均正常而现场屏幕闪黑→查提交后窗口、遮罩、合成、驱动和显示路径。最后一种情况也不能直接归咎电视或驱动。+6. 有稳定复现后再实施最小修复并做匹配A/B;本机5070的软件短测不替代5090/Magewell/LG HDR实卡验收。++## 完成门槛++本轮诊断交付要求构建和启动通过、黑场正例能够检测、原包/原工作树保持、文档如实记录未测边界。产品修复的门槛另为:现场复现→定位→最小修复→同设置回归,当前尚未满足。++当前结果见 [排查报告](FG_SOURCE_FLASH_REPORT_2026-10-08.md)。diff --git a/docs/FG_SOURCE_FLASH_REPORT_2026-10-08.md b/docs/FG_SOURCE_FLASH_REPORT_2026-10-08.mdnew file mode 100644index 00000000..706744e2--- /dev/null+++ b/docs/FG_SOURCE_FLASH_REPORT_2026-10-08.md@@ -0,0 +1,64 @@+# 补帧+源时间戳闪黑:当前证据与现场诊断++**整幅黑闪已由录像确认;根因尚未锁定,未提交产品修复。** 不应由60→30有效推断PTS错误,也不能由FPS或NGX/Present成功推断像素正常。++## 原始证据++`veyra-qml(41).log` 为42,664,677字节、141,315行,SHA256 `4714f8ee048f12965bd8ccd8c546191c5659cc7d40f40702d816faf670bd7d96`。手机录像 `ebdc538711ace23c8edc69cc11a57bfc.mp4` 为612,092字节、720×1280/30fps/146帧,SHA256 `9481aaddfe254ad46e8c8a53caf650b9702c4841f7af4846bff5771c09ad5ee6`。++录像第104帧(约3.467秒)和129帧(4.300秒)屏幕接近全黑,邻帧恢复;黑帧画面ROI平均码值分别约1.97/255、2.09/255,周围正常画面约89–92/255。不是局部运动残影。每次只占一张手机录像帧,不据此声称屏幕黑了33ms。视频创建时间06:24:11Z附近应用使用DLSS 2X/transport并有全屏切换,但手机和电脑时钟未校准,不能硬对齐两个事件。++现场日志:RTX5090/32GB、驱动617.42、Magewell Pro Capture HDMI4K+、3840×2160/P010/PQ/约59.94fps,LG TV SSCR2约143.988Hz。存在DLSS、VFG、XeSS切换,不能把全部时段归给VFG。光流常为AMD FidelityFX,NR常为两层1080p、NVIDIA原版。++## 日志和代码核对++- 18条ERROR为17次QML几何操作失败和1次配置保存失败;没有NGX/FG/Present/device-lost错误。错误和黑闪的关联没有被证实。+- 最后DLSS/transport稳定段约927秒、924个FPS样本,中位源60/提交120。55399个有效FG、invalid=0/providerDisabled=0;存在72次新增生成前跳过、11次过期等,不是“完全没有丢帧”。只有一次场景边界以及开段设置重建,没有反复reset证据。这些计数没有包含逐帧像素。+- 60→30保留真实PTS并减半源工作量、扩大每对帧处理窗口。它缓解故障不能单独证明源PTS有错。+- 核对有界作业、纹理奇偶复用、生成帧warmup/validity、producer/consumer fence、present slot和HDR生命周期;没有找到能够据现有日志定罪的资源竞争或“跳过生成帧就清黑”的路径。+- 正式2.0.6→当前main的产品差异集中在VFG预算;未改DLSS/XeSS graph、VideoPresenter或PresentSink。当前没有版本二分证据证明哪个改动引入黑闪。++## 实际本机验证++本机RTX5070/616.56;GUI日志显示本机显示器约320Hz,与现场5090/617.42/LG144Hz不同。原生诊断没有实卡输入,也没有HDR面板扫描验收。复用已构建`71723e0`产品库,只有外部VideoPresenter副本加入取样;确定非黑输入下,分布九点均非黑。样本统计不作为性能验收,诊断窗口、额外GPU拷贝、debug layer及过期策略会影响负载。++| 原生用例 | 原帧样本 | 生成帧样本 | 九点全黑 |+| --- | ---: | ---: | ---: |+| HDR4K、FG关 | 480 | 0 | 0 |+| HDR4K、DLSS2X、NVOF、源60 | 794 | 673 | 0 |+| HDR4K、DLSS2X、NVOF、隔帧30 | 294 | 293 | 0 |+| HDR4K、DLSS2X、AMD光流、静止60 | 647 | 441 | 0 |+| 同上+两层Lecram NR1080 | 477 | 219 | 0 |+| 同上+两层NVIDIA原版NR1080 | 628 | 242 | 0 |++六组均exit0、GPU错误0、运行组件前后SHA保持。早期两层用例用了枚举0(Lecram),没有冒充NVIDIA原版;修正为`NvidiaOriginal=3`后另做最后一组。初次缺少EXE旁shaders的初始化失败保留,不计通过。++真实GUI最终诊断EXE SHA256 `4c38d320585ff545dac231910fe7f64b71a2930af5e164f6c40fb32fce9804a1`:++- GTA6原片+NR1080+VFG4,最终EXE/PowerShell入口取得203张原帧、608张生成帧,两处取样全非黑,正常退出。+- DLSS2X/源60,已知黑场输入共480原帧/479生成帧,准确检测到13张黑原帧/12张黑生成帧,呈现输入与buffer一致,exit0、无ERROR。+- 最终Windows PowerShell5.1入口/已知黑场+VFG4:449原帧/1345生成帧,检测到13/36张黑帧,exit0、forcedStop=false;原配置源文件SHA保持,自动证据ZIP CRC通过且不含profile。+- 首次PowerShell5.1入口取得像素但ExitCode为null,不记为退出码验收通过。保留原收据;保活Process.Handle后另做上述独立用例通过。QML测试注入第一次因CRLF匹配失败,尚未写文件/启动进程,保留失败记录后修正。++已知黑场是故意生成的测试素材,不是现场故障复现。最终取样器能检测黑图,仍不代表现场bug已修复。原生VFG/HDR全矩阵、XeSS内部生成帧、现场实卡/全屏/VRR/长稳未验。++## 现场诊断程序++交付 `E:/项目/Veyra/test-packages/fg-source-flash-20261008/Veyra-2.0.6-black-flash-diagnostic.zip`,只追加命名不同的诊断EXE和入口;包含完整对应基础源码及诊断补充源码/许可证。没有新增或替换DLL/模型,不是正式修复版。++1. 关闭现有播放器,将ZIP顶层文件放在原2.0.6 **NVIDIA**便携版根目录(与`veyra_qml_ui.exe`同级)。不覆盖原EXE。+2. 双击`Start-Flash-Diagnostic.cmd`。启动器将当前链/界面配置复制到独立profile,只修改副本。+3. 使用原采集源、同一补帧后端/倍率及“采用源时间戳”。在原来容易黑闪的静止场景复现15–20秒,看到黑闪后关闭诊断播放器。+4. 程序最多90秒自动退出;取样最多10000次提交,120fps约83秒,高倍率更早到上限。需要正常关闭才会保存取样;将`logs/flash-diagnostic-时间.zip`交回分析。++每次在同一GPU呈现命令中采样9个位置,分别来自最终增强原帧/生成帧纹理和Draw后的buffer。CPU只在收尾fence完成后读取一次;约88MiB有界readback,不是持续增长的图像存储。CSV保留码值、帧ID、PTS、wall time、epoch/revision、buffer index、fence及Present结果,不包含整幅抓帧。正常电影黑场同样会被检测,需要与相邻原帧及现场时点区分。XeSS在代理swapchain内部生成的帧不在此probe覆盖范围。++像素正常而屏幕黑闪只能把方向移到后续呈现/窗口/合成/驱动/显示,不能直接宣布电视或驱动有问题。取样会带来额外命令和屏障,现场阴性也不能彻底排除时序竞争。下一步唯一关键证据是**实际闪黑那次的双阶段像素及事件CSV**。++## 复现命令与保全++外部脚本目录 `E:/项目/Veyra/reports/fg-source-flash-20261008`:`analyze-log.py`、`segment-log.py`、`analyze-video.py`,输出log/segmented/video分析JSON、亮度CSV与检视图片;`build-probe.py`、`run-probe.py`构建/运行原生诊断;`build-field.py`重链接实际GUI;`run-field.py`隔离GUI用例。实际编译/链接argv与产品库SHA见`logs/.../build-receipt.json`和`field-build/receipt.json`,每组实际参数/EXE SHA/退出码见对应`receipt.json`,汇总`reports/.../test-summary.json`。++原生末组实际命令:`python reports/.../run-probe.py hdr-dlss-amd-static-original-nr2 dlss transport hdr 2 20 3840 2160 amd static`。GUI末组用`powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/diagnostics/start-fg-flash-diagnostic.ps1`并明确指定E盘共享app、private配置源、独立输出、15秒及已知黑场源;完整参数在收据/WORKLOG。++Phone视频解码使用本机FFmpeg8.1.1作离线检视,未替换产品带PS5补丁的FFmpeg9.0.1。全部GPU用例串行、无竞争/压力程序;没有改驱动、用户配置或其它工作树。main仍dbfceab,产品源码无改动,不合并/推送/发布/关机。保全和新增占用以本轮`preservation-check.json`、`delivery.json`及`storage.json`最终收据为准。diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex f6372f25..04f64b26 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -8779,3 +8779,26 @@ post-cleanup-smoke.py 从现有完整候选直接启动,独立profile/log/cach## 2026-10-08 桌面项目追加清理用户要求清理桌面 Veyra 项目。独立 start/dirty 备份及 scan before→prepare→PowerShell 预检/-Execute→verify→scan after;8 旧构建 + 旧 1.2.0 解压目录、14,841 历史 logs 先 lossless 去重归档 E 盘,合计移除 17,395 文件路径/9 目录,零失败。C 卷实际增加 7.328 GiB,E 归档/扫描等约成本 2.105 GiB,两卷整轮净增约 5.046 GiB;桌面项目 19.631→12.267 GiB。35 工作树/495 脏文件、66,680 保留文件 SHA/ID/mtime、57 归档/二进制、587 编译输入及上轮 658 donor 通过,当前 VFG Ninja -n exit0;没有重编译或新 GPU 性能/播放测试。旧 ZIP 新增启动日志导致第一次准备停下,无删除;另行 lossless 保存后核对。新产物 E:/项目/Veyra/{archives,reports,logs}/desktop-cleanup-20261008,报告 docs/DESKTOP_STORAGE_CLEANUP_2026-10-08.md。不改产品或其它桌面文件,不 push/Release/关机,未重试上轮被拒绝的 E temp 删除。+++## 2026-10-08 补帧+源时间戳黑闪与手机录像排查++用户提供veyra-qml(41).log和ebdc538711ace23c8edc69cc11a57bfc.mp4,报告只有补帧+源时间戳闪黑,FG关/60→30不闪。本轮诊断结论:录像确认3.467/4.300秒整幅近黑,下一录像帧恢复;根因仍未知,未改产品/驱动/DLL/用户配置、未合并/推送/发布/关机,无子Agent或压力/竞争GPU负载。旧UI冻结不用于阻塞本次用户明确要求的诊断,产品基底71723e0和main dbfceab保持。++先只读分析42,664,677字节/141,315行日志,SHA4714f8ee048f12965bd8ccd8c546191c5659cc7d40f40702d816faf670bd7d96;视频612,092字节/146帧,SHA9481aaddfe254ad46e8c8a53caf650b9702c4841f7af4846bff5771c09ad5ee6。现场5090/617.42/Magewell4K59.94 P010 PQ/LG144Hz,切换DLSS/VFG/XeSS,AMD光流常用。18 ERROR为17 QML几何+1配置,未见provider/device/Present失败;末段927秒稳定DLSS transport源60/提交120中位数、valid55399/invalid0,只有一处场景边界及开段设置重建。FPS不是像素证据;60→30减半工作并扩窗口,不能直接推断PTS错误。手机时间未校准,未硬对齐应用事件。++实际脚本全部E:/项目/Veyra/reports/fg-source-flash-20261008:analyze-log.py、segment-log.py、analyze-video.py仅读原输入,输出JSON/亮度CSV/检视PNG。视频检视用本机FFmpeg8.1.1,不替换产品patched FFmpeg9.0.1。build-probe.py采用原有Ninja编译/链接argv,给外部VideoPresenter副本加入GPU九点取样,静态库/产品源码逐SHA保持;run-probe.py依次运行HDR FG关、DLSS源60、half、AMD静止、Lecram两层、NVIDIA原版两层六组,全部无黑样本/无GPU错误,见test-summary.json。末组完整命令:python E:/项目/Veyra/reports/fg-source-flash-20261008/run-probe.py hdr-dlss-amd-static-original-nr2 dlss transport hdr 2 20 3840 2160 amd static;20秒取得628原帧/242生成帧,runtimeUnchanged=true。先前枚举0为Lecram,纠正为NvidiaOriginal=3后独立补测,不混称原版。原生诊断有跳过/过期,不作为性能验收。++build-field.py只重编译外部presenter并重链接原QML对象和产品库,四个插点为Draw后双资源取样、提交fence、Present结果及close后一次map。没有逐帧CPU readback/wait,没有正常产品链路修改。最终GUI SHA4c38d320585ff545dac231910fe7f64b71a2930af5e164f6c40fb32fce9804a1;run-field.py最终DLSS源60/已知黑场480原帧479生成帧,检测13/12张黑图,两阶段一致、exit0/无ERROR。GTA6原片+NR1080+VFG4最终EXE入口203/608帧均非黑。最后实际入口命令:powershell.exe -NoProfile -ExecutionPolicy Bypass -File E:/项目/Veyra/worktrees/fg-source-flash-20261008/scripts/diagnostics/start-fg-flash-diagnostic.ps1 -AppDirectory E:/项目/Veyra/tests/fg-source-flash-20261008/field/app -ProfileSource E:/项目/Veyra/tests/vfg-next-20261007/candidate-cold/profile -OutputDirectory E:/项目/Veyra/logs/fg-source-flash-20261008/launcher-powershell51-handle -DurationSeconds 15 -Source E:/项目/Veyra/tests/fg-source-flash-20261008/field/known-black-input.mp4;最终WinPS5.1 exit0/forcedStop=false,449/1345帧检测13/36黑图,原配置源SHA保持,自动日志ZIP无profile/凭据且CRC通过。已知黑场是检测正例,不是现场故障复现;本机5070/616.56/约320Hz不能替代现场5090/HDR电视。XeSS内部帧和物理显示未测。++失败/纠偏保留:早期vcvars引号/输出编码获取失败修正后编译;首次原生EXE缺旁边shaders初始化失败,之后仅在自有目录补shaders;测试QML注入LF/CRLF断言发生于写文件/启动前,独立v2通过;旧原生早期EXE未逐次完整封存,末组原版NR及最终GUI有对应源/EXE/输入库SHA归档,早期结果仅作辅助。首次WinPS5.1取到了CSV但ExitCode=null,不记完整退出码通过;保活Process.Handle后另组15秒验证0。原收据不改。++诊断文档工作树从dbfceab新建codex/fg-source-flash-20261008;pre-document-state.json在建树前固定35原树/495脏文件,只证明此节点之后保全,未冒称整个排查前快照。当前只新增方案/报告、两个诊断header、README和隔离启动器及本WORKLOG,产品源码无改动。build字段原静态库、71723产品源、候选完整package-manifest再次核验;audit-state.py check核对35原树/495脏文件,最终回执在reports/.../preservation-check.json。++package-field.py交付test-packages/fg-source-flash-20261008/Veyra-2.0.6-black-flash-diagnostic.zip,78,553,916字节,SHA420a461dd93d16d42821d2829c801077a8855b06dfeb6e773387659a105e1e9e;ZIP CRC/逐文件SHA、最终EXE身份及嵌套基础源码无DLL/SDK二进制通过。附完整71723基础源码、补充源、GPL许可证,不携带或替换任何运行时/模型,不是修复版。放到原NVIDIA2.0.6目录另名启动,独立配置;复现15–20秒后正常关闭,90秒自动退出,回传logs/flash-diagnostic-时间.zip。下一步必须取得实际黑闪时的双阶段像素/事件CSV,再确定graph/provider/blit或提交后窗口/合成/驱动/显示归属。++本轮只有一份共享诊断app,运行文件硬链接原候选、配置/log/cache独立,无每用例完整payload副本。新增占用按storage.json排除原包硬链接ID,不将逻辑副本字节冒充新增磁盘占用。收尾删除四个本轮独立TEMP/cache的原生PowerShell命令在CreateProcess前被自动审批拒绝,只返回blocked by policy,无其它理由;未执行、未重试或换shell删除。保留344个文件/42,277,435字节(约40.32MiB),cache-cleanup.json记removed=0,不影响诊断交付,旧被拒project-cleanup temp未触碰。++末组原生原版NR仍有572/1200源机会跳过、385生成帧过期,不能冒充现场稳定60/120负载;这是额外明确的负结果边界。实际日志两层Feature18 Create均result=0x1、handle=non-null、seh=0;Evaluate/FG运行计数与NGX收尾结果留在对应engine.log,不由Create成功推断画面正常。++收尾核验:原候选package-manifest实际1614项全部SHA保持,两个构建回执的原库/对象/原EXE输入保持,外部Python AST通过;audit-state.py check为35原工作树/495脏文件changed=[]。storage.json本节点新增唯一文件内容326,994,164字节(约311.85MiB),已排除原候选硬链接且不冒充卷空闲变化;包含最终包/对应源/日志与约40.32MiB被拒清理缓存。最终仅7份诊断/文档文件本地存档,不修改产品、不合入main。diff --git a/scripts/diagnostics/fg-flash/FieldPixelProbe.h b/scripts/diagnostics/fg-flash/FieldPixelProbe.hnew file mode 100644index 00000000..926ab72f--- /dev/null+++ b/scripts/diagnostics/fg-flash/FieldPixelProbe.h@@ -0,0 +1,65 @@+// Diagnostic executable only. Product libraries, settings and timing remain unchanged.+// Samples 9 pixels from each input/output on the GPU, then reads them once at close.+#pragma once+#include "FlashPixelProbe.h"+#include "veyra/Log.h"+#include "veyra/RuntimePaths.h"+#include <format>+#include <stdexcept>++namespace flashField {+struct Event {size_t sourceOrdinal,bufferOrdinal;uint64_t frame,epoch,revision,fence;int64_t pts,recorded,presentEnd;unsigned backBuffer;int result=-1;};+inline std::vector<Event> events;+inline Microsoft::WRL::ComPtr<ID3D12Fence> lastFence;+inline uint64_t lastValue=0;+inline size_t submittedEntries=0;+inline int64_t wall100ns(){FILETIME f{};GetSystemTimePreciseAsFileTime(&f);ULARGE_INTEGER n{};n.LowPart=f.dwLowDateTime;n.HighPart=f.dwHighDateTime;return int64_t(n.QuadPart-116444736000000000ull);}+inline void record(ID3D12Device* device,ID3D12GraphicsCommandList* list,ID3D12Resource* source,ID3D12Resource* buffer,bool generated,uint64_t frame,unsigned slot,uint64_t epoch,uint64_t revision,int64_t pts,unsigned backBuffer){+ if(flashProbe::entries.size()+2>flashProbe::capacity){flashProbe::overflow=true;return;}+ const size_t begin=flashProbe::entries.size();+ flashProbe::record(device,list,source,generated,frame,slot,epoch,revision,pts,"present-input");+ flashProbe::record(device,list,buffer,generated,frame,slot,epoch,revision,pts,"present");+ if(flashProbe::entries.size()==begin+2)events.push_back({begin,begin+1,frame,epoch,revision,0,pts,wall100ns(),0,backBuffer});+}+inline void submitted(ID3D12Fence* fence,uint64_t value){+ if(flashProbe::entries.size()==submittedEntries)return;+ submittedEntries=flashProbe::entries.size();lastFence=fence;lastValue=value;+ if(!events.empty())events.back().fence=value;+}+inline void presented(bool ok){+ if(!events.empty()&&events.back().presentEnd==0){events.back().presentEnd=wall100ns();events.back().result=ok?1:0;}+}+inline void finish(){+ if(flashProbe::entries.empty())return;+ // Close already drains the private presenter queue. Shared-queue paths use+ // their submitted fence; wait only here, never in the per-frame loop.+ if(lastFence&&lastFence->GetCompletedValue()<lastValue){+ HANDLE event=CreateEventW(nullptr,FALSE,FALSE,nullptr);+ const HRESULT hr=event?lastFence->SetEventOnCompletion(lastValue,event):E_FAIL;+ const DWORD waited=SUCCEEDED(hr)?WaitForSingleObject(event,10000):WAIT_FAILED;+ if(event)CloseHandle(event);+ if(waited!=WAIT_OBJECT_0){veyra::log::error("flash-probe",std::format("teardown sample fence not complete hr=0x{:X} wait={}; not mapping",unsigned(hr),waited));return;}+ }+ // If recording was followed by a failed submit, exclude the unsubmitted tail.+ flashProbe::entries.resize(submittedEntries);+ try{+ wchar_t overridePath[32768]{};+ const DWORD length=GetEnvironmentVariableW(L"VEYRA_FLASH_PROBE_DIR",overridePath,32768);+ const auto dir=length&&length<32768?std::filesystem::path(overridePath):veyra::runtime::logsDirectory();+ std::filesystem::create_directories(dir);+ const auto stem=std::format(L"flash-pixels-{}-{}",GetCurrentProcessId(),wall100ns());+ const auto csv=dir/(stem+L".csv");+ const auto count=flashProbe::entries.size();const bool capped=flashProbe::overflow;+ const bool nonblack=flashProbe::dump(csv.c_str());+ std::ofstream out(dir/(stem+L"-events.csv"));+ out<<"sourceOrdinal,bufferOrdinal,frame,epoch,revision,pts100ns,recordUnix100ns,presentEndUnix100ns,backBuffer,submitFence,presentOk\n";+ for(const auto& e:events)if(e.bufferOrdinal<count)out<<e.sourceOrdinal<<','<<e.bufferOrdinal<<','<<e.frame<<','<<e.epoch<<','<<e.revision<<','<<e.pts<<','<<e.recorded<<','<<e.presentEnd<<','<<e.backBuffer<<','<<e.fence<<','<<e.result<<'\n';+ const bool saved=std::filesystem::exists(csv)&&std::filesystem::file_size(csv)>0;+ const auto utf8=csv.u8string();const std::string displayPath(utf8.begin(),utf8.end());+ if(saved)veyra::log::info("flash-probe",std::format("saved={} samples={} capped={} nonblack={} (diagnostic samples; normal black scenes are valid; XeSS-internal frames are not sampled)",displayPath,count,capped,nonblack));+ else veyra::log::error("flash-probe",std::format("no pixel CSV written; samples={} samplerFailed={} (supported RGBA8/RGB10 only)",count,flashProbe::failed));+ }catch(const std::exception& e){veyra::log::error("flash-probe",e.what());}+ events.clear();lastFence.Reset();lastValue=0;submittedEntries=0;+ flashProbe::readback.Reset();flashProbe::entries.clear();flashProbe::failed=false;flashProbe::overflow=false;+}+}diff --git a/scripts/diagnostics/fg-flash/FlashPixelProbe.h b/scripts/diagnostics/fg-flash/FlashPixelProbe.hnew file mode 100644index 00000000..b129f36c--- /dev/null+++ b/scripts/diagnostics/fg-flash/FlashPixelProbe.h@@ -0,0 +1,66 @@+// Diagnostic-only: sample the actual buffer in the same presentation list.+// Never included in the product. Nonblack deterministic inputs are the oracle.+#pragma once+#include <d3d12.h>+#include <wrl/client.h>+#include <array>+#include <vector>+#include <fstream>+#include <iostream>+#include <cstring>+#include <filesystem>+#include <chrono>++namespace flashProbe {+inline constexpr unsigned capacity=20000, points=9, stride=512;+inline Microsoft::WRL::ComPtr<ID3D12Resource> readback;+struct Entry {bool generated;uint64_t source;uint32_t slot;DXGI_FORMAT format;uint64_t epoch,revision;int64_t pts,unix100ns;const char* stage;};+inline std::vector<Entry> entries;+inline bool overflow=false,failed=false;+inline void record(ID3D12Device* device,ID3D12GraphicsCommandList* list,ID3D12Resource* buffer,bool generated,uint64_t source,unsigned slot,uint64_t epoch=0,uint64_t revision=0,int64_t pts=-1,const char* stage="present"){+ if(entries.size()==capacity){overflow=true;return;}+ if(!readback){+ D3D12_HEAP_PROPERTIES hp{};hp.Type=D3D12_HEAP_TYPE_READBACK;+ D3D12_RESOURCE_DESC rd{};rd.Dimension=D3D12_RESOURCE_DIMENSION_BUFFER;+ rd.Width=uint64_t(capacity)*points*stride;rd.Height=1;rd.DepthOrArraySize=1;rd.MipLevels=1;rd.SampleDesc.Count=1;rd.Layout=D3D12_TEXTURE_LAYOUT_ROW_MAJOR;+ if(FAILED(device->CreateCommittedResource(&hp,D3D12_HEAP_FLAG_NONE,&rd,D3D12_RESOURCE_STATE_COPY_DEST,nullptr,IID_PPV_ARGS(&readback)))){failed=true;return;}+ }+ const auto d=buffer->GetDesc();+ if(d.Format!=DXGI_FORMAT_R10G10B10A2_UNORM&&d.Format!=DXGI_FORMAT_R8G8B8A8_UNORM){failed=true;return;}+ D3D12_RESOURCE_BARRIER b{};b.Type=D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;b.Transition.pResource=buffer;b.Transition.Subresource=D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;+ b.Transition.StateBefore=D3D12_RESOURCE_STATE_COMMON;b.Transition.StateAfter=D3D12_RESOURCE_STATE_COPY_SOURCE;list->ResourceBarrier(1,&b);+ D3D12_TEXTURE_COPY_LOCATION src{};src.pResource=buffer;src.Type=D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;+ for(unsigned y=0;y<3;++y)for(unsigned x=0;x<3;++x){+ const unsigned xx=unsigned(d.Width)*(x+1)/4,yy=d.Height*(y+1)/4;+ D3D12_BOX box{xx,yy,0,xx+1,yy+1,1};+ D3D12_TEXTURE_COPY_LOCATION dst{};dst.pResource=readback.Get();dst.Type=D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;+ dst.PlacedFootprint.Offset=(uint64_t(entries.size())*points+y*3+x)*stride;+ dst.PlacedFootprint.Footprint={d.Format,1,1,1,256};list->CopyTextureRegion(&dst,0,0,0,&src,&box);+ }+ std::swap(b.Transition.StateBefore,b.Transition.StateAfter);list->ResourceBarrier(1,&b);+ FILETIME ft{};GetSystemTimePreciseAsFileTime(&ft);ULARGE_INTEGER raw{};raw.LowPart=ft.dwLowDateTime;raw.HighPart=ft.dwHighDateTime;+ entries.push_back({generated,source,slot,d.Format,epoch,revision,pts,int64_t(raw.QuadPart-116444736000000000ull),stage});+}+inline bool dump(const wchar_t* file){+ if(!readback||entries.empty()||failed)return false;+ void* ptr=nullptr;D3D12_RANGE range{0,entries.size()*points*stride};+ if(FAILED(readback->Map(0,&range,&ptr)))return false;+ std::ofstream out{std::filesystem::path(file)};out<<"ordinal,source,generated,slot,format,minCode,maxCode,meanCode,blackPoints,epoch,revision,pts100ns,unix100ns,stage\n";+ unsigned blackReal=0,blackGenerated=0,reals=0,generated=0;+ for(size_t i=0;i<entries.size();++i){+ const auto e=entries[i];unsigned lo=1023,hi=0,black=0;double mean=0;+ for(unsigned j=0;j<points;++j){+ const auto* p=static_cast<uint8_t*>(ptr)+(i*points+j)*stride;std::array<unsigned,3> rgb{};+ if(e.format==DXGI_FORMAT_R10G10B10A2_UNORM){uint32_t v=0;std::memcpy(&v,p,4);rgb={v&1023,(v>>10)&1023,(v>>20)&1023};}+ else rgb={unsigned(p[0])*1023/255,unsigned(p[1])*1023/255,unsigned(p[2])*1023/255};+ unsigned localMax=0;for(auto v:rgb){lo=std::min(lo,v);hi=std::max(hi,v);localMax=std::max(localMax,v);mean+=v;}+ black+=localMax<=5;+ }+ if(e.generated){++generated;blackGenerated+=black==points;}else{++reals;blackReal+=black==points;}+ out<<i<<','<<e.source<<','<<e.generated<<','<<e.slot<<','<<unsigned(e.format)<<','<<lo<<','<<hi<<','<<mean/(points*3)<<','<<black<<','<<e.epoch<<','<<e.revision<<','<<e.pts<<','<<e.unix100ns<<','<<e.stage<<'\n';+ }+ D3D12_RANGE noWrite{0,0};readback->Unmap(0,&noWrite);+ std::cout<<"PIXEL_PROBE real="<<reals<<" generated="<<generated<<" blackReal="<<blackReal<<" blackGenerated="<<blackGenerated<<" overflow="<<overflow<<std::endl;+ readback.Reset();entries.clear();const bool ok=out.good()&&blackReal==0&&blackGenerated==0&&!overflow;overflow=false;return ok;+}+}diff --git a/scripts/diagnostics/fg-flash/README.md b/scripts/diagnostics/fg-flash/README.mdnew file mode 100644index 00000000..87447052--- /dev/null+++ b/scripts/diagnostics/fg-flash/README.md@@ -0,0 +1,17 @@+# FG flash pixel sampler++Diagnostic-only sources; not linked into the normal product or its CMake targets.+The generated external VideoPresenter copy records the final enhanced/generated+input and drawn swapchain buffer in the same command list, tracks the submitted+fence, and maps the bounded readback only at presenter close.++`FlashPixelProbe.h` implements the nine-point RGBA8/RGB10 sampler.+`FieldPixelProbe.h` adds frame identity, paired source/buffer events and close-time+CSV output. A black sample is evidence of black pixels, not proof of a bug.+XeSS-internal generated frames and panel scanout are not measured.++The exact tested build recipe, generated presenter and hashed input libraries+are preserved in `E:/项目/Veyra/reports/fg-source-flash-20261008` and the matching+diagnostic ZIP. Base product commit: `71723e0249a17764696796fd204a6eb69d6da276`.+Final GUI SHA256: `4c38d320585ff545dac231910fe7f64b71a2930af5e164f6c40fb32fce9804a1`.+See `docs/FG_SOURCE_FLASH_REPORT_2026-10-08.md` for tests and limitations.diff --git a/scripts/diagnostics/start-fg-flash-diagnostic.ps1 b/scripts/diagnostics/start-fg-flash-diagnostic.ps1new file mode 100644index 00000000..4a354bdb--- /dev/null+++ b/scripts/diagnostics/start-fg-flash-diagnostic.ps1@@ -0,0 +1,98 @@+param(+ [string]$AppDirectory = $PSScriptRoot,+ [string]$ProfileSource = '',+ [string]$OutputDirectory = '',+ [string]$Source = '',+ [ValidateRange(15,90)][int]$DurationSeconds = 90+)+$ErrorActionPreference = 'Stop'+$app = [IO.Path]::GetFullPath($AppDirectory)+$diagnostic = Join-Path $app 'veyra-flash-diagnostic.exe'+foreach ($required in @($diagnostic, (Join-Path $app 'qt.conf'), (Join-Path $app 'Qt6Core.dll'), (Join-Path $app 'qml/Veyra/Main.qml'))) {+ if (-not (Test-Path -LiteralPath $required -PathType Leaf)) {+ throw 'Place the diagnostic files beside the original Veyra 2.0.6 NVIDIA executable first.'+ }+}+$players = @(Get-Process -Name 'veyra_qml_ui','veyra-flash-diagnostic','flash-pixel-probe' -ErrorAction SilentlyContinue)+if ($players.Count -gt 0) { throw 'Close other Veyra players before starting this diagnostic.' }+if ([string]::IsNullOrWhiteSpace($ProfileSource)) { $ProfileSource = Join-Path $app 'runtime_local/user-data-2.0.0' }+if ([string]::IsNullOrWhiteSpace($OutputDirectory)) {+ $OutputDirectory = Join-Path $app ('logs/flash-diagnostic-' + (Get-Date -Format 'yyyyMMdd-HHmmss-fff'))+}+$output = [IO.Path]::GetFullPath($OutputDirectory)+if (Test-Path -LiteralPath $output) { throw 'Output directory already exists; refusing to overwrite evidence.' }+$null = New-Item -ItemType Directory -Path $output+$profile = Join-Path $output 'private-profile'+$tmp = Join-Path $output 'tmp'+$null = New-Item -ItemType Directory -Path $profile,$tmp+$copied = @()+if (Test-Path -LiteralPath $ProfileSource -PathType Container) {+ $names = @('chain-session.v1','chain-session.v1.vfg','qml-preferences.v1.json','ui-session.v1','presets.v1','node-anchors.json')+ foreach ($name in $names) {+ $from = Join-Path $ProfileSource $name+ if (Test-Path -LiteralPath $from -PathType Leaf) {+ $digest = (Get-FileHash -LiteralPath $from -Algorithm SHA256).Hash+ Copy-Item -LiteralPath $from -Destination (Join-Path $profile $name)+ $copied += [pscustomobject]@{path=$from; sha256=$digest}+ }+ }+}+$envNames = @('TEMP','TMP','CUDA_CACHE_PATH','VEYRA_LOG_FILE','VEYRA_FLASH_PROBE_DIR','QML_DISABLE_DISK_CACHE')+$savedEnv = @{}+foreach ($name in $envNames) { $savedEnv[$name] = [Environment]::GetEnvironmentVariable($name, 'Process') }+$arguments = @('--data-dir',$profile,'--page','pro','--exit-after',($DurationSeconds * 1000).ToString())+if (-not [string]::IsNullOrWhiteSpace($Source)) { $arguments += $Source }+$result = 1+$forcedStop = $false+try {+ $env:TEMP=$tmp; $env:TMP=$tmp+ $env:CUDA_CACHE_PATH=Join-Path $tmp 'cuda-cache'+ $env:VEYRA_LOG_FILE=Join-Path $output 'engine.log'+ $env:VEYRA_FLASH_PROBE_DIR=$output+ $env:QML_DISABLE_DISK_CACHE='1'+ Write-Host 'Reproduce the flash with the original source and frame-generation settings, then close the diagnostic player.'+ Write-Host ('The player exits automatically after {0} seconds. Logs: {1}' -f $DurationSeconds,$output)+ # All arguments are flags, numbers or filesystem paths. Quoting each one+ # preserves spaces for Windows PowerShell 5.1's Start-Process serializer.+ if (@($arguments | Where-Object { $_.Contains('"') -or $_.EndsWith('\') }).Count -gt 0) {+ throw 'Unsupported diagnostic argument quoting.'+ }+ $quoted = @($arguments | ForEach-Object { '"' + $_ + '"' })+ # This is the interactive diagnostic player; its window must be operable.+ $process = Start-Process -FilePath $diagnostic -ArgumentList $quoted -WorkingDirectory $app -PassThru -WindowStyle Normal `+ -RedirectStandardOutput (Join-Path $output 'console.log') -RedirectStandardError (Join-Path $output 'stderr.log')+ # Keep the process handle open before exit. Windows PowerShell 5.1 can+ # otherwise return a null ExitCode after a manual WaitForExit call.+ $null = $process.Handle+ if (-not $process.WaitForExit(($DurationSeconds + 45) * 1000)) {+ $forcedStop = $true+ Stop-Process -Id $process.Id -Force+ $process.WaitForExit()+ $result = 124+ } else {+ $process.WaitForExit()+ $process.Refresh()+ $result = $process.ExitCode+ if ($null -eq $result) { $result = 125 }+ }+} finally {+ foreach ($name in $envNames) { [Environment]::SetEnvironmentVariable($name,$savedEnv[$name],'Process') }+}+$unchanged = $true+foreach ($item in $copied) {+ if (-not (Test-Path -LiteralPath $item.path -PathType Leaf) -or+ (Get-FileHash -LiteralPath $item.path -Algorithm SHA256).Hash -ne $item.sha256) { $unchanged=$false }+}+$receipt = [pscustomobject]@{+ exit=$result; forcedStop=$forcedStop; diagnosticSha256=(Get-FileHash -LiteralPath $diagnostic -Algorithm SHA256).Hash;+ privateProfile=$profile; copiedSourceProfileFilesUnchanged=$unchanged; durationLimitSeconds=$DurationSeconds;+ pixelFiles=@(Get-ChildItem -LiteralPath $output -File -Filter 'flash-pixels-*.csv' | Select-Object -ExpandProperty Name)+}+$receipt | ConvertTo-Json -Depth 5 | Set-Content -LiteralPath (Join-Path $output 'diagnostic-receipt.json') -Encoding UTF8+# Include logs and samples only; never include the copied profile or credentials.+$evidence = @(Get-ChildItem -LiteralPath $output -File | Where-Object { $_.Extension -in '.log','.csv','.json' } | Select-Object -ExpandProperty FullName)+if ($evidence.Count -gt 0) {+ Compress-Archive -LiteralPath $evidence -DestinationPath ($output + '.zip') -CompressionLevel Optimal+ Write-Host ('Diagnostic evidence saved: ' + $output + '.zip')+}+exit $result