Skip to content

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 recording, HDR scaling and DLAA review

Veyra Goal Agent8123c8216b68
diff --git a/AGENTS.md b/AGENTS.md
index 0af10da9..178dc6b9 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1,3 +1,5 @@
+> **2026-11-08 录制/HDR超分/DLAA及11条审查收尾**:独立分支claude/record-hdr-dlaa-20261108,基线84e2cb5,源码worktrees/claude-record-hdr-dlaa-20261108。录制防长按重复并记触发,FSR/DLSS SR及DLAA共用HDR广色域恢复;1440p DLAA光流适配、故障恢复、独立显存预算和旁路资源处理完成。10目标构建,30次回归、QtQuick175/0/0、8组HDR双重超分、设置事务及真实F8/全屏431帧通过。读docs/RECORD_HDR_DLAA_2026-11-08.md、reports同任务FINAL.json和AUDIT-RESOLUTION.json。入口tests同任务/启动录制HDR与DLAA测试.cmd,独立配置。未合main/push/发布;旧现场误触源仍待新版日志,AMD实卡未验。旧对照app213自动审批拒绝删除,保留。音量/双重超分分支是本轮基线,NR推理复用仍独立。
+
> **2026-11-08 Claude音量/全后端双重超分已收尾(独立分支)**:最新用户任务为音量自动保存及DLSS SR/FSR参与双重超分;产品提交356013b,分支claude/volume-dual-sr-20261108,源码worktrees/claude-volume-dual-sr-20261108,build同任务。Codex读最新聊天后原样保存Claude20文件改动,补退出前音量/重启/非法值回归和启动器,12目标干净提交增量通过;设置274/0、QtQuick172/0/1及单独栅格补测、25 GPU用例、6组360帧导出对齐通过。测试入口tests/claude-volume-dual-sr-20261108/启动音量与双重超分测试.cmd,独立manual-profile;报告reports同任务FINAL.json,说明docs/VOLUME_DUAL_SR_2026-11-08.md。标签2.1.3-volume-dual-sr-test,非正式版;未合main/push/发布。main仍0079ed9、原可用main程序保留,NR推理复用仍在claude/nr-reuse-20261107且本轮未动;AMD实卡未验。下方旧RTX-only及未收尾状态为历史。
> **2026-11-06 项目安全清理完成(最新路径规则)**:122372文件退役,逻辑53.72 GiB,E盘可用实测增加33.73 GiB,项目路径累计152.89→99.28 GiB。源码/未提交改动/分支/全部deps与C依赖Junction/正式包及许可源码/用户配置和输入媒体保持;34关键与正式源码ZIP SHA、19工作树原状态核验通过。当前可用build仍build/claude-screen-recording-20261022(2.1.3-integration-test),当前验收app tests/codex-claude-merge-20261106/app,最新2.1.3测试包codex-rebuild-2.1.3-20261106保留,公开正式版仍v2.1.3。许多旧tests app/旧build仅剩配置和证据,不能按历史入口直接运行;复测从固定源码/正式ZIP重建stage,不读残留旧目录当供体。不要整工程复制备份,任务结束退役冗余stage、缓存和旧未发布ZIP;保留当前可用构建和必要证据。读docs/PROJECT_CLEANUP_2026-11-06.md与reports/codex-project-cleanup-20261106/FINAL.json。0.44GiB旧1.4.0下载ZIP因自动审批blocked by policy拒绝删除而保留,未绕过;下方旧入口“保留/可运行”是历史状态。
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d46f5d7c..f6f9975d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -475,10 +475,12 @@ veyra_add_compute_shader(veyra_shader_aa_temporal AaTemporalResolve)
veyra_add_compute_shader(veyra_shader_aa_mlaa_edges AaMlaaEdges)
veyra_add_compute_shader(veyra_shader_aa_mlaa_counts AaMlaaCounts)
veyra_add_compute_shader(veyra_shader_aa_mlaa_blend AaMlaaBlend)
+# DLAA in HDR: adds the input's out-of-BT.709 part back to the DLSS result.
+veyra_add_compute_shader(veyra_shader_dlaa_hdr_restore DlaaHdrRestore)
add_dependencies(veyra_pipeline veyra_shader_aa_luma veyra_shader_aa_fxaa3 veyra_shader_aa_fxaa4 veyra_shader_aa_fxaa5
veyra_shader_aa_smaa_edges veyra_shader_aa_smaa_weights_low veyra_shader_aa_smaa_weights_medium
veyra_shader_aa_smaa_weights_high veyra_shader_aa_smaa_weights_ultra veyra_shader_aa_smaa_blend veyra_shader_aa_temporal
- veyra_shader_aa_mlaa_edges veyra_shader_aa_mlaa_counts veyra_shader_aa_mlaa_blend)
+ veyra_shader_aa_mlaa_edges veyra_shader_aa_mlaa_counts veyra_shader_aa_mlaa_blend veyra_shader_dlaa_hdr_restore)
add_executable(veyra_pipeline_tests
tests/unit/PipelineContractTests.cpp
diff --git a/docs/RECORD_HDR_DLAA_2026-11-08.md b/docs/RECORD_HDR_DLAA_2026-11-08.md
new file mode 100644
index 00000000..9072becf
--- /dev/null
+++ b/docs/RECORD_HDR_DLAA_2026-11-08.md
@@ -0,0 +1,63 @@
+# 录制触发、HDR超分与DLAA(2026-11-08)
+
+## 用户范围和接手
+
+原始需求:排查录制反复开关,修复超分与HDR同开失效,增加DLAA抗锯齿。工作树 `E:/项目/Veyra/worktrees/claude-record-hdr-dlaa-20261108`,分支 `claude/record-hdr-dlaa-20261108`,基线 `84e2cb5`(继承音量保存与全后端双重超分)。不合main、不push、不发布,不改真实配置、运行组件或驱动。用户要求完成汇报后关机。
+
+Claude完成主体后额度耗尽,停在新增DLAA界面测试的套件验收。Codex先读原始聊天、日志与差异,保存23文件SHA256快照 `reports/claude-record-hdr-dlaa-20261108/CODEX-TAKEOVER.json`,继续补验收和发现的相关缺口。
+
+## 实现合同
+
+- 录制快捷键禁用长按自动重复;所有录制开始/停止记录触发来源,快捷键另记实际按键、scan code、虚拟键、repeat和事件间隔;启动及改键时记录有效映射。只记触发录制的按键,不输出日常输入内容。
+- 原生HDR不再直接跳过FSR,以HDR上下文处理线性scRGB(BT.709,1=80nits),保留亮度合同。FSR、DLSS SR和DLAA对超出BT.709的负分量共用GPU恢复,避免裁到BT.709;双重FSR每次独立恢复。
+- DLAA通过原有DLSS后端的DLAA模式运行,输入输出同尺寸;保留原SR的1:1旁路。共享光流、每实例独立历史,运动不可用时用显式零运动并reset。视频没有游戏引擎的抖动采样、真实几何运动和深度,不能宣传为游戏内DLAA等效。
+- DLAA在抗锯齿编辑器与FXAA/SMAA/MLAA并列,按DLSS能力置灰,仍支持原节点插入位置。静态图片原样通过并显示原因;使用全局K/M/L模型,模型与光流切换须重建,普通滑条保持原热更新规则。
+- DLAA预设库v20、模式会话v15与 `.dlaa` 旁文件保留旧文件;源码Git不收运行库、模型或SDK。
+
+## 现场证据与判断边界
+
+输入是用户 `E:/wechat/xwechat_files/wxid_kcmlgkgv70mv22_d585/msg/file/2026-11/logs.zip`。日志提取至本任务logs/field,RTX3060Ti、1440p60 NV12、165Hz HDR显示器。录制反复收到空原因的停止请求,文件正常收尾,不能解释为编码器崩溃或采集卡停流。原日志没有按钮/按键来源和有效快捷键映射,不能确定究竟是哪个外部操作触发。
+
+同份现场日志里的图配置一直是sr=0,无法据此证明某一个已启用的SR后端在HDR下失败。正式2.1.3还不含已在本地main修好的QML内容缓存隔离;只能列为相关背景,不能据此认定本例根因。
+
+## Codex补齐项
+
+DLAA独立启用时保持模型/光流参数有效并在运行图拒绝错误热更新;独立零运动与0.9常量深度显式上传;HDR额外纹理和DLAA自身SDK预留纳入显存预算,分段SR之外仅增加DLAA自身预算。FSR HDR对广色域负分量的恢复独立于亮度重建,避免同一负分量被加两遍。
+
+## 验收记录
+
+接手后首先运行 `python -X utf8 -B E:/项目/Veyra/reports/claude-record-hdr-dlaa-20261108/quick_run.py suite`:174通过、0失败、1跳过(需显式输出目录的菜单栅格比较)。完整修复后重跑,175通过、0失败、0跳过。
+
+所有新产物复用 `E:/项目/Veyra/{build,tests,logs,tmp,reports}/claude-record-hdr-dlaa-20261108`,只对测试子进程设置TEMP/TMP和独立data-dir。NR推理复用分支保持独立。
+
+
+## 11 条审查意见的处理
+
+| 编号 | 修复与验收 |
+|---|---|
+| 1 | 缺少同尺寸光流时用现有 FlowAdapt 缩放向量。1440p 输入配 1080p 光流与 4K 超分,4 帧均完成 DLAA,首帧后的 3 帧使用运动信息。 |
+| 2 | NGX 核心和光流失败时去掉依赖的 DLAA。DLAA 执行失败标记为独立组件,进入现有恢复或设置回滚。三类恢复的设置合同均通过,FXAA/SMAA/MLAA 保留。 |
+| 3 | `dual-any-hdr` 和 `dual-any-sdr` 支持按算法对独立运行。8 组 HDR 双重超分通过,每组 3 帧、6 次超分。4 组补测的 SDR 组合均在零运动和光流模式通过。设置事务单独通过,D3D12 错误 0。 |
+| 4 | 完整验收、失败证据与路径见本文件、WORKLOG、两份 AGENTS 及 `FINAL.json`。 |
+| 5 | DLSS SR 单次和双重均恢复超出 BT.709 的 scRGB 负分量。饱和色块平均差 0.000151 scRGB、亮度比 1.000283。FSR 同一块平均差低于输出精度、亮度比 1.000000。 |
+| 6 | DLAA 只增加自身纹理及每实例 256 MiB 的 SDK 估算。已有分段超分仍按其独立规则预留 NR、VFG 和 20% 余量。 |
+| 7 | `ShortcutOverride` 接收者可以是 Qt Quick item。记录最近一秒内与配置匹配的按键事件;未收到对应事件时区分绑定和实测事件。真实窗口 F8 开停均捕获 `QQuickRootItem`、VK `0x77`,两次 `ageMs=0`。 |
+| 8 | 预设库测试每次使用独立 scratch,同一 TEMP 连跑两次均通过。 |
+| 9 | 抗锯齿 QML 用例在 cleanup 恢复原模拟能力表,完整 QtQuick 175/0/0。 |
+| 10 | DLAA、DLSS SR 和 FSR 共用 HDR 恢复的资源、描述符和 GPU 派发。 |
+| 11 | 静态图、非 NVIDIA 或禁用增强的 DLAA 旁路只创建输出纹理,不预留指导纹理及模型空间。静态图逐字节一致,DLAA 求值 0。 |
+
+## 最终验收
+
+- 本机 RTX 5070。10 目标构建 72.3 秒通过,标签 `2.1.3-record-hdr-dlaa-test`,命令见 WORKLOG。程序、88 个 QML/JS 模块文件和 66 个着色器与当前源码/构建核对通过。
+- `audit_checks.py` 的 30 次独立调用全通过。包括 10 项 GPU 图用例、8 组 HDR 双重超分、4 组 SDR 双重超分(各两种运动策略)、设置事务和单元测试。设置与兼容 274/0,词库缺译和占位符问题均为 0。原合并双重用例超时在 `logs/claude-record-hdr-dlaa-20261108/codex/dual-any-hdr.txt` 保留;按算法对隔离后通过。
+- 两层同尺寸 DLAA 实际处理 12 帧,累计 24 次求值。HDR DLAA 的 3328 个原有负分量像素全部保留,合成亮色块亮度比 1.0022。GPU 图的 D3D12 调试层未报错。
+- 最终启动器实际打开测试视频。F8 开始和停止,中间进入全屏,结束后退出全屏,总计仅两条录制触发。H.264 录制 1280×720,431 帧,约 14.39 秒,丢弃 0。`ffprobe -count_frames` 读回 431 帧。操作与结果见 `AUDIT-RECORDING.json`。
+- 现场旧日志有 27 次启动、27 次停止、28 个正常收尾文件,其中 1 次因 HDR 格式变化分段。旧日志缺少具体触发来源,现场误触仍待新版日志确认。未用现场采集卡或 AMD 实卡复验。
+
+## 交付位置
+
+- 启动 `E:/项目/Veyra/tests/claude-record-hdr-dlaa-20261108/启动录制HDR与DLAA测试.cmd`,使用独立 `manual-profile`。
+- `E:/项目/Veyra/reports/claude-record-hdr-dlaa-20261108/FINAL.json` 为最终回执。原始 11 条为 `CLAUDE-REVIEW.json`,逐条结果为 `AUDIT-RESOLUTION.json`。
+- 测试证据保存在任务 logs 下的 `audit-20261108-174250`、`manual` 和 `quick-suite-software-audit.txt`。沿用既有 build 与 app,新增一段约 9.1 MB 的录制证据及测试日志,无新增完整包。
+- `app213` 是与正式 ZIP CRC 一致的 1632 文件对照副本,逻辑 1,079,122,186 字节。删除请求被自动审批拒绝,理由 `blocked by policy`,仍保留,未回收该空间。
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index 665bf68c..847ca911 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -811,3 +811,14 @@ Claude初次构建305.9s,原完整Quick172/0/1、25 GPU用例、原双重/超
独立命令:python -X utf8 -B E:/项目/Veyra/reports/claude-volume-dual-sr-20261108/codex_verify.py --remaining;full_align.py 对六个tests同任务/out/*.mp4与源pan720p-16s.mp4比较。首个设置测试误先建scratch触发exit2,改为不存在路径后274/0;之前失败日志保留。Claude旧RTX-only断言、默认档位和错误尺寸测试输入的修正也保留记录。
报告reports/claude-volume-dual-sr-20261108/FINAL.json;手动入口tests同任务/启动音量与双重超分测试.cmd,manual-profile独立;docs/VOLUME_DUAL_SR_2026-11-08.md说明限制。只保留任务现有可用stage/build/证据,未多做重复整包。本轮未合main、未push/Release;NR推理复用独立分支保持原状态,无AMD实卡验收,不重跑历史8K+NR+VFG卡死组合。
+
+
+## 2026-11-08 录制、HDR超分、DLAA交接与11条审查修复
+
+工作树 `E:/项目/Veyra/worktrees/claude-record-hdr-dlaa-20261108`,分支 `claude/record-hdr-dlaa-20261108`,基线 `84e2cb5`。Claude主体完成后接手,原23文件SHA快照在任务报告目录。最新用户追加要求修复Claude审查的11条。原始审查与处理逐项见 `reports/claude-record-hdr-dlaa-20261108/CLAUDE-REVIEW.json` 和 `AUDIT-RESOLUTION.json`,细节见 `docs/RECORD_HDR_DLAA_2026-11-08.md`。
+
+构建 `python -X utf8 -B scripts/acceptance/build-recording-handoff.py --task claude-record-hdr-dlaa-20261108 --root E:/项目/Veyra/worktrees/claude-record-hdr-dlaa-20261108 --label 2.1.3-record-hdr-dlaa-test --jobs 2 veyra_qml_ui veyra_anti_alias_gpu_tests veyra_preset_library_tests veyra_effect_chain_tests veyra_video_ai_settings_tests veyra_ui_contract_tests veyra_settings_transaction_tests veyra_qml_quick_tests veyra_ui_i18n_tests veyra_sr_quality_tests`。初次Codex构建118.3s,审查后增量72.3s。主程序 `52a86650…`,同任务build和app,不制作额外发布包。
+
+验收运行 `python -X utf8 -B E:/项目/Veyra/reports/claude-record-hdr-dlaa-20261108/audit_checks.py` 与 `quick_run.py suite-audit`。30次调用通过,QtQuick175/0/0,设置274/0,设置事务D3D12错误0,1440p DLAA 3个历史帧获得光流,DLSS/FSR HDR色块通过,8组HDR双重超分通过。先前合并运行SDR后超时,分算法对重跑并独立执行事务检查。预设同TEMP两次通过。真实F8开停各记录Qt Quick实际事件,进出全屏无额外录制请求,431帧及文件完整性核对通过。现场旧日志不含触发源,AMD实卡和采集卡现场未验。
+
+独立配置入口 `E:/项目/Veyra/tests/claude-record-hdr-dlaa-20261108/启动录制HDR与DLAA测试.cmd`。新增约9.1 MB录制证据及测试日志,复用单份当前测试程序。已核验旧app213重复副本1,079,122,186字节,自动审批blocked by policy拒绝删除,未绕过。最终回执同任务FINAL.json。未合main、未推送、未发布。用户要求汇报后正常关机。
diff --git a/i18n/catalog.json b/i18n/catalog.json
index d44b5811..6fa3695f 100644
--- a/i18n/catalog.json
+++ b/i18n/catalog.json
@@ -945,6 +945,27 @@
"en": "D3D12 initialization failed; see diagnostics",
"ja": "D3D12 の初期化に失敗しました。診断を確認してください"
},
+ {
+ "zh": "DLAA 不可用:%1",
+ "src": "src/ui/bridge/Enhancement.cpp",
+ "zh-TW": "DLAA 無法使用:%1",
+ "en": "DLAA unavailable: %1",
+ "ja": "DLAA は使用できません:%1"
+ },
+ {
+ "zh": "DLAA 需要支持 DLSS 的 NVIDIA RTX 显卡",
+ "src": "src/ui/bridge/Enhancement.cpp",
+ "zh-TW": "DLAA 需要支援 DLSS 的 NVIDIA RTX 顯示卡",
+ "en": "DLAA needs an NVIDIA RTX GPU with DLSS support",
+ "ja": "DLAA には DLSS 対応の NVIDIA RTX GPU が必要です"
+ },
+ {
+ "zh": "DLAA:NVIDIA DLSS 在原分辨率运行,按光流跨帧重建边缘;用 DLSS SR 的模型,比其他方式更耗时。采集画面没有游戏那样的抖动采样,效果比游戏内 DLAA 弱",
+ "src": "qml/AntiAliasEditor.qml",
+ "zh-TW": "DLAA:NVIDIA DLSS 以原解析度執行,依光流跨影格重建邊緣;使用 DLSS SR 的模型,比其他方式更耗時。擷取畫面沒有遊戲那樣的抖動取樣,效果比遊戲內 DLAA 弱",
+ "en": "DLAA: NVIDIA DLSS at the native resolution, rebuilding edges across frames along the optical flow; it uses the DLSS SR model and costs more than the other methods. Captured pictures have no jittered samples like a game's, so the effect is weaker than in-game DLAA",
+ "ja": "DLAA:NVIDIA DLSS をネイティブ解像度で実行し、オプティカルフローに沿ってフレーム間でエッジを再構成します。DLSS SR のモデルを使い、他の方式より負荷が高くなります。キャプチャ映像にはゲームのようなジッターサンプルがないため、ゲーム内 DLAA より効果は弱くなります"
+ },
{
"zh": "DLSS 帧生成",
"src": "src/ui/bridge/FrameGeneration.cpp",
@@ -5636,6 +5657,13 @@
"en": "Image GPU ready timed out",
"ja": "画像の GPU 準備がタイムアウトしました"
},
+ {
+ "zh": "图片不支持 DLAA",
+ "src": "src/pipeline/EnhanceGraph.cpp",
+ "zh-TW": "圖片不支援 DLAA",
+ "en": "DLAA does not run on images",
+ "ja": "画像では DLAA は使えません"
+ },
{
"zh": "图片保存失败(目标可能已存在)",
"src": "src/engine/EngineControllerImage.cpp",
@@ -5944,6 +5972,13 @@
"en": "Before enhancement",
"ja": "補正前のベース"
},
+ {
+ "zh": "增强功能已关闭",
+ "src": "src/pipeline/EnhanceGraph.cpp",
+ "zh-TW": "增強功能已關閉",
+ "en": "enhancements are off",
+ "ja": "補正機能はオフです"
+ },
{
"zh": "增强变化量",
"src": "qml/NrLayerEditor.qml",
@@ -9157,6 +9192,20 @@
"en": "Anti-aliasing 2",
"ja": "アンチエイリアス 2"
},
+ {
+ "zh": "抗锯齿实例 {} DLAA 创建失败,画面原样通过。",
+ "src": "src/pipeline/EnhanceGraph.cpp",
+ "zh-TW": "抗鋸齒實例 {} DLAA 建立失敗,畫面原樣通過。",
+ "en": "Anti-aliasing instance {}: DLAA could not be created; the picture passes through unchanged.",
+ "ja": "アンチエイリアス {}:DLAA を作成できなかったため、映像はそのまま通過します。"
+ },
+ {
+ "zh": "抗锯齿实例 {} DLAA 未运行({}),画面原样通过。",
+ "src": "src/pipeline/EnhanceGraph.cpp",
+ "zh-TW": "抗鋸齒實例 {} DLAA 未執行({}),畫面原樣通過。",
+ "en": "Anti-aliasing instance {}: DLAA is not running ({}); the picture passes through unchanged.",
+ "ja": "アンチエイリアス {}:DLAA は動作していません({})。映像はそのまま通過します。"
+ },
{
"zh": "抗闪烁档位",
"src": "qml/NrLayerEditor.qml",
@@ -12596,11 +12645,11 @@
"ja": "状態:%1"
},
{
- "zh": "独立于基础超分,可以选任意一种超分;DLSS SR 两次共用上面的 DLSS 模型,FSR 不支持 HDR。",
+ "zh": "独立于基础超分,可以选任意一种超分;DLSS SR 两次共用上面的 DLSS 模型。",
"src": "qml/SrStageEditor.qml",
- "zh-TW": "獨立於基礎超解析,可以選任意一種超解析;DLSS SR 兩次共用上面的 DLSS 模型,FSR 不支援 HDR。",
- "en": "Independent of the base SR; any SR algorithm works. Both DLSS SR passes use the DLSS model above; FSR does not support HDR.",
- "ja": "基本の超解像とは独立して任意の超解像を選べます。DLSS SR は 2 回とも上の DLSS モデルを使い、FSR は HDR に対応していません。"
+ "zh-TW": "獨立於基礎超解析,可以選任意一種超解析;DLSS SR 兩次共用上面的 DLSS 模型。",
+ "en": "Independent of the base SR; any SR algorithm works. Both DLSS SR passes use the DLSS model above.",
+ "ja": "基本の超解像とは独立して任意の超解像を選べます。DLSS SR は 2 回とも上の DLSS モデルを使います。"
},
{
"zh": "独立采集音频配置失败;BMD 原生视频继续运行",
@@ -17735,7 +17784,7 @@
},
{
"zh": "需要 NVIDIA RTX 显卡",
- "src": "src/ui/bridge/Hardware.cpp",
+ "src": "src/pipeline/EnhanceGraph.cpp",
"zh-TW": "需要 NVIDIA RTX 顯示卡",
"en": "Requires an NVIDIA RTX GPU",
"ja": "NVIDIA RTX GPU が必要です"
@@ -18363,6 +18412,13 @@
"en": "Preset library format or version not supported",
"ja": "プリセットライブラリの形式またはバージョンに対応していません"
},
+ {
+ "zh": "预设库版本不支持 DLAA 抗锯齿",
+ "src": "src/engine/PresetLibrary.cpp",
+ "zh-TW": "預設庫版本不支援 DLAA 抗鋸齒",
+ "en": "This preset library version does not support DLAA anti-aliasing",
+ "ja": "このプリセットライブラリのバージョンは DLAA アンチエイリアスに対応していません"
+ },
{
"zh": "预设库美颜人脸识别字段损坏",
"src": "src/engine/PresetLibrary.cpp",
diff --git a/include/veyra/engine/AntiAliasSettings.h b/include/veyra/engine/AntiAliasSettings.h
index 4c0d99b5..817158f0 100644
--- a/include/veyra/engine/AntiAliasSettings.h
+++ b/include/veyra/engine/AntiAliasSettings.h
@@ -11,18 +11,23 @@ namespace veyra::engine {
// behind super resolution.
inline constexpr uint32_t kMaxAntiAliasInstances = 2;
-enum class AntiAliasMethod : uint8_t { Fxaa = 0, Smaa = 1, Mlaa = 2 };
+enum class AntiAliasMethod : uint8_t { Fxaa = 0, Smaa = 1, Mlaa = 2, Dlaa = 3 };
+// DLAA (user request 2026-11-08): NVIDIA DLSS run at the instance's own size in
+// its DLAA mode, with optical-flow motion. NVIDIA RTX only; captured frames carry
+// no jitter, so it is temporal reconstruction without the sub-pixel samples a
+// game gives DLAA. No tiers; the model is the DLSS SR model setting.
// Experimental temporal accumulation on top of SMAA (captured frames cannot be
// jittered, so these are the "no jitter" approximations of SMAA T2x / 4x).
enum class AntiAliasTemporal : uint8_t { Off = 0, T2x = 1, X4 = 2 };
// Quality tiers per method. FXAA: 0 medium (preset 3), 1 high (4), 2 ultra (5).
-// SMAA: 0 low, 1 medium, 2 high, 3 ultra. MLAA has no tiers.
+// SMAA: 0 low, 1 medium, 2 high, 3 ultra. MLAA and DLAA have no tiers.
constexpr uint32_t antiAliasQualityCount(AntiAliasMethod method) {
return method == AntiAliasMethod::Fxaa ? 3u : method == AntiAliasMethod::Smaa ? 4u : 1u;
}
constexpr bool validAntiAliasMethod(AntiAliasMethod method) {
- return method == AntiAliasMethod::Fxaa || method == AntiAliasMethod::Smaa || method == AntiAliasMethod::Mlaa;
+ return method == AntiAliasMethod::Fxaa || method == AntiAliasMethod::Smaa || method == AntiAliasMethod::Mlaa ||
+ method == AntiAliasMethod::Dlaa;
}
struct AntiAliasSettings {
@@ -42,6 +47,7 @@ struct AntiAliasSettings {
// presets and sessions saved without it keep their older format version.
bool configured() const { return *this != AntiAliasSettings{}; }
bool usesMlaaParameters() const { return method == AntiAliasMethod::Mlaa; }
+ bool usesDlaa() const { return method == AntiAliasMethod::Dlaa; }
bool usesTemporal() const { return method == AntiAliasMethod::Smaa && temporal != AntiAliasTemporal::Off; }
// The values that matter to the running effect: a disabled instance and the
// parameters of a method that is not selected compare equal to the defaults.
@@ -50,7 +56,7 @@ struct AntiAliasSettings {
AntiAliasSettings value = *this;
const AntiAliasSettings defaults;
if (!usesMlaaParameters()) { value.mlaaThreshold = defaults.mlaaThreshold; value.mlaaStrength = defaults.mlaaStrength; }
- if (method == AntiAliasMethod::Mlaa) value.quality = 0;
+ if (method == AntiAliasMethod::Mlaa || method == AntiAliasMethod::Dlaa) value.quality = 0;
if (!usesTemporal()) {
value.temporal = AntiAliasTemporal::Off;
value.historyWeight = defaults.historyWeight;
@@ -79,6 +85,7 @@ struct AntiAliasSettings {
};
// Preset library v14 / chain session v9: one appended block per anti-aliasing node.
+// DLAA (method 3) only in library v20 / session v15: older readers refuse it.
inline void writeAntiAlias(std::ostream& out, const AntiAliasSettings& a) {
out << (a.enabled ? 1 : 0) << ' ' << int(a.method) << ' ' << int(a.quality) << ' ' << a.mlaaThreshold << ' ' << a.mlaaStrength
<< ' ' << int(a.temporal) << ' ' << a.historyWeight << ' ' << a.historyRejection;
@@ -86,7 +93,7 @@ inline void writeAntiAlias(std::ostream& out, const AntiAliasSettings& a) {
inline bool readAntiAlias(std::istream& in, AntiAliasSettings& a) {
int enabled = 0, method = 0, quality = 0, temporal = 0;
if (!(in >> enabled >> method >> quality >> a.mlaaThreshold >> a.mlaaStrength >> temporal >> a.historyWeight >> a.historyRejection)) return false;
- if (enabled < 0 || enabled > 1 || method < 0 || method > 2 || quality < 0 || quality > 255 || temporal < 0 || temporal > 2) return false;
+ if (enabled < 0 || enabled > 1 || method < 0 || method > 3 || quality < 0 || quality > 255 || temporal < 0 || temporal > 2) return false;
a.enabled = enabled != 0;
a.method = static_cast<AntiAliasMethod>(method);
a.quality = static_cast<uint8_t>(quality);
diff --git a/include/veyra/engine/BackendRecovery.h b/include/veyra/engine/BackendRecovery.h
index 73743e11..8cd838af 100644
--- a/include/veyra/engine/BackendRecovery.h
+++ b/include/veyra/engine/BackendRecovery.h
@@ -2,7 +2,7 @@
#include "veyra/engine/EnhancementSettings.h"
namespace veyra::engine {
-enum class FailedBackend { None, Infrastructure, OpticalFlow, NgxCore, Nr, Sr, Fg, VideoHdr };
+enum class FailedBackend { None, Infrastructure, OpticalFlow, NgxCore, Nr, Sr, Fg, VideoHdr, Dlaa };
// NGX 310.9.1 definitions. A failure on 566.07 alone does not establish a
// universal minimum driver. Preserve the real result and suggest recovery.
constexpr const wchar_t* ngxFailureHint(uint64_t result) {
@@ -47,6 +47,7 @@ inline const wchar_t* backendFailureName(FailedBackend backend) {
case FailedBackend::Sr:return L"超分";
case FailedBackend::Fg:return L"帧生成";
case FailedBackend::VideoHdr:return L"RTX Video HDR";
+ case FailedBackend::Dlaa:return L"DLAA";
default:return L"GPU / 输入 / 显示资源";
}
}
@@ -54,17 +55,25 @@ inline const wchar_t* backendFailureName(FailedBackend backend) {
// motion for a failed optical-flow backend while claiming normal enhancement.
inline bool disableFailedBackend(EnhancementSettings& settings,FailedBackend backend){
const auto before=settings;
+ const auto disableDlaa=[&] {
+ if(settings.antiAlias.usesDlaa())settings.antiAlias.enabled=false;
+ for(auto& aa:settings.additionalAntiAlias)
+ if(aa.usesDlaa())aa.enabled=false;
+ };
switch(backend){
+ case FailedBackend::Dlaa:disableDlaa();break;
case FailedBackend::VideoHdr:settings.videoHdr.enabled=false;break;
case FailedBackend::Nr:settings.nr=false;break;
case FailedBackend::Sr:settings.sr=false;break;
case FailedBackend::Fg:settings.multiplier=1;break;
case FailedBackend::NgxCore:
+ disableDlaa();
settings.videoHdr.enabled=false;
settings.nr=settings.sr=false;
if(settings.frameGenerationBackend==FrameGenerationBackend::Dlss)settings.multiplier=1;
break;
case FailedBackend::OpticalFlow:
+ disableDlaa();
settings.nr=false;settings.multiplier=1;
// DLSS SR as the base or the second of a double SR.
if(!settings.videoSrQuality||(settings.dualSrEnabled&&!settings.dualSrQuality))settings.sr=false;
diff --git a/include/veyra/engine/EnhancementSettings.h b/include/veyra/engine/EnhancementSettings.h
index 1412f73c..02bde4d7 100644
--- a/include/veyra/engine/EnhancementSettings.h
+++ b/include/veyra/engine/EnhancementSettings.h
@@ -378,6 +378,12 @@ struct EnhancementSettings {
uint32_t dualSrQuality=kDefaultVideoSrQuality; // any SR value (DLSS SR, RTX Video SR family/tier, FSR), independent of the base
// A DLSS SR / FSR pass reads srMotion: the base, or the second of a double SR.
bool temporalSr() const { return temporalVideoSr(videoSrQuality)||(dualSrEnabled&&temporalVideoSr(dualSrQuality)); }
+ bool usesDlaa() const {
+ if(antiAlias.enabled&&antiAlias.usesDlaa())return true;
+ for(unsigned i=0;i<additionalAntiAliasCount;++i)
+ if(additionalAntiAlias[i].enabled&&additionalAntiAlias[i].usesDlaa())return true;
+ return false;
+ }
uint32_t multiplier=1;
FrameGenerationBackend frameGenerationBackend=FrameGenerationBackend::Dlss;
// NvVFX Mode: Low=0, Medium=1 (default), High=2; mixed tiers 3-5, see vfgPrimaryMode().
@@ -463,7 +469,7 @@ struct EnhancementSettings {
if(!nr||!protection.enabled)active.protection=defaults.protection;
if(!sr){active.srTarget=defaults.srTarget;active.videoSrQuality=defaults.videoSrQuality;active.srMotion=defaults.srMotion;}
// The DLSS SR model serves every DLSS SR pass, the second of a double SR too.
- if(!sr||(videoSrQuality!=0&&!(dualSrEnabled&&dualSrQuality==0)))active.dlssSrModel=defaults.dlssSrModel;
+ if(!usesDlaa()&&(!sr||(videoSrQuality!=0&&!(dualSrEnabled&&dualSrQuality==0))))active.dlssSrModel=defaults.dlssSrModel;
if(!sr||!dualSrEnabled){
active.srPrescale=defaults.srPrescale;
active.dualSrEnabled=false;active.dualSrTarget=defaults.dualSrTarget;active.dualSrQuality=defaults.dualSrQuality;
@@ -496,7 +502,7 @@ struct EnhancementSettings {
if(!hdrMetadata.enabled)active.hdrMetadata=defaults.hdrMetadata;
// Flow is shared. Turning off one effect does not make it inactive
// while another consumer still needs it (VFG has its own flow).
- const bool flowUsed=(nr&&(motionUsesFlow(nrMotion)||usesNrTemporal()))||
+ const bool flowUsed=usesDlaa()||(nr&&(motionUsesFlow(nrMotion)||usesNrTemporal()))||
(sr&&temporalSr()&&motionUsesFlow(srMotion))||
(multiplier>1&&motionUsesFlow(fgMotion,frameGenerationBackend));
if(!flowUsed){active.flow=defaults.flow;active.opticalFlowBackend=defaults.opticalFlowBackend;active.amdFlowHalfResolution=defaults.amdFlowHalfResolution;}
diff --git a/include/veyra/ngx/DlssSrBackend.h b/include/veyra/ngx/DlssSrBackend.h
index 0b68d471..62ebc04b 100644
--- a/include/veyra/ngx/DlssSrBackend.h
+++ b/include/veyra/ngx/DlssSrBackend.h
@@ -35,6 +35,9 @@ public:
// 1 DLSS 4.5 second-generation transformer (preset M), 2 DLSS 4.5 Ultra
// Performance (preset L). Applied to every perf mode as a render preset hint.
uint32_t model = 0;
+ // DLAA: the feature runs at its own size (input == output) in the DLAA perf
+ // mode instead of the 1:1 bypass below.
+ bool nativeResolution = false;
};
struct EvalDesc {
@@ -68,16 +71,16 @@ public:
uint64_t createResult() const { return createResult_; }
uint64_t evaluateCount() const { return evaluateCount_; }
uint64_t bypassCount() const { return bypassCount_; }
- bool isBypass() const; // true when input == output extent
+ bool isBypass() const; // true when input == output extent (never for DLAA)
// 1:1 bypass: the entire SR backend is skipped (Playbook section 11).
// Checks BOTH dimensions to handle non-uniform extents correctly.
bool shouldBypass(uint32_t inW, uint32_t inH, uint32_t outW, uint32_t outH) const {
- return inW == outW && inH == outH;
+ return !nativeResolution_ && inW == outW && inH == outH;
}
// Convenience overload for width-only check (backward compat).
bool shouldBypass(uint32_t inputWidth, uint32_t outputWidth) const {
- return inputWidth == outputWidth;
+ return !nativeResolution_ && inputWidth == outputWidth;
}
private:
@@ -89,6 +92,7 @@ private:
uint32_t inputHeight_ = 0;
uint32_t outputWidth_ = 0;
uint32_t outputHeight_ = 0;
+ bool nativeResolution_ = false;
};
} // namespace veyra::ngx
diff --git a/include/veyra/pipeline/EnhanceGraph.h b/include/veyra/pipeline/EnhanceGraph.h
index ba031eeb..ebb0b3df 100644
--- a/include/veyra/pipeline/EnhanceGraph.h
+++ b/include/veyra/pipeline/EnhanceGraph.h
@@ -754,6 +754,11 @@ public:
// does not match the content domain). The engine surfaces this in the
// status panel so the refusal is visible, not only logged.
const std::wstring& colorLutNotice() const { return colorLutNotice_; }
+ // DLAA instances that pass the picture through instead (shown with the
+ // colour status, like a refused LUT), and how many DLAA evaluations ran.
+ const std::wstring& antiAliasNotice() const { return antiAliasNotice_; }
+ uint64_t dlaaEvaluateCount() const;
+ uint64_t dlaaMotionEvaluateCount() const;
// Beauty nodes: a problem that disables them (shown, never only logged), and the
// faces the shared tracker found a few frames ago (status only; the picture
// uses this frame's GPU result).
@@ -863,6 +868,7 @@ private:
ComPtr<ID3D12Resource> firstSrFlow_,secondSrFlow_;
UINT firstSrFlowSet()const{return 3+UINT(nrInstances_.size());}
UINT secondSrFlowSet()const{return 4+UINT(nrInstances_.size());}
+ UINT dlaaFlowSet(UINT index)const{return secondSrFlowSet()+1+index;}
ComPtr<ID3D12Resource> videoHdrInput_,videoHdrOutput_;
ComPtr<ID3D12Resource> residualRgba_,nrFlow_,baseFlow_;
ComPtr<ID3D12Resource> preSrProtectionRgba_;
@@ -982,6 +988,33 @@ private:
std::array<std::unique_ptr<AntiAliasPass>,engine::kMaxAntiAliasInstances> antiAliasPasses_{};
std::array<ComPtr<ID3D12Resource>,engine::kMaxAntiAliasInstances> antiAliasOutputs_{};
bool createAntiAlias(uint32_t parameter,uint32_t width,uint32_t height);
+ // DLAA instances (user request 2026-11-08), by the same parameter ordinal:
+ // DLSS SR created at the instance's own size in its DLAA mode. Motion is this
+ // frame's optical-flow field of that size (none: zero motion and a reset, so
+ // no history is reused); a copy where DLSS cannot run (still images, no NGX
+ // feature), and antiAliasNotice_ says so.
+ struct SignedHdrRestore { ComPtr<ID3D12Resource> raw; ComputePass pass; };
+ bool createSignedHdrRestore(SignedHdrRestore& restore,uint32_t width,uint32_t height);
+ void bindSignedHdrRestore(SignedHdrRestore& restore,ID3D12Resource* input,ID3D12Resource* output);
+ void finishTemporalOutput(ID3D12GraphicsCommandList* list,SignedHdrRestore& restore,ID3D12Resource* output);
+ struct DlaaInstance {
+ std::unique_ptr<ngx::DlssSrBackend> backend;
+ ComPtr<ID3D12Resource> zeroMotion,depth,adaptedMotion;
+ SignedHdrRestore hdr;
+ ID3D12Resource* input=nullptr;
+ uint32_t width=0,height=0;
+ bool copy=false,motionLogged=false;
+ uint64_t evaluations=0,motionless=0;
+ };
+ std::array<DlaaInstance,engine::kMaxAntiAliasInstances> dlaa_{};
+ std::wstring antiAliasNotice_;
+ // This frame's flow fields are written (the frame's haveFlow), for DLAA motion.
+ bool frameFlowValid_=false;
+ // An enabled DLAA instance that will run DLSS (not a still image, NVIDIA).
+ bool dlaaRequested() const;
+ // The source-size slot runs after the optical flow when it holds DLAA.
+ bool sourcePostAfterFlow() const;
+ bool dispatchDlaa(ID3D12GraphicsCommandList* list,const SlotPass& pass,bool reset);
// Beauty nodes by parameter ordinal, plus what they share: the face tracker,
// the faces buffer (a zero buffer when the detector is unavailable) and this
// frame's original - the picture before every effect node. Without a fused
@@ -1065,6 +1098,7 @@ private:
// Double SR first passes on DLSS SR / FSR (the final pass keeps the members above).
std::unique_ptr<ngx::DlssSrBackend> firstDlssSrBackend_;
std::unique_ptr<gfx::FsrSrBackend> firstFsrSrBackend_;
+ SignedHdrRestore srHdrRestore_,firstSrHdrRestore_;
// Constant far depth and zero motion for the temporal SR passes. The source
// extent for a single FSR pass; under double SR the largest render/motion
// extent of its DLSS SR / FSR passes (larger inputs are read in their subrect).
diff --git a/include/veyra/ui/QmlPlayerBridge.h b/include/veyra/ui/QmlPlayerBridge.h
index b13dc51c..b8753fa9 100644
--- a/include/veyra/ui/QmlPlayerBridge.h
+++ b/include/veyra/ui/QmlPlayerBridge.h
@@ -1326,9 +1326,10 @@ public:
Q_INVOKABLE void takeScreenshot();
// Recording: the 3 second countdown lives in the interface, the engine
// only opens the file when the request reaches it.
- Q_INVOKABLE void startRecording();
- Q_INVOKABLE void stopRecording();
- Q_INVOKABLE void toggleRecording();
+ // source names the trigger in the log ("shortcut", "pro-button", "game-hotkey").
+ Q_INVOKABLE void startRecording(const QString& source = QString());
+ Q_INVOKABLE void stopRecording(const QString& source = QString());
+ Q_INVOKABLE void toggleRecording(const QString& source = QString());
Q_INVOKABLE void chooseRecordingDirectory();
Q_INVOKABLE void openRecordingDirectory();
bool recording() const;
@@ -1462,6 +1463,8 @@ private:
void updateGameGeometry();
// Game mode's keyboard hook gets the current panel, exit, screenshot and record keys.
void applyGameHotkeys();
+ // DLAA anti-aliasing needs the DLSS SR runtime and adapter; false (with a notice) otherwise.
+ bool dlaaAllowed();
// 抖音直播伴侣 running (gfx/PresentationHooks.h): Realtime GPU priority is capped at
// High while it runs and restored when it exits; 监控软件兼容 "off" leaves it alone.
void updateLiveCompanionCompat();
diff --git a/qml/Veyra/AntiAliasEditor.qml b/qml/Veyra/AntiAliasEditor.qml
index e50414c4..a1bc112c 100644
--- a/qml/Veyra/AntiAliasEditor.qml
+++ b/qml/Veyra/AntiAliasEditor.qml
@@ -14,6 +14,9 @@ ColumnLayout {
readonly property int method: params.method ?? 1
readonly property int quality: params.quality ?? 2
readonly property int temporal: params.temporal ?? 0
+ // DLAA runs where DLSS SR does (same runtime and adapters).
+ readonly property var dlssCapability: (veyra.effectCapabilities || {}).sr0 || {}
+ readonly property bool dlaaAvailable: dlssCapability.available === true
readonly property var qualityChoices: method === 0
? [{id: "0", label: qsTr("中")}, {id: "1", label: qsTr("高")}, {id: "2", label: qsTr("极高")}]
: [{id: "0", label: qsTr("低")}, {id: "1", label: qsTr("中")}, {id: "2", label: qsTr("高")}, {id: "3", label: qsTr("极高")}]
@@ -27,17 +30,19 @@ ColumnLayout {
label: qsTr("方式")
hint: editor.method === 0 ? qsTr("FXAA:最快,整体略柔")
: editor.method === 1 ? qsTr("SMAA:边缘判断更准,细节保留更好")
+ : editor.method === 3 ? qsTr("DLAA:NVIDIA DLSS 在原分辨率运行,按光流跨帧重建边缘;用 DLSS SR 的模型,比其他方式更耗时。采集画面没有游戏那样的抖动采样,效果比游戏内 DLAA 弱")
: qsTr("MLAA:形态学抗锯齿,阈值与强度可调")
VSeg {
objectName: editor.namePrefix + "-method"
- options: [{id: "0", label: "FXAA"}, {id: "1", label: "SMAA"}, {id: "2", label: "MLAA"}]
+ options: [{id: "0", label: "FXAA"}, {id: "1", label: "SMAA"}, {id: "2", label: "MLAA"},
+ {id: "3", label: "DLAA", disabled: !editor.dlaaAvailable}]
current: String(editor.method)
onPicked: id => editor.edited("method", Number(id))
}
}
VRow {
label: qsTr("质量")
- visible: editor.method !== 2
+ visible: editor.method !== 2 && editor.method !== 3
VSeg {
objectName: editor.namePrefix + "-quality"
options: editor.qualityChoices
diff --git a/qml/Veyra/Main.qml b/qml/Veyra/Main.qml
index 17b2b156..855583a2 100644
--- a/qml/Veyra/Main.qml
+++ b/qml/Veyra/Main.qml
@@ -717,7 +717,7 @@ Window {
Shortcut { sequence: veyra.shortcuts.playPause; onActivated: veyra.togglePlayPause() }
Shortcut { sequence: veyra.shortcuts.fullscreen; onActivated: root.toggleFullscreen() }
Shortcut { sequence: veyra.shortcuts.screenshot; onActivated: veyra.takeScreenshot() }
- Shortcut { sequence: veyra.shortcuts.record; onActivated: veyra.toggleRecording() }
+ Shortcut { sequence: veyra.shortcuts.record; autoRepeat: false; onActivated: veyra.toggleRecording("shortcut") } // a held key must not toggle at the repeat rate
Shortcut {
sequence: veyra.shortcuts.toggleMode
enabled: dialogs.dialog === ""
diff --git a/qml/Veyra/ProPage.qml b/qml/Veyra/ProPage.qml
index 15a54c53..ac0ad4cf 100644
--- a/qml/Veyra/ProPage.qml
+++ b/qml/Veyra/ProPage.qml
@@ -385,7 +385,7 @@ VPage {
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: {
- if (veyra.recording) { veyra.stopRecording(); recordControl.countdown = 0; recordTick.stop(); return }
+ if (veyra.recording) { veyra.stopRecording("pro-button"); recordControl.countdown = 0; recordTick.stop(); return }
if (recordControl.countdown > 0) { recordControl.countdown = 0; recordTick.stop(); return }
recordControl.countdown = 3
recordTick.restart()
@@ -412,7 +412,7 @@ VPage {
if (recordControl.countdown <= 0) {
recordControl.countdown = 0
recordTick.stop()
- veyra.startRecording()
+ veyra.startRecording("pro-button")
}
}
}
diff --git a/qml/Veyra/SrStageEditor.qml b/qml/Veyra/SrStageEditor.qml
index 8eedad4d..852ac24d 100644
--- a/qml/Veyra/SrStageEditor.qml
+++ b/qml/Veyra/SrStageEditor.qml
@@ -89,7 +89,7 @@ ColumnLayout {
}
VRow {
label: qsTr("第二次超分算法")
- hint: qsTr("独立于基础超分,可以选任意一种超分;DLSS SR 两次共用上面的 DLSS 模型,FSR 不支持 HDR。")
+ hint: qsTr("独立于基础超分,可以选任意一种超分;DLSS SR 两次共用上面的 DLSS 模型。")
VSelect {
objectName: editor.namePrefix+"-dual-sr-algorithm"
implicitWidth: 210
diff --git a/shaders/DlaaHdrRestore.hlsl b/shaders/DlaaHdrRestore.hlsl
new file mode 100644
index 00000000..b00d3aa4
--- /dev/null
+++ b/shaders/DlaaHdrRestore.hlsl
@@ -0,0 +1,31 @@
+// DLAA in HDR (scRGB, linear BT.709, 1 = 80 nits): DLSS keeps colours inside
+// BT.709 only, so a colour outside it (a negative component) comes back clipped
+// to the gamut edge. The negative part of the input is added back to the DLSS
+// result: inside BT.709 (no negative component) positive output is DLSS's own, and a
+// flat out-of-709 area returns to its input value instead of a brighter,
+// desaturated one. FSR HDR uses the same pass with bilinear negative-component
+// reconstruction at the output size. This also avoids adding a negative twice
+// if a runtime begins returning signed colour rather than clipping it.
+Texture2D<float4> inputTex : register(t0); // the DLAA instance's input
+Texture2D<float4> dlaaTex : register(t1); // the DLSS output for it
+RWTexture2D<float4> outputTex : register(u0);
+
+[numthreads(16, 16, 1)]
+void main(uint3 id : SV_DispatchThreadID) {
+ uint w, h;
+ outputTex.GetDimensions(w, h);
+ if (id.x >= w || id.y >= h) return;
+ uint iw, ih;
+ inputTex.GetDimensions(iw, ih);
+ const float2 at = (float2(id.xy) + 0.5) * float2(iw, ih) / float2(w, h) - 0.5;
+ const int2 p = int2(floor(at));
+ const float2 f = frac(at);
+ const int2 hi = int2(iw, ih) - 1;
+ const float3 a = min(inputTex[clamp(p, int2(0, 0), hi)].rgb, 0.0);
+ const float3 b = min(inputTex[clamp(p + int2(1, 0), int2(0, 0), hi)].rgb, 0.0);
+ const float3 c = min(inputTex[clamp(p + int2(0, 1), int2(0, 0), hi)].rgb, 0.0);
+ const float3 e = min(inputTex[clamp(p + int2(1, 1), int2(0, 0), hi)].rgb, 0.0);
+ const float3 negative = lerp(lerp(a, b, f.x), lerp(c, e, f.x), f.y);
+ const float4 d = dlaaTex[id.xy];
+ outputTex[id.xy] = float4(max(d.rgb, 0.0) + negative, d.a);
+}
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index bd8c712c..3e8a8185 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -2895,6 +2895,7 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
// A rejected LUT input space must be visible, not only logged
// (plan v5.2: never apply a mismatched LUT silently).
if(!graph->colorLutNotice().empty())snapshot_.colorStatus+=L";"+graph->colorLutNotice();
+ if(!graph->antiAliasNotice().empty())snapshot_.colorStatus+=L";"+graph->antiAliasNotice();
const auto speedNow=Clock::now();
if(playbackSpeedLastWall==Clock::time_point()||pts+0.5<playbackSpeedLastPts){playbackSpeedLastPts=pts;playbackSpeedLastWall=speedNow;}
else if(std::chrono::duration<double>(speedNow-playbackSpeedLastWall).count()>=0.9){
diff --git a/src/engine/PresetLibrary.cpp b/src/engine/PresetLibrary.cpp
index 90ff5a07..429b256e 100644
--- a/src/engine/PresetLibrary.cpp
+++ b/src/engine/PresetLibrary.cpp
@@ -98,6 +98,7 @@ void PresetLibrary::addBuiltins() {
bool PresetLibrary::load() {
error_.clear();
addBuiltins();
+ const auto directDlaa=std::filesystem::path(path_).concat(L".dlaa");
const auto directAnySr=std::filesystem::path(path_).concat(L".dual-sr-any");
const auto directVideoAi=std::filesystem::path(path_).concat(L".video-ai");
const auto directDual=std::filesystem::path(path_).concat(L".dual-sr");
@@ -151,6 +152,9 @@ bool PresetLibrary::load() {
// DLSS SR / FSR as the second double SR pass (library v19, session v14).
const auto anySrPath=std::filesystem::path(path_).concat(L".dual-sr-any");
if(std::filesystem::exists(directAnySr))path_=directAnySr;else if(std::filesystem::exists(anySrPath))path_=anySrPath;
+ // DLAA anti-aliasing nodes (library v20, session v15).
+ const auto dlaaPath=std::filesystem::path(path_).concat(L".dlaa");
+ if(std::filesystem::exists(directDlaa))path_=directDlaa;else if(std::filesystem::exists(dlaaPath))path_=dlaaPath;
if (!std::filesystem::exists(path_)) return true;
std::error_code ec;
const auto size = std::filesystem::file_size(path_, ec);
@@ -247,6 +251,8 @@ bool PresetLibrary::save() {
// Opting into a new model must leave the older build's library intact.
// v14 (anti-aliasing nodes, chains past 16 nodes) and v15 (beauty nodes) get their own files too.
// v16 (three-step SR) as well.
+ if(data.starts_with("VEYRA_PRESET_LIBRARY 20")&&!path_.wstring().ends_with(L".dlaa"))path_=std::filesystem::path(path_).concat(L".dlaa");
+ if(!path_.wstring().ends_with(L".dlaa")){
if(data.starts_with("VEYRA_PRESET_LIBRARY 19")&&!path_.wstring().ends_with(L".dual-sr-any"))path_=std::filesystem::path(path_).concat(L".dual-sr-any");
if(!path_.wstring().ends_with(L".dual-sr-any")){
if(data.starts_with("VEYRA_PRESET_LIBRARY 18")&&!path_.wstring().ends_with(L".video-ai"))path_=std::filesystem::path(path_).concat(L".video-ai");
@@ -286,6 +292,7 @@ bool PresetLibrary::save() {
}
}
}
+ }
std::error_code ec;
std::filesystem::create_directories(path_.parent_path(), ec);
const auto temporary = std::filesystem::path(path_).concat(L".tmp");
@@ -751,7 +758,15 @@ std::string PresetLibrary::encodeEntries(const std::vector<PresetEntry>& entries
// reject a second value outside RTX Video SR, so it has its own version and file.
const auto anySrOf=[](const ChainGlobalSettings& g){return !rtxVideoSr(g.dualSrQuality);};
const bool anySr=std::any_of(entries_.begin(),entries_.end(),[&](const auto& e){return (e.globals&&anySrOf(*e.globals))||(e.nodeConfiguration&&(anySrOf(*e.nodeConfiguration)||(e.nodeConfiguration->editor&&e.nodeConfiguration->editor->globals&&anySrOf(*e.nodeConfiguration->editor->globals))));});
- const int version=std::max(minimumVersion, anySr?19:videoAi?18:dual?17:srStage?16:beauty?15:effects?14:nrModel?13:dlss?12:tuning?11:flow?10:correctionExtended?9:correction?8:vfg?7:rendering?6:globals?5:editor?4:layerSizes?3:multi?2:1);
+ // DLAA anti-aliasing nodes (2026-11-08): readers up to v19 / session v14 refuse
+ // method 3, so a library holding one has its own version and file.
+ const auto dlaaChain=[](const EffectChain& chain){
+ return std::any_of(chain.nodes.begin(),chain.nodes.begin()+chain.nodeCount,[](const auto& n){
+ return n.type==EffectType::AntiAliasing&&n.aa.method==AntiAliasMethod::Dlaa;});};
+ const bool dlaa=std::any_of(entries_.begin(),entries_.end(),[&](const auto& e){
+ return dlaaChain(e.chain)||(e.nodeConfiguration&&(dlaaChain(e.nodeConfiguration->chain)||
+ (e.nodeConfiguration->editor&&dlaaChain(e.nodeConfiguration->editor->nodes))));});
+ const int version=std::max(minimumVersion, dlaa?20:anySr?19:videoAi?18:dual?17:srStage?16:beauty?15:effects?14:nrModel?13:dlss?12:tuning?11:flow?10:correctionExtended?9:correction?8:vfg?7:rendering?6:globals?5:editor?4:layerSizes?3:multi?2:1);
o << "VEYRA_PRESET_LIBRARY " << version << '\n' << std::quoted(utf8(defaultName_)) << ' ' << entries_.size() << '\n';
for (const auto& e : entries_) {
o << std::quoted(utf8(e.name)) << ' ' << std::quoted(utf8(e.note)) << ' '
@@ -825,7 +840,7 @@ bool PresetLibrary::parse(const std::string& data, std::vector<PresetEntry>& out
std::string magic, quoted;
int version = 0;
size_t count = 0;
- const int allowedVersion=maxVersion>0?std::min(maxVersion,19):19;
+ const int allowedVersion=maxVersion>0?std::min(maxVersion,20):20;
if (!(in >> magic >> version) || magic != "VEYRA_PRESET_LIBRARY" || version < 1 || version > allowedVersion) { error = L"预设库格式或版本不支持"; return false; }
if (!(in >> std::quoted(quoted) >> count) || count > 64) { error = L"预设库条目数非法"; return false; }
def = wide(quoted);
@@ -898,6 +913,10 @@ bool PresetLibrary::parse(const std::string& data, std::vector<PresetEntry>& out
if (version >= 14 && node.type == EffectType::AntiAliasing && !readAntiAlias(in, node.aa)) {
error = L"预设库节点抗锯齿参数损坏"; return false;
}
+ // DLAA exists from v20 on: an older header cannot carry it.
+ if (version < 20 && node.type == EffectType::AntiAliasing && node.aa.usesDlaa()) {
+ error = L"预设库版本不支持 DLAA 抗锯齿"; return false;
+ }
if (version >= 15 && node.type == EffectType::Beauty && !readBeauty(in, node.beauty)) {
error = L"预设库节点美颜参数损坏"; return false;
}
@@ -999,7 +1018,14 @@ std::string ChainSessionStore::encode(const ChainSession& session) {
const bool videoAi=std::any_of(session.configurations.begin(),session.configurations.end(),[&](const auto& c){return videoAiOf(c)||(c.editor&&c.editor->globals&&videoAiOf(*c.editor->globals));});
const auto anySrOf=[](const ChainGlobalSettings& g){return !rtxVideoSr(g.dualSrQuality);};
const bool anySr=std::any_of(session.configurations.begin(),session.configurations.end(),[&](const auto& c){return anySrOf(c)||(c.editor&&c.editor->globals&&anySrOf(*c.editor->globals));});
- const int version = anySr?14:videoAi?13:dual?12:srStage?11:beauty?10:effects?9:nrModel?8:dlss?7:tuning?6:vfg?5:rendering?4:editor ? (editor->globals ? 3 : 2) : 1;
+ // DLAA anti-aliasing nodes (2026-11-08): readers up to v19 / session v14 refuse
+ // method 3, so a library holding one has its own version and file.
+ const auto dlaaChain=[](const EffectChain& chain){
+ return std::any_of(chain.nodes.begin(),chain.nodes.begin()+chain.nodeCount,[](const auto& n){
+ return n.type==EffectType::AntiAliasing&&n.aa.method==AntiAliasMethod::Dlaa;});};
+ const bool dlaa=std::any_of(session.configurations.begin(),session.configurations.end(),[&](const auto& c){
+ return dlaaChain(c.chain)||(c.editor&&dlaaChain(c.editor->nodes));});
+ const int version = dlaa?15:anySr?14:videoAi?13:dual?12:srStage?11:beauty?10:effects?9:nrModel?8:dlss?7:tuning?6:vfg?5:rendering?4:editor ? (editor->globals ? 3 : 2) : 1;
out << "VEYRA_CHAIN_SESSION " << version << '\n' << int(session.active) << ' ' << session.initialized[0] << ' ' << session.initialized[1];
if(version>=4)out<<' '<<bool(editor);out<<'\n';
std::vector<PresetEntry> entries;
@@ -1053,7 +1079,7 @@ bool ChainSessionStore::decode(const std::string& data, ChainSession& session, b
std::istringstream in(data); in.imbue(std::locale::classic());
std::string magic, body; int version = 0, active = 0, list = 0, node = 0;
if (!(in >> magic >> version >> active >> list >> node) || magic != "VEYRA_CHAIN_SESSION" ||
- (version < 1 || version > 14) || active < 0 || active > 1 || list != 1 || node < 0 || node > 1) return false;
+ (version < 1 || version > 15) || active < 0 || active > 1 || list != 1 || node < 0 || node > 1) return false;
int hasEditor=version>=2?1:0;
if(version>=4&&(!(in>>hasEditor)||hasEditor<0||hasEditor>1))return false;
ChainSession parsed; parsed.active = ChainMode(active); parsed.initialized = {true, node != 0};
@@ -1068,7 +1094,7 @@ bool ChainSessionStore::decode(const std::string& data, ChainSession& session, b
}
if (!(in >> std::quoted(body))) return false;
std::vector<PresetEntry> entries; std::wstring def, error;
- if (!PresetLibrary::parse(body, entries, def, error, nullptr, true, version>=13?18:version>=10?15:version>=9?14:version>=8?13:11) || entries.size() != 2 || !def.empty()) return false;
+ if (!PresetLibrary::parse(body, entries, def, error, nullptr, true, version>=15?20:version>=13?18:version>=10?15:version>=9?14:version>=8?13:11) || entries.size() != 2 || !def.empty()) return false;
for (size_t i = 0; i < entries.size(); ++i) {
if (entries[i].kind != ChainMode(i)) return false;
parsed.configurations[i].chain = entries[i].chain;
@@ -1102,7 +1128,7 @@ bool ChainSessionStore::decode(const std::string& data, ChainSession& session, b
}
if (!(in >> std::quoted(body))) return false;
entries.clear(); def.clear(); error.clear();
- if (!PresetLibrary::parse(body, entries, def, error, nullptr, true, version>=13?18:version>=10?15:version>=9?14:version>=8?13:11) || entries.size() != 1 ||
+ if (!PresetLibrary::parse(body, entries, def, error, nullptr, true, version>=15?20:version>=13?18:version>=10?15:version>=9?14:version>=8?13:11) || entries.size() != 1 ||
!def.empty() || entries[0].kind != ChainMode::Node || entries[0].chain.nodeCount != count) return false;
editor->nodes = std::move(entries[0].chain);
for (uint32_t i = 0; i < count; ++i) {
@@ -1119,6 +1145,7 @@ bool ChainSessionStore::decode(const std::string& data, ChainSession& session, b
}
bool ChainSessionStore::load(ChainSession& session) {
+ const auto directDlaa=std::filesystem::path(path_).concat(L".dlaa");
const auto directAnySr=std::filesystem::path(path_).concat(L".dual-sr-any");
const auto directVideoAi=std::filesystem::path(path_).concat(L".video-ai");
const auto directDual=std::filesystem::path(path_).concat(L".dual-sr");
@@ -1170,6 +1197,9 @@ bool ChainSessionStore::load(ChainSession& session) {
// DLSS SR / FSR as the second double SR pass (library v19, session v14).
const auto anySrPath=std::filesystem::path(path_).concat(L".dual-sr-any");
if(std::filesystem::exists(directAnySr))path_=directAnySr;else if(std::filesystem::exists(anySrPath))path_=anySrPath;
+ // DLAA anti-aliasing nodes (library v20, session v15).
+ const auto dlaaPath=std::filesystem::path(path_).concat(L".dlaa");
+ if(std::filesystem::exists(directDlaa))path_=directDlaa;else if(std::filesystem::exists(dlaaPath))path_=dlaaPath;
const bool exists = std::filesystem::exists(path_, ec);
if (!exists && !ec) return true;
const auto size = std::filesystem::file_size(path_, ec);
@@ -1199,6 +1229,8 @@ bool ChainSessionStore::save(const ChainSession& session) {
const auto data = encode(session);
ChainSession checked;
if (!decode(data, checked)) { error_ = L"模式会话编码校验失败,未保存"; return false; }
+ if(data.starts_with("VEYRA_CHAIN_SESSION 15")&&!path_.wstring().ends_with(L".dlaa"))path_=std::filesystem::path(path_).concat(L".dlaa");
+ if(!path_.wstring().ends_with(L".dlaa")){
if(data.starts_with("VEYRA_CHAIN_SESSION 14")&&!path_.wstring().ends_with(L".dual-sr-any"))path_=std::filesystem::path(path_).concat(L".dual-sr-any");
if(!path_.wstring().ends_with(L".dual-sr-any")){
if(data.starts_with("VEYRA_CHAIN_SESSION 13")&&!path_.wstring().ends_with(L".video-ai"))path_=std::filesystem::path(path_).concat(L".video-ai");
@@ -1238,6 +1270,7 @@ bool ChainSessionStore::save(const ChainSession& session) {
}
}
}
+ }
std::error_code ec;
if (!path_.parent_path().empty()) std::filesystem::create_directories(path_.parent_path(), ec);
if (ec) { error_ = L"模式会话目录无法创建"; return false; }
diff --git a/src/ngx/DlssSrBackend.cpp b/src/ngx/DlssSrBackend.cpp
index 289765bb..2086587e 100644
--- a/src/ngx/DlssSrBackend.cpp
+++ b/src/ngx/DlssSrBackend.cpp
@@ -90,6 +90,13 @@ bool DlssSrBackend::create(NgxCoreHost& coreHost,
inputHeight_ = desc.inputHeight;
outputWidth_ = desc.outputWidth;
outputHeight_ = desc.outputHeight;
+ nativeResolution_ = desc.nativeResolution;
+ if (nativeResolution_ && (desc.inputWidth != desc.outputWidth || desc.inputHeight != desc.outputHeight)) {
+ log::error("ngx", std::format("sr-backend: DLAA needs input == output, got {}x{} -> {}x{}",
+ desc.inputWidth, desc.inputHeight, desc.outputWidth, desc.outputHeight));
+ status = Status::InvalidArgument;
+ return false;
+ }
// 1:1 bypass: never create SR for same-resolution (Playbook section 11).
// Check BOTH dimensions for non-uniform extent correctness.
@@ -104,7 +111,8 @@ bool DlssSrBackend::create(NgxCoreHost& coreHost,
createParams.Feature.InHeight = desc.inputHeight;
createParams.Feature.InTargetWidth = desc.outputWidth;
createParams.Feature.InTargetHeight = desc.outputHeight;
- createParams.Feature.InPerfQualityValue = static_cast<NVSDK_NGX_PerfQuality_Value>(desc.perfQuality);
+ createParams.Feature.InPerfQualityValue = nativeResolution_ ? NVSDK_NGX_PerfQuality_Value_DLAA
+ : static_cast<NVSDK_NGX_PerfQuality_Value>(desc.perfQuality);
// Linear RGBA16F requires IsHDR even for SDR media (NGX guide 3.1).
// Video has no renderer exposure texture; use the documented GPU estimator.
createParams.InFeatureCreateFlags = NVSDK_NGX_DLSS_Feature_Flags_IsHDR |
@@ -130,8 +138,8 @@ bool DlssSrBackend::create(NgxCoreHost& coreHost,
params, &createParams, sehCode);
createResult_ = static_cast<uint64_t>(result);
- log::info("ngx", std::format("sr-backend: Create DLSS {}x{} -> {}x{} result={} handle={} seh={}",
- desc.inputWidth, desc.inputHeight, desc.outputWidth, desc.outputHeight,
+ log::info("ngx", std::format("sr-backend: Create DLSS {}x{} -> {}x{}{} result={} handle={} seh={}",
+ desc.inputWidth, desc.inputHeight, desc.outputWidth, desc.outputHeight, nativeResolution_ ? " DLAA" : "",
ngxResultString(createResult_), handle_ != nullptr ? "non-null" : "null", sehCode));
if (result != NVSDK_NGX_Result_Success) {
diff --git a/src/pipeline/EnhanceGraph.cpp b/src/pipeline/EnhanceGraph.cpp
index c7eec6e5..199e1c1d 100644
--- a/src/pipeline/EnhanceGraph.cpp
+++ b/src/pipeline/EnhanceGraph.cpp
@@ -450,6 +450,30 @@ bool EnhanceGraph::createNodeColorResources(){
}
bool EnhanceGraph::createAntiAlias(uint32_t parameter,uint32_t width,uint32_t height){
+ if(desc_.antiAlias[parameter].usesDlaa()){
+ // DLAA: the output and constant zero motion / depth at this size; the DLSS
+ // feature is created with the NGX features (initNgxFeatures).
+ auto& d=dlaa_[parameter];d={};d.width=width;d.height=height;
+ antiAliasOutputs_[parameter]=makeTexture(context_.device(),width,height,DXGI_FORMAT_R16G16B16A16_FLOAT,true);
+ // DLSS is temporal and NVIDIA RTX only: a still image or another adapter
+ // passes the picture through, and the status says why.
+ const wchar_t* why=desc_.stillImage?L"图片不支持 DLAA":!context_.adapter().isNvidia?L"需要 NVIDIA RTX 显卡":
+ (desc_.noFeatures||desc_.noNgx)?L"增强功能已关闭":nullptr;
+ if(why){d.copy=true;antiAliasNotice_+=std::format(L"抗锯齿实例 {} DLAA 未运行({}),画面原样通过。",parameter+1,why);}
+ bool created=antiAliasOutputs_[parameter]!=nullptr;
+ if(created&&!d.copy){
+ d.zeroMotion=makeTexture(context_.device(),width,height,DXGI_FORMAT_R16G16_FLOAT,false);
+ d.depth=makeTexture(context_.device(),width,height,DXGI_FORMAT_R32_FLOAT,false);
+ const bool sharedMotion=(width==nvofW_&&height==nvofH_)||
+ (baseFlow_&&width==workW_&&height==workH_)||(nrFlow_&&width==nrW_&&height==nrH_);
+ if(!sharedMotion)d.adaptedMotion=makeTexture(context_.device(),width,height,DXGI_FORMAT_R16G16_FLOAT,true);
+ created=d.zeroMotion&&d.depth&&(sharedMotion||d.adaptedMotion)&&
+ (!desc_.hdrWorking()||createSignedHdrRestore(d.hdr,width,height));
+ }
+ veyra::log::info("anti-alias",std::format("instance={} DLAA extent={}x{} hdr={} mode={}{}",parameter,width,height,desc_.hdrWorking(),
+ d.copy?"copy":"dlss",created?"":" (texture creation failed)"));
+ return created;
+ }
auto& pass=antiAliasPasses_[parameter];
pass=std::make_unique<AntiAliasPass>();
antiAliasOutputs_[parameter]=makeTexture(context_.device(),width,height,DXGI_FORMAT_R16G16B16A16_FLOAT,true);
@@ -459,6 +483,93 @@ bool EnhanceGraph::createAntiAlias(uint32_t parameter,uint32_t width,uint32_t he
return created;
}
+bool EnhanceGraph::dlaaRequested() const {
+ return std::any_of(dlaa_.begin(),dlaa_.end(),[](const DlaaInstance& d){return d.width&&!d.copy;});
+}
+bool EnhanceGraph::sourcePostAfterFlow() const {
+ return std::any_of(sourcePostPasses_.begin(),sourcePostPasses_.end(),[this](const SlotPass& p){
+ return p.type==engine::EffectType::AntiAliasing&&dlaa_[p.parameter].width&&!dlaa_[p.parameter].copy;});
+}
+uint64_t EnhanceGraph::dlaaEvaluateCount() const {
+ uint64_t n=0;for(const auto& d:dlaa_)n+=d.evaluations;return n;
+}
+uint64_t EnhanceGraph::dlaaMotionEvaluateCount() const {
+ uint64_t n=0;
+ for(const auto& d:dlaa_)n+=d.evaluations-std::min(d.evaluations,d.motionless);
+ return n;
+}
+bool EnhanceGraph::createSignedHdrRestore(SignedHdrRestore& restore,uint32_t width,uint32_t height){
+ std::vector<uint8_t> shader;
+ restore.raw=makeTexture(context_.device(),width,height,DXGI_FORMAT_R16G16B16A16_FLOAT,true);
+ return restore.raw&&restore.pass.loadShader("DlaaHdrRestore.dxil",shader)&&
+ restore.pass.create(context_.device(),shader,3,2,1);
+}
+void EnhanceGraph::bindSignedHdrRestore(SignedHdrRestore& restore,ID3D12Resource* input,ID3D12Resource* output){
+ if(!restore.raw)return;
+ stager_.stageSrv(input,nullptr,restore.pass.heap.Get(),0);
+ stager_.stageSrv(restore.raw.Get(),nullptr,restore.pass.heap.Get(),1);
+ makeUav(context_.device(),output,DXGI_FORMAT_R16G16B16A16_FLOAT,cpuHandleOf(restore.pass,2));
+}
+void EnhanceGraph::finishTemporalOutput(ID3D12GraphicsCommandList* list,SignedHdrRestore& restore,ID3D12Resource* output){
+ if(restore.raw){
+ tracker_.uavBarrier(list,restore.raw.Get());
+ tracker_.transition(list,restore.raw.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+ tracker_.transition(list,output,D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+ const float constants[8]{};
+ restore.pass.bind(list,constants,gpuHandleOf(restore.pass,0).ptr,gpuHandleOf(restore.pass,2).ptr);
+ const auto extent=output->GetDesc();
+ list->Dispatch((UINT(extent.Width)+15)/16,(extent.Height+15)/16,1);
+ }
+ tracker_.uavBarrier(list,output);
+ tracker_.transition(list,output,D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+}
+// One DLAA instance: DLSS at the instance's size, or a copy where it cannot run.
+// Motion is this frame's flow field of the same size (the optical flow itself, or
+// its adaptation to the work / NR size); without one the frame is evaluated with
+// zero motion and a reset, so no earlier frame is blended in at a wrong place.
+bool EnhanceGraph::dispatchDlaa(ID3D12GraphicsCommandList* list,const SlotPass& pass,bool reset){
+ auto& d=dlaa_[pass.parameter];
+ if(!d.input||!pass.output)return false;
+ if(d.copy||!d.backend||!d.backend->created()){
+ tracker_.transition(list,d.input,D3D12_RESOURCE_STATE_COPY_SOURCE);
+ tracker_.transition(list,pass.output,D3D12_RESOURCE_STATE_COPY_DEST);
+ list->CopyResource(pass.output,d.input);
+ tracker_.transition(list,d.input,D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+ tracker_.transition(list,pass.output,D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+ return true;
+ }
+ ID3D12Resource* motion=nullptr;const char* field="none";
+ if(frameFlowValid_){
+ if(flowTex_&&d.width==nvofW_&&d.height==nvofH_){motion=flowTex_.Get();field="optical flow";}
+ else if(baseFlow_&&d.width==workW_&&d.height==workH_){motion=baseFlow_.Get();field="work-size flow";}
+ else if(nrFlow_&&d.width==nrW_&&d.height==nrH_){motion=nrFlow_.Get();field="NR-size flow";}
+ else if(d.adaptedMotion){motion=d.adaptedMotion.Get();field="DLAA-size flow";}
+ }
+ const bool motionValid=motion!=nullptr;
+ if(!motionValid){motion=d.zeroMotion.Get();++d.motionless;}
+ if(!d.motionLogged&&frameFlowValid_){
+ d.motionLogged=true;
+ veyra::log::info("anti-alias",std::format("instance={} DLAA motion={} extent={}x{} flow={}x{}",pass.parameter,field,d.width,d.height,nvofW_,nvofH_));
+ }
+ tracker_.transition(list,d.input,D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+ tracker_.transition(list,motion,D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+ tracker_.transition(list,d.depth.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+ auto* target=d.hdr.raw?d.hdr.raw.Get():pass.output;
+ tracker_.transition(list,target,D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+ ngx::DlssSrBackend::EvalDesc ed{};
+ ed.color=d.input;ed.output=target;ed.depth=d.depth.Get();ed.motionVectors=motion;
+ ed.reset=reset||!motionValid;
+ Status st=Status::Ok;
+ if(!d.backend->evaluate(list,ngxParams_,ed,st)){
+ failedBackend_=engine::FailedBackend::Dlaa;
+ veyra::log::error("anti-alias",std::format("instance={} DLAA evaluate failed",pass.parameter));
+ return false;
+ }
+ ++d.evaluations;
+ finishTemporalOutput(list,d.hdr,pass.output);
+ return true;
+}
+
bool EnhanceGraph::createBeauty(uint32_t parameter,uint32_t width,uint32_t height){
auto& pass=beautyPasses_[parameter];
pass=std::make_unique<BeautyPass>();
@@ -512,7 +623,14 @@ bool EnhanceGraph::createBeautyShared(){
void EnhanceGraph::bindSlotPassInput(const SlotPass& pass,ID3D12Resource* input){
if(pass.type==engine::EffectType::Color)nodeColorInstances_[pass.parameter]->createViews(context_.device(),stager_,input,pass.output);
- else if(pass.type==engine::EffectType::AntiAliasing)antiAliasPasses_[pass.parameter]->createViews(context_.device(),stager_,input,pass.output);
+ else if(pass.type==engine::EffectType::AntiAliasing){
+ auto& d=dlaa_[pass.parameter];
+ if(d.width){
+ d.input=input; // NGX takes resources; only the HDR restore needs views
+ bindSignedHdrRestore(d.hdr,input,pass.output);
+ }
+ else antiAliasPasses_[pass.parameter]->createViews(context_.device(),stager_,input,pass.output);
+ }
else if(pass.type==engine::EffectType::Beauty)
beautyPasses_[pass.parameter]->createViews(context_.device(),stager_,input,pass.output,beautyOriginalSource_,beautyFaces(),beautyShapes());
}
@@ -536,7 +654,8 @@ bool EnhanceGraph::dispatchSlotPasses(ID3D12GraphicsCommandList* list,const std:
gpuTimer_.mark(list,diagnostics::colorNodeStage(pass.parameter),true);
}else if(pass.type==engine::EffectType::AntiAliasing){
gpuTimer_.mark(list,diagnostics::aaNodeStage(pass.parameter));
- if(!antiAliasPasses_[pass.parameter]->dispatch(list,tracker_,desc_.hdrWorking(),reset))return false;
+ if(dlaa_[pass.parameter].width){if(!dispatchDlaa(list,pass,reset))return false;}
+ else if(!antiAliasPasses_[pass.parameter]->dispatch(list,tracker_,desc_.hdrWorking(),reset))return false;
gpuTimer_.mark(list,diagnostics::aaNodeStage(pass.parameter),true);
}else if(pass.type==engine::EffectType::Beauty){
gpuTimer_.mark(list,diagnostics::beautyNodeStage(pass.parameter));
@@ -709,7 +828,20 @@ bool EnhanceGraph::initialize(const EnhanceGraphDesc& desc)
const bool vfxFirst=srEnabled_&&vfxFirstSrPass(desc_);
const uint64_t vfxSrBytes=(vfxFinal?uint64_t(srInW_)*srInH_*4u+uint64_t(srOutW_)*srOutH_*4u:0)+
(vfxFirst?uint64_t(srcW_)*srcH_*4u+uint64_t(desc_.firstSrWidth)*desc_.firstSrHeight*4u:0);
- const uint64_t estimate=vfxSrBytes+dualBytes+supersampleBytes+uint64_t(workW_)*workH_*(76u+4u*generatedTextures)+vfgSharedBytes
+ // A bypass still needs its output, but owns neither guidance nor a model.
+ unsigned dlaaInstances=0, dlaaCopies=0;
+ const bool canRunDlaa=context_.adapter().isNvidia&&!desc_.stillImage&&!desc_.noFeatures&&!desc_.noNgx;
+ for(const auto& aa:desc_.antiAlias){
+ if(!aa.enabled||!aa.usesDlaa())continue;
+ if(canRunDlaa)++dlaaInstances;else ++dlaaCopies;
+ }
+ const uint64_t dlaaPixels=uint64_t(std::max(workW_,srcW_))*std::max(workH_,srcH_);
+ // Output, depth, zero/optional adapted motion, and raw HDR output.
+ const uint64_t dlaaBytes=dlaaPixels*(dlaaCopies*8u+dlaaInstances*(desc_.hdrWorking()?28u:20u));
+ const uint64_t temporalHdrBytes=desc_.hdrWorking()&&srEnabled_?
+ (temporalSrQuality(desc_.finalSrQuality())?uint64_t(workW_)*workH_*8u:0)+
+ ((desc_.firstSrRuns(0)||desc_.firstSrRuns(engine::kVideoSrFsr))?uint64_t(desc_.firstSrWidth)*desc_.firstSrHeight*8u:0):0;
+ const uint64_t estimate=temporalHdrBytes+dlaaBytes+vfxSrBytes+dualBytes+supersampleBytes+uint64_t(workW_)*workH_*(76u+4u*generatedTextures)+vfgSharedBytes
+nrTextureBytes+fullLayerBytes
+uint64_t(srcW_)*srcH_*(32u+(desc_.protectionBeforeSr()?8u:0u))+temporalBytes+tailColorBytes+interProtectionBytes
+(flowRefine_?uint64_t(nvofW_)*nvofH_*(flowConsistency_?13u:flowClaims_?18u:12u)+uint64_t(workW_)*workH_*4u:0);
@@ -727,8 +859,9 @@ bool EnhanceGraph::initialize(const EnhanceGraphDesc& desc)
const unsigned temporalModels=srEnabled_?unsigned(temporalSrQuality(finalVideoSrQuality(desc_)))+
unsigned(desc_.firstSrRuns(0))+unsigned(desc_.firstSrRuns(engine::kVideoSrFsr)):0u;
const uint64_t srModels=std::max(1u,unsigned(vfxFinal)+unsigned(vfxFirst)+unsigned(srEnabled_&&ngxVideoSrPass(desc_))+temporalModels);
- const uint64_t sdkReserve=stagedSr?((nrEnabled_?(1024ull<<20):0)+
+ const uint64_t stagedReserve=stagedSr?((nrEnabled_?(1024ull<<20):0)+
(vfg?uint64_t(workW_)*workH_*128u:0)+srModels*(256ull<<20)):0;
+ const uint64_t sdkReserve=stagedReserve+dlaaInstances*(256ull<<20);
const uint64_t required=estimate+sdkReserve;
const uint64_t available=budget>usage?budget-usage:0;
veyra::log::info("memory",std::format("admission textures={}MiB sdkReserve={}MiB available={}MiB headroom={}%",estimate>>20,sdkReserve>>20,available>>20,stagedSr?20:0));
@@ -757,6 +890,12 @@ bool EnhanceGraph::initialize(const EnhanceGraphDesc& desc)
}
if (!initNgxFeatures()) return false;
failedBackend_=engine::FailedBackend::Infrastructure;
+ if(desc_.hdrWorking()){
+ const bool finalTemporal=fsrSrBackend_||(srBackend_&&srBackend_->created());
+ const bool firstTemporal=firstFsrSrBackend_||(firstDlssSrBackend_&&firstDlssSrBackend_->created());
+ if(finalTemporal&&!createSignedHdrRestore(srHdrRestore_,workW_,workH_))return false;
+ if(firstTemporal&&!createSignedHdrRestore(firstSrHdrRestore_,desc_.firstSrWidth,desc_.firstSrHeight))return false;
+ }
if (!createComputePasses()) return false;
initialized_ = true;
@@ -1055,6 +1194,28 @@ bool EnhanceGraph::initZeroAndDepthTextures()
uploadTex(depthTex_.Get(), upDepth_, DXGI_FORMAT_R32_FLOAT);
uploadTex(nrZeroDepth_.Get(), upZeroDepth_, DXGI_FORMAT_R32_FLOAT);
uploadTex(nrZeroMotion_.Get(), upZeroMotion_, DXGI_FORMAT_R16G16_FLOAT);
+ // These are separate native-size resources, not aliases of NR guidance.
+ // Keep uploads alive through the existing one-time initialization fence.
+ std::vector<ComPtr<ID3D12Resource>> dlaaUploads;
+ for(const auto& instance:dlaa_){
+ if(!instance.width||instance.copy)continue;
+ const size_t pitch=(size_t(instance.width)*4+255)&~size_t(255);
+ for(bool depth:{false,true}){
+ auto upload=makeUploadBuffer(context_.device(),pitch*instance.height);
+ void* bytes=nullptr;
+ if(!upload||FAILED(upload->Map(0,nullptr,&bytes))||!bytes)return false;
+ std::memset(bytes,0,pitch*instance.height);
+ if(depth)for(uint32_t y=0;y<instance.height;++y){
+ auto* row=reinterpret_cast<float*>(static_cast<uint8_t*>(bytes)+y*pitch);
+ std::fill_n(row,instance.width,0.9f);
+ }
+ upload->Unmap(0,nullptr);
+ uploadTex(depth?instance.depth.Get():instance.zeroMotion.Get(),upload,
+ depth?DXGI_FORMAT_R32_FLOAT:DXGI_FORMAT_R16G16_FLOAT,instance.width,instance.height,pitch);
+ dlaaUploads.push_back(std::move(upload));
+ }
+ veyra::log::info("anti-alias",std::format("DLAA guidance initialized extent={}x{} depth=0.9 motion=0",instance.width,instance.height));
+ }
if(fsrSrZeroMotion_){void* data=nullptr;D3D12_RANGE read{0,0};if(FAILED(upFsrSrZeroMotion_->Map(0,&read,&data))||!data)return false;std::memset(data,0,fsrSrDepthPitch_*fsrAuxH_);upFsrSrZeroMotion_->Unmap(0,nullptr);uploadTex(fsrSrZeroMotion_.Get(),upFsrSrZeroMotion_,DXGI_FORMAT_R16G16_FLOAT,fsrAuxW_,fsrAuxH_,fsrSrDepthPitch_);}
if(fsrSrDepth_!=nullptr&&upFsrSrDepth_!=nullptr){
D3D12_RESOURCE_BARRIER b{};
@@ -1093,7 +1254,8 @@ bool EnhanceGraph::initNvof()
// Keep the zero-motion and VFG paths free of an unused optical-flow session.
const bool inGraphFgFlow=fgEnabled_&&desc_.fgUsesFlow()&&
(desc_.frameGenerationBackend==engine::FrameGenerationBackend::Dlss||engine::fsrFrameGeneration(desc_.frameGenerationBackend));
- if (desc_.noFeatures || !(nvofStandalone_ || (presentSinkFg()&&desc_.fgUsesFlow()) || inGraphFgFlow || (srEnabled_&&desc_.srUsesFlow()&&temporalSrPass(desc_)))) {
+ // DLAA takes its motion from the same flow.
+ if (desc_.noFeatures || !(nvofStandalone_ || (presentSinkFg()&&desc_.fgUsesFlow()) || inGraphFgFlow || (srEnabled_&&desc_.srUsesFlow()&&temporalSrPass(desc_)) || dlaaRequested())) {
mvecSource_="zero motion (no external flow consumer)";
veyra::log::info("graph", "optical-flow session skipped: no external motion consumer");
return true;
@@ -1305,13 +1467,13 @@ bool EnhanceGraph::initFsrSr()
veyra::log::warn("fsr-sr", "feature-disabled configuration: AMD FSR upscaling skipped");
return true;
}
- if (desc_.hdrWorking()) {
- // The working color here is linear FP16 with Veyra's own HDR contract;
- // feeding that to the FSR HDR path without a verified transfer contract
- // would be a guess. Refuse the stage instead of shipping a wrong image.
- veyra::log::warn("fsr-sr", "HDR output is not supported by the AMD FSR upscaling stage yet; continuing without it");
- return true;
- }
+ // HDR (field report 2026-11-08: an HDR source turned FSR SR off). The
+ // working color is linear BT.709 scRGB FP16, 1 = 80 nits, the same texture
+ // DLSS SR takes with its HDR flag; FSR takes it with its high-dynamic-range
+ // flag and returns the same linear contract (checked against the source by
+ // exact-area reduction, out-of-BT.709 colours included:
+ // docs/RECORD_HDR_DLAA_2026-11-08.md).
+ const bool hdr=desc_.hdrWorking();
failedBackend_=engine::FailedBackend::Sr;
// Double SR may run FSR in either pass, each with its own context and history:
// the final pass renders the reduced first result, the first pass the source.
@@ -1319,7 +1481,7 @@ bool EnhanceGraph::initFsrSr()
const uint32_t renderW=desc_.dualSr?srInW_:srcW_,renderH=desc_.dualSr?srInH_:srcH_;
const auto create=[&](std::unique_ptr<gfx::FsrSrBackend>& backend,uint32_t inW,uint32_t inH,uint32_t outW,uint32_t outH,const char* pass){
backend=std::make_unique<gfx::FsrSrBackend>();
- if(!backend->initialize(context_.device(),inW,inH,outW,outH,false)){
+ if(!backend->initialize(context_.device(),inW,inH,outW,outH,hdr)){
backend.reset();
// The engine checks fsrSrRequested() && !fsrSrEnabled() after the graph
// is created and disables the stage with a user-visible warning, so a
@@ -1327,7 +1489,7 @@ bool EnhanceGraph::initFsrSr()
veyra::log::error("fsr-sr", std::format("AMD FSR upscaling unavailable{}; the engine will disable the stage",pass));
return false;
}
- veyra::log::info("fsr-sr", std::format("selected{} render={}x{} output={}x{} provider={}",pass,inW,inH,outW,outH,backend->providerVersion()));
+ veyra::log::info("fsr-sr", std::format("selected{} render={}x{} output={}x{} provider={} hdr={}",pass,inW,inH,outW,outH,backend->providerVersion(),hdr));
return true;
};
if(finalFsr&&!create(fsrSrBackend_,renderW,renderH,workW_,workH_,desc_.dualSr?" second pass":"")){failedBackend_=engine::FailedBackend::None;return true;}
@@ -1390,14 +1552,14 @@ bool EnhanceGraph::initNgxFeatures()
if(!coreCache_->prepare(std::move(key),enabled))return false;
}
if(desc_.convertVideoHdr()&&(desc_.noNgx||desc_.noFeatures)){failedBackend_=engine::FailedBackend::VideoHdr;return false;}
- if ((desc_.noNgx && !lmxxfNr_) || desc_.noFeatures || (!nrEnabled_&&!srEnabled_&&!fgEnabled_&&!desc_.convertVideoHdr())) {
+ if ((desc_.noNgx && !lmxxfNr_) || desc_.noFeatures || (!nrEnabled_&&!srEnabled_&&!fgEnabled_&&!desc_.convertVideoHdr()&&!dlaaRequested())) {
veyra::log::info("graph", "NGX core/features skipped by disabled-feature configuration");
return true;
}
// FSR upscaling is a FidelityFX effect: a session whose only feature is
// FSR SR must not require (or fail on) the NGX core.
const bool needNgxCore = (nrEnabled_ && !lmxxfNr_) || (fgEnabled_ && !fsrEnabled() && !vfgBackend_) || desc_.convertVideoHdr() ||
- (srEnabled_ && (desc_.finalSrQuality()==0 || desc_.firstSrRuns(0) || ngxVideoSrPass(desc_)));
+ (srEnabled_ && (desc_.finalSrQuality()==0 || desc_.firstSrRuns(0) || ngxVideoSrPass(desc_))) || dlaaRequested();
if (!needNgxCore) {
veyra::log::info("graph", "NGX core skipped: lmxxf NR / AMD FSR stages use their own runtimes");
}
@@ -1685,6 +1847,29 @@ bool EnhanceGraph::initNgxFeatures()
first,srRuntimeName(desc_.dualSrQuality)));
}
+ // DLAA instances: one DLSS feature each at its own size, with the DLSS SR
+ // model. One that cannot be created passes the picture through with a
+ // notice; playback and every other effect go on.
+ for(uint32_t i=0;i<dlaa_.size();++i){
+ auto& d=dlaa_[i];
+ if(!d.width||d.copy)continue;
+ ngx::DlssSrBackend::CreateDesc dd{};
+ dd.inputWidth=dd.outputWidth=d.width;dd.inputHeight=dd.outputHeight=d.height;
+ dd.perfQuality=1;dd.enableOutputSubrects=false;dd.model=desc_.dlssSrModel;dd.nativeResolution=true;
+ ID3D12GraphicsCommandList* list=ring_.acquire(0,st);
+ if(list==nullptr){failedBackend_=engine::FailedBackend::Infrastructure;return false;}
+ d.backend=std::make_unique<ngx::DlssSrBackend>();
+ const bool created=d.backend->create(*coreHost_,list,ngxParams_,dd,st)&&d.backend->created();
+ if(!ring_.submitAndSignal(0)||!ring_.waitIdle())return false;
+ if(!created){
+ d.backend.reset();d.copy=true;st=Status::Ok;
+ antiAliasNotice_+=std::format(L"抗锯齿实例 {} DLAA 创建失败,画面原样通过。",i+1);
+ veyra::log::error("anti-alias",std::format("instance={} DLAA create failed; the instance passes the picture through",i));
+ continue;
+ }
+ veyra::log::info("anti-alias",std::format("instance={} DLAA feature {}x{} model={}",i,d.width,d.height,desc_.dlssSrModel));
+ }
+
// Still images have no temporal pair and must not depend on FG support.
// FG create + warm-up evaluate BEFORE descriptor views (the runtime
// allocates internals at the first evaluate and would fail after views
@@ -1890,7 +2075,7 @@ bool EnhanceGraph::createComputePasses()
if(nrInstances_.size()>1&&!stackProtectionPass_.create(context_.device(),cs,4,3,1,40))return false;
}
// Sets: 0 source flow, 1 NR, 2 work, 3.. NR layers, then the double SR pass motions.
- if(!flowAdaptPass_.loadShader("FlowAdapt.dxil",cs)||!flowAdaptPass_.create(context_.device(),cs,secondSrFlowSet()+1,1,1))return false;
+ if(!flowAdaptPass_.loadShader("FlowAdapt.dxil",cs)||!flowAdaptPass_.create(context_.device(),cs,dlaaFlowSet(UINT(dlaa_.size())),1,1))return false;
if(flowRefine_){
if(!fgFlowAdaptPass_.create(context_.device(),cs,2,1,1))return false;
if(!flowRefinePass_.loadShader("FlowRefine.dxil",cs)||!flowRefinePass_.create(context_.device(),cs,6,5,1))return false;
@@ -1948,6 +2133,8 @@ bool EnhanceGraph::submitGraph(uint32_t slot) {
bool EnhanceGraph::createViews()
{
+ bindSignedHdrRestore(firstSrHdrRestore_,srStageInput(),firstSrLinear_.Get());
+ bindSignedHdrRestore(srHdrRestore_,desc_.dualSr?srPrescaled_.Get():srStageInput(),workRgba_.Get());
// Descriptor initialization is DEFAULT ON since the RAW-upload-SRV removal
// (2026-09-06): texture SRV/UAV views keep the device alive and NVOF
// executing (r33b-tu: 599/599 executes, real motion/confidence, 0
@@ -2072,6 +2259,8 @@ bool EnhanceGraph::createViews()
makeUav(context_.device(),nrInstances_[i]->motion(),DXGI_FORMAT_R16G16_FLOAT,cpu(flowAdaptPass_,3+UINT(i)));
if(firstSrFlow_)makeUav(context_.device(),firstSrFlow_.Get(),DXGI_FORMAT_R16G16_FLOAT,cpu(flowAdaptPass_,firstSrFlowSet()));
if(secondSrFlow_)makeUav(context_.device(),secondSrFlow_.Get(),DXGI_FORMAT_R16G16_FLOAT,cpu(flowAdaptPass_,secondSrFlowSet()));
+ for(UINT i=0;i<dlaa_.size();++i)if(dlaa_[i].adaptedMotion)
+ makeUav(context_.device(),dlaa_[i].adaptedMotion.Get(),DXGI_FORMAT_R16G16_FLOAT,cpu(flowAdaptPass_,dlaaFlowSet(i)));
if(flowRefine_){
// FlowRefine: 0 raw grid vectors, 1 previous, 2 current, 3 NVOF backward grid vectors,
// 4 FidelityFX scene changes (3/4 null when unused); 5 refined. FlowClaim: 0 refined;
@@ -2294,6 +2483,7 @@ bool EnhanceGraph::createViews()
bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, FrameOutputs& out, uint64_t sourceFrameId, const ColorDescription* color, const HardwareSurfaceInput* hardwareSurface, bool retainReferences, const FgAdmission& admitFg, unsigned previewMultiplier, bool pausedResidualRefresh)
{
reset=reset||nrAutoResetPending_;nrAutoResetPending_=false;
+ frameFlowValid_=false;
// Whole-chain duplicate reuse failed the unchanged-output experiment.
// This narrower path only handles repeated edits of the SAME paused
// frame, after one complete reset evaluation under this configuration.
@@ -2740,7 +2930,7 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
if (desc_.stageMark) desc_.stageMark("beauty-faces");
}
}
- if(!sourcePostPasses_.empty()){
+ if(!sourcePostPasses_.empty()&&!sourcePostAfterFlow()){
if(!dispatchSlotPasses(list,sourcePostPasses_,slot,"source-size",!sourcePostExecutionLogged_,reset))return false;
tracker_.transition(list,sourcePostOutput_,D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
sourcePostExecutionLogged_=true;
@@ -2841,7 +3031,7 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
};
// Guidance from original source-space color before SR/NR. Queue waits are GPU-side.
bool haveFlow = false;
- const bool runMotion = nvofStandalone_ || (presentSinkFg()&&desc_.fgUsesFlow()) || (fgEnabled_&&desc_.fgUsesFlow()) || (srEnabled_&&desc_.srUsesFlow()&&temporalSrPass(desc_));
+ const bool runMotion = nvofStandalone_ || (presentSinkFg()&&desc_.fgUsesFlow()) || (fgEnabled_&&desc_.fgUsesFlow()) || (srEnabled_&&desc_.srUsesFlow()&&temporalSrPass(desc_)) || dlaaRequested();
if (runMotion && (gpuDis_ || amdOf_ || (nvof_ && nvof_->initialized()))) {
const float dims[8] = {uintBits(nvofW_),uintBits(nvofH_),uintBits(nvofW_),uintBits(nvofH_),0,0,0,0};
if (prevValid_) {
@@ -2972,6 +3162,10 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
// a second FSR pass in SR-input (render) pixels.
if(firstSrFlow_)adapt(firstSrFlow_.Get(),desc_.firstSrWidth,desc_.firstSrHeight,firstSrFlowSet());
if(secondSrFlow_)adapt(secondSrFlow_.Get(),srInW_,srInH_,secondSrFlowSet());
+ for(UINT i=0;i<dlaa_.size();++i){
+ const auto& d=dlaa_[i];
+ if(d.adaptedMotion&&!d.copy)adapt(d.adaptedMotion.Get(),d.width,d.height,dlaaFlowSet(i));
+ }
if(flowRefine_){
tracker_.transition(list,fgBaseFlow_.Get(),D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
const float c[8]={uintBits(nvofW_),uintBits(nvofH_),uintBits(workW_),uintBits(workH_),0,0,0,0};
@@ -2986,6 +3180,16 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
if(layer->motion()!=nrFlow_.Get())adapt(layer->motion(),layer->width(),layer->height(),3+UINT(i));
}
}
+ frameFlowValid_=haveFlow;
+ // A source-size slot with DLAA runs here, with this frame's motion. Nothing
+ // above reads its output: the optical flow encodes the converted input.
+ if(!sourcePostPasses_.empty()&&sourcePostAfterFlow()){
+ if(!dispatchSlotPasses(list,sourcePostPasses_,slot,"source-size",!sourcePostExecutionLogged_,reset))return false;
+ tracker_.transition(list,sourcePostOutput_,D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+ sourcePostExecutionLogged_=true;
+ if (desc_.stageMark) desc_.stageMark("source-size-pass");
+ cpuTrace.mark("sourcePass");
+ }
if(reset){++metrics_.resetCount;++epoch_;}
out.historyReset=reset;
out.batch.batchId=realFrameIndex_+1;out.batch.identity={epoch_,desc_.settingsRevision,sourceFrameId};
@@ -3003,18 +3207,24 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
auto readable=[&](std::initializer_list<ID3D12Resource*> resources){for(auto* r:resources)tracker_.transition(list,r,D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);};
auto written=[&](ID3D12Resource* output){tracker_.uavBarrier(list,output);tracker_.transition(list,output,D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);};
auto dlss=[&](ngx::DlssSrBackend& backend,ID3D12Resource* color,ID3D12Resource* motion,ID3D12Resource* output)->bool{
- readable({color,motion,fsrSrDepth_.Get()});tracker_.transition(list,output,D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+ auto& restore=output==firstSrLinear_.Get()?firstSrHdrRestore_:srHdrRestore_;
+ auto* target=restore.raw?restore.raw.Get():output;
+ readable({color,motion,fsrSrDepth_.Get()});tracker_.transition(list,target,D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
ngx::DlssSrBackend::EvalDesc ed{};
- ed.color=color;ed.output=output;ed.depth=fsrSrDepth_.Get();ed.motionVectors=motion;ed.reset=reset;
+ ed.color=color;ed.output=target;ed.depth=fsrSrDepth_.Get();ed.motionVectors=motion;ed.reset=reset;
if(!backend.evaluate(list,ngxParams_,ed,st)){failedBackend_=engine::FailedBackend::Sr;veyra::log::error("dual-sr","DLSS SR evaluate failed");return false;}
- written(output);return true;
+ finishTemporalOutput(list,restore,output);return true;
};
auto fsr=[&](gfx::FsrSrBackend& backend,ID3D12Resource* color,ID3D12Resource* motion,ID3D12Resource* output,uint32_t inW,uint32_t inH,uint32_t outW,uint32_t outH)->bool{
- readable({color,motion,fsrSrDepth_.Get()});tracker_.transition(list,output,D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
- if(!backend.evaluate(list,color,motion,fsrSrDepth_.Get(),output,inW,inH,outW,outH,fsrReset,float(deltaMs))){
+ const bool first=output==firstSrLinear_.Get();
+ auto& restore=first?firstSrHdrRestore_:srHdrRestore_;
+ auto* target=restore.raw?restore.raw.Get():output;
+ readable({color,motion,fsrSrDepth_.Get()});tracker_.transition(list,target,D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+ if(!backend.evaluate(list,color,motion,fsrSrDepth_.Get(),target,inW,inH,outW,outH,fsrReset,float(deltaMs))){
failedBackend_=engine::FailedBackend::Sr;veyra::log::error("dual-sr","FSR evaluate failed");return false;
}
- written(output);return true;
+ finishTemporalOutput(list,restore,output);
+ return true;
};
auto* zero=fsrSrZeroMotion_.Get();
// 1. Source -> linear first result.
@@ -3081,24 +3291,26 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
auto* srMotion=validMotion?flowTex_.Get():fsrSrZeroMotion_.Get();
tracker_.transition(list,srMotion,D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
tracker_.transition(list,fsrSrDepth_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
- tracker_.transition(list,workRgba_.Get(),D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
- if(!fsrSrBackend_->evaluate(list,srInput,srMotion,fsrSrDepth_.Get(),workRgba_.Get(),
+ auto* fsrTarget=srHdrRestore_.raw?srHdrRestore_.raw.Get():workRgba_.Get();
+ tracker_.transition(list,fsrTarget,D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+ if(!fsrSrBackend_->evaluate(list,srInput,srMotion,fsrSrDepth_.Get(),fsrTarget,
srcW_,srcH_,workW_,workH_,reset||(desc_.srUsesFlow()&&!haveFlow),float(deltaMs))){
failedBackend_=engine::FailedBackend::Sr;
return false;
}
- ++metrics_.srEvaluateCount;gpuTimer_.mark(list,GpuStage::Sr,true);
- tracker_.uavBarrier(list,workRgba_.Get());
- tracker_.transition(list,workRgba_.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+ ++metrics_.srEvaluateCount;
+ finishTemporalOutput(list,srHdrRestore_,workRgba_.Get());
+ gpuTimer_.mark(list,GpuStage::Sr,true);
} else if(!mixed&&srEnabled_&&(videoSrBackend_||vfxSrBackend_)){
if(!runVideoSr())return false;
} else if (!mixed && srEnabled_ && srBackend_ && srBackend_->created()) {
gpuTimer_.mark(list,GpuStage::Sr);
- tracker_.transition(list, workRgba_.Get(), D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+ auto* target=srHdrRestore_.raw?srHdrRestore_.raw.Get():workRgba_.Get();
+ tracker_.transition(list,target,D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
ngx::DlssSrBackend::EvalDesc ed{};
ed.color = srStageInput();
tracker_.transition(list,ed.color,D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
- ed.output = workRgba_.Get();
+ ed.output = target;
ed.depth = nrZeroDepth_.Get();
ed.motionVectors = haveFlow&&desc_.srUsesFlow()?baseFlow_.Get():nrZeroMotion_.Get();
if(desc_.srMotionProbe)ed.motionVectors=desc_.srMotionProbe;
@@ -3109,8 +3321,7 @@ bool EnhanceGraph::process(const AVFrame* frame, double ptsMs, bool reset, Frame
return false;
}
++metrics_.srEvaluateCount;gpuTimer_.mark(list,GpuStage::Sr,true);
- tracker_.uavBarrier(list, workRgba_.Get());
- tracker_.transition(list, workRgba_.Get(), D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+ finishTemporalOutput(list,srHdrRestore_,workRgba_.Get());
} else if(workRgba_.Get()!=srcRgba_.Get()) {
tracker_.transition(list,srStageInput(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
tracker_.transition(list, workRgba_.Get(), D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
@@ -3769,7 +3980,7 @@ bool EnhanceGraph::applySettings(const engine::EnhancementSettings& s){
if(s.nr&&desc_.enableNr&&!nrCreated())return false;
const auto requestedFlow=context_.adapter().vendorId==0x1002&&s.opticalFlowBackend==engine::OpticalFlowBackend::Nvidia
?engine::OpticalFlowBackend::AmdFidelityFx:s.opticalFlowBackend;
- const bool usesSharedFlow=nvofStandalone_||(desc_.enableFg&&desc_.fgUsesFlow())||
+ const bool usesSharedFlow=dlaaRequested()||nvofStandalone_||(desc_.enableFg&&desc_.fgUsesFlow())||
(srEnabled_&&desc_.srUsesFlow()&&temporalSrPass(desc_));
if(usesSharedFlow&&(requestedFlow!=desc_.opticalFlowBackend||s.amdFlowHalfResolution!=desc_.amdFlowHalfResolution))return false;
// The XeSS motion refinement owns textures, passes and NVOF's direction.
@@ -3782,7 +3993,9 @@ bool EnhanceGraph::applySettings(const engine::EnhancementSettings& s){
if((desc_.enableNr&&s.nrRuntime!=desc_.nrRuntime)||
(desc_.enableFg&&(std::max(2u,s.multiplier)!=desc_.fgMultiplier||s.frameGenerationBackend!=desc_.frameGenerationBackend||
(desc_.frameGenerationBackend==engine::FrameGenerationBackend::Vfg&&(s.vfgQuality!=desc_.vfgQuality||s.vfgAutoRegulate!=desc_.vfgAutoRegulate))))||
- (desc_.enableSr&&(s.videoSrQuality!=desc_.videoSrQuality||(desc_.videoSrQuality==0&&s.dlssSrModel!=desc_.dlssSrModel)))||
+ (desc_.enableSr&&(s.videoSrQuality!=desc_.videoSrQuality||
+ ((desc_.videoSrQuality==0||(desc_.dualSr&&desc_.dualSrQuality==0))&&s.dlssSrModel!=desc_.dlssSrModel)))||
+ (dlaaRequested()&&s.dlssSrModel!=desc_.dlssSrModel)||
(s.multiplier>1&&s.frameGenerationBackend==engine::FrameGenerationBackend::Dlss&&(!fgCapsAvailable_||s.multiplier-1>uint32_t(fgMultiFrameMax_))))return false;
// The colour master switch changes the graph shape (tables + shader branch)
// and must rebuild; every other colour field is a live uniform update.
@@ -3989,6 +4202,7 @@ void EnhanceGraph::shutdown()
videoHdrBackend_.reset();videoHdrInput_.Reset();videoHdrOutput_.Reset();
if (srBackend_) featuresReleased=srBackend_->release()&&featuresReleased;
if(firstDlssSrBackend_){featuresReleased=firstDlssSrBackend_->release()&&featuresReleased;firstDlssSrBackend_.reset();}
+ for(auto& d:dlaa_)if(d.backend){featuresReleased=d.backend->release()&&featuresReleased;d.backend.reset();}
// NVOF teardown in THREE phases (ownership rule proven by t10-L0-r2):
// a. unregisterAll() while the textures are still alive;
@@ -4080,6 +4294,8 @@ void EnhanceGraph::shutdown()
for(auto& passes:interNrPasses_)passes.clear();
for(auto& pass:antiAliasPasses_)pass.reset();
antiAliasOutputs_={};
+ dlaa_={};antiAliasNotice_.clear();frameFlowValid_=false;
+ srHdrRestore_={};firstSrHdrRestore_={};
for(auto& pass:beautyPasses_)pass.reset();
beautyOutputs_={};
if(faceTracker_)faceTracker_->shutdown();
diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cpp
index d7d2d3c6..ba6ba82a 100644
--- a/src/ui/QmlPlayerBridge.cpp
+++ b/src/ui/QmlPlayerBridge.cpp
@@ -142,7 +142,7 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesyst
emit gameModeStopped(tr("界面卡住超过 3 秒,已退出游戏模式")); break;
// The game has the keyboard in game mode; the hook hands these over.
case E::ScreenshotHotkey: takeScreenshot(); break;
- case E::RecordHotkey: toggleRecording(); break;
+ case E::RecordHotkey: toggleRecording(QStringLiteral("game-hotkey")); break;
}
};
auto* gameBeat = new QTimer(this);
diff --git a/src/ui/QmlPlayerBridge_p.h b/src/ui/QmlPlayerBridge_p.h
index f0cb0c1d..4a2572a4 100644
--- a/src/ui/QmlPlayerBridge_p.h
+++ b/src/ui/QmlPlayerBridge_p.h
@@ -384,6 +384,16 @@ struct QmlPlayerBridge::Impl {
QString pendingScreenshot;
qint64 pendingScreenshotDeadline=0;
bool holdKeyDown = false;
+ // The last key the shortcut map was offered (ShortcutOverride), named in the
+ // record trigger log: field report 2026-11-08 of recording that toggled on
+ // and off with nothing in the log saying which key or button did it.
+ struct ShortcutKeySeen {
+ int key = 0, modifiers = 0;
+ quint32 virtualKey = 0, scanCode = 0;
+ bool autoRepeat = false;
+ qint64 atMs = 0;
+ QString window;
+ } lastShortcutKey;
int positionTicks = 0;
// A reopened file resumes here once its session is running.
uint64_t resumeSession = 0;
diff --git a/src/ui/bridge/Enhancement.cpp b/src/ui/bridge/Enhancement.cpp
index 9b4607dc..27e31cdb 100644
--- a/src/ui/bridge/Enhancement.cpp
+++ b/src/ui/bridge/Enhancement.cpp
@@ -710,6 +710,7 @@ namespace {
// Spatial anti-aliasing (#53): one node's values for the editors, and the edits they send.
QString antiAliasSummary(const engine::AntiAliasSettings& a) {
using engine::AntiAliasMethod;
+ if (a.method == AntiAliasMethod::Dlaa) return QStringLiteral("DLAA");
if (a.method == AntiAliasMethod::Mlaa)
return QStringLiteral("MLAA · ") + QmlPlayerBridge::tr("阈值 %1").arg(double(a.mlaaThreshold), 0, 'f', 2);
const QStringList fxaa{QmlPlayerBridge::tr("中"), QmlPlayerBridge::tr("高"), QmlPlayerBridge::tr("极高")};
@@ -742,7 +743,7 @@ bool applyAntiAliasKey(engine::AntiAliasSettings& a, bool& enabled, const QStrin
const int whole = int(std::lround(value));
if (key == "enabled") { enabled = value != 0; return true; }
if (key == "method") {
- if (whole < 0 || whole > 2) return false;
+ if (whole < 0 || whole > 3) return false;
const auto method = AntiAliasMethod(whole);
if (method != a.method) { a.method = method; a.quality = defaultAntiAliasQuality(method); }
if (method != AntiAliasMethod::Smaa) a.temporal = AntiAliasTemporal::Off;
@@ -765,6 +766,15 @@ bool applyAntiAliasKey(engine::AntiAliasSettings& a, bool& enabled, const QStrin
return false;
}
}
+// DLAA is DLSS SR at the picture's own size: available exactly where DLSS SR is,
+// with the same reason shown when it is not.
+bool QmlPlayerBridge::dlaaAllowed() {
+ const auto dlss = effectCapabilities().value(QStringLiteral("sr0")).toMap();
+ if (dlss.value(QStringLiteral("available")).toBool()) return true;
+ const QString reason = dlss.value(QStringLiteral("reason")).toString();
+ emit notice(reason.isEmpty() ? tr("DLAA 需要支持 DLSS 的 NVIDIA RTX 显卡") : tr("DLAA 不可用:%1").arg(reason), true);
+ return false;
+}
bool QmlPlayerBridge::antiAliasEnabled() const {
const auto* node = impl_->chain.firstOf(engine::EffectType::AntiAliasing);
return node && node->enabled;
@@ -783,6 +793,7 @@ QVariantMap QmlPlayerBridge::antiAliasParamsAt(int index) const {
return antiAliasMap(&impl_->chain.nodes[index], index);
}
bool QmlPlayerBridge::setAntiAliasParameter(const QString& key, double value) {
+ if (key == QLatin1String("method") && std::lround(value) == int(engine::AntiAliasMethod::Dlaa) && !dlaaAllowed()) return false;
auto& c = impl_->chain;
for (uint32_t i = 0; i < c.nodeCount; ++i)
if (c.nodes[i].type == engine::EffectType::AntiAliasing) return setAntiAliasParameterAt(int(i), key, value);
@@ -813,6 +824,7 @@ bool QmlPlayerBridge::setAntiAliasParameter(const QString& key, double value) {
return true;
}
bool QmlPlayerBridge::setAntiAliasParameterAt(int index, const QString& key, double value) {
+ if (key == QLatin1String("method") && std::lround(value) == int(engine::AntiAliasMethod::Dlaa) && !dlaaAllowed()) return false;
auto& c = impl_->chain;
if (index < 0 || uint32_t(index) >= c.nodeCount || c.nodes[index].type != engine::EffectType::AntiAliasing) return false;
auto& node = c.nodes[index];
diff --git a/src/ui/bridge/Preferences.cpp b/src/ui/bridge/Preferences.cpp
index df750865..c1f00400 100644
--- a/src/ui/bridge/Preferences.cpp
+++ b/src/ui/bridge/Preferences.cpp
@@ -484,6 +484,16 @@ void QmlPlayerBridge::applyGameHotkeys() {
const auto keys = shortcuts();
const auto key = [&keys](const char* action) { return ui::gameKey(QKeySequence(keys.value(action).toString(), QKeySequence::PortableText)); };
impl_->game.setHotkeys(key("gamePanel"), key("gameExit"), key("screenshot"), key("record"));
+ // At start and after every change: a field log then says which key each
+ // action answers to (the 2026-11-08 recording report had no way to tell).
+ const auto custom = impl_->prefs.value("shortcuts").toMap();
+ std::string line, changed;
+ for (auto it = keys.begin(); it != keys.end(); ++it) {
+ line += std::format("{}{}={}", line.empty() ? "" : " ", it.key().toStdString(),
+ it.value().toString().isEmpty() ? std::string("none") : it.value().toString().toStdString());
+ if (custom.contains(it.key())) changed += (changed.empty() ? "" : ",") + it.key().toStdString();
+ }
+ veyra::log::info("ui-shortcuts", std::format("{} custom={}", line, changed.empty() ? std::string("none") : changed));
}
bool QmlPlayerBridge::setShortcut(const QString& action, const QString& sequence) {
if (!shortcutDefaults().contains(action)) return false;
@@ -597,6 +607,15 @@ bool QmlPlayerBridge::eventFilter(QObject* watched, QEvent* event) {
updateGameGeometry(); updateGameMode();
}, Qt::QueuedConnection);
}
+ // Remembered for the record trigger log only; the event goes on unchanged.
+ if (type == QEvent::ShortcutOverride) {
+ const auto* key = static_cast<QKeyEvent*>(event);
+ auto& seen = impl_->lastShortcutKey;
+ seen.key = key->key(); seen.modifiers = int(key->modifiers());
+ seen.virtualKey = key->nativeVirtualKey(); seen.scanCode = key->nativeScanCode();
+ seen.autoRepeat = key->isAutoRepeat(); seen.atMs = QDateTime::currentMSecsSinceEpoch();
+ seen.window = watched->objectName().isEmpty() ? QString::fromLatin1(watched->metaObject()->className()) : watched->objectName();
+ }
if (type == QEvent::KeyPress || type == QEvent::KeyRelease) {
auto* key = static_cast<QKeyEvent*>(event);
if (!key->isAutoRepeat() && qobject_cast<QWindow*>(watched)) {
diff --git a/src/ui/bridge/Recording.cpp b/src/ui/bridge/Recording.cpp
index 23c60088..e4c82a34 100644
--- a/src/ui/bridge/Recording.cpp
+++ b/src/ui/bridge/Recording.cpp
@@ -20,9 +20,30 @@ bool QmlPlayerBridge::recordingAudio() const { return impl_->prefBool("recordAud
bool QmlPlayerBridge::recording() const { return impl_->recordingState.value("active").toBool(); }
QVariantMap QmlPlayerBridge::recordingState() const { return impl_->recordingState; }
-void QmlPlayerBridge::startRecording() {
- if (recording()) { emit notice(tr("录制已在进行中"), true); return; }
- if (!hasSource()) { emit notice(tr("没有正在播放的画面,无法录制"), true); return; }
+// Every start and stop names its trigger, and a shortcut also the key the
+// shortcut map was offered just before (field report 2026-11-08: recording
+// toggled on and off around clicks and window activation, and the log could not
+// tell a key from the 专业 button).
+// (A template so the private Impl's key record is passed without naming it.)
+template <class Key>
+static void logRecordingRequest(const char* what, const QString& source, const QString& binding, const Key& k, const char* outcome) {
+ std::string detail;
+ if (source.startsWith(QStringLiteral("shortcut"))) {
+ const qint64 age = k.atMs ? QDateTime::currentMSecsSinceEpoch() - k.atMs : -1;
+ const QKeySequence pressed(QKeyCombination(Qt::KeyboardModifiers(k.modifiers & ~Qt::KeypadModifier), Qt::Key(k.key)));
+ detail = std::format(" binding={}",binding.toStdString());
+ if(age>=0&&age<=1000&&pressed==QKeySequence(binding,QKeySequence::PortableText)){
+ detail += std::format(" key={} vk=0x{:X} scan=0x{:X} repeat={} receiver={} ageMs={}",
+ binding.toStdString(),k.virtualKey,k.scanCode,k.autoRepeat,k.window.toStdString(),age);
+ }else detail += " keyEvent=unobserved";
+ }
+ veyra::log::info("ui-record", std::format("{} source={}{} {}", what, source.isEmpty() ? std::string("unnamed") : source.toStdString(), detail, outcome));
+}
+void QmlPlayerBridge::startRecording(const QString& source) {
+ const QString binding=source==QLatin1String("shortcut")?shortcuts().value("record").toString():QString();
+ if (recording()) { logRecordingRequest("start", source, binding, impl_->lastShortcutKey, "refused=already-recording"); emit notice(tr("录制已在进行中"), true); return; }
+ if (!hasSource()) { logRecordingRequest("start", source, binding, impl_->lastShortcutKey, "refused=no-source"); emit notice(tr("没有正在播放的画面,无法录制"), true); return; }
+ logRecordingRequest("start", source, binding, impl_->lastShortcutKey, "requested");
engine::RecordingSettings options;
options.directory = wideOf(recordingDirectory());
options.bitrateMbps = uint32_t(recordingBitrateMbps());
@@ -36,13 +57,15 @@ void QmlPlayerBridge::startRecording() {
impl_->recordingState["failed"] = false;
emit recordingChanged();
}
-void QmlPlayerBridge::stopRecording() {
- if (!recording()) return;
+void QmlPlayerBridge::stopRecording(const QString& source) {
+ const QString binding=source==QLatin1String("shortcut")?shortcuts().value("record").toString():QString();
+ if (!recording()) { logRecordingRequest("stop", source, binding, impl_->lastShortcutKey, "refused=not-recording"); return; }
+ logRecordingRequest("stop", source, binding, impl_->lastShortcutKey, "requested");
impl_->engine.stopRecording();
impl_->recordingState["active"] = false;
emit recordingChanged();
}
-void QmlPlayerBridge::toggleRecording() { if (recording()) stopRecording(); else startRecording(); }
+void QmlPlayerBridge::toggleRecording(const QString& source) { if (recording()) stopRecording(source); else startRecording(source); }
void QmlPlayerBridge::chooseRecordingDirectory() {
const QString dir = QFileDialog::getExistingDirectory(nullptr, tr("选择录制保存位置"), recordingDirectory());
if (!dir.isEmpty()) setPreference(QStringLiteral("recordDir"), dir);
diff --git a/tests/integration/AntiAliasGpuTests.cpp b/tests/integration/AntiAliasGpuTests.cpp
index fa375551..855819c5 100644
--- a/tests/integration/AntiAliasGpuTests.cpp
+++ b/tests/integration/AntiAliasGpuTests.cpp
@@ -17,6 +17,7 @@
// real-frame: a captured picture (VEYRA_AA_FRAME, binary PPM) through SMAA high
// without NR and with a real NR layer before / after it; the outputs go to
// VEYRA_AA_FRAME_OUT as PPM for comparison. A diagnostic, not part of a sweep.
+// dlaa-*: DLAA through real NGX graphs (see the block above the case list).
// VEYRA_AA_GPU_DEBUG=1 enables the D3D12 debug layer and fails on its errors.
#include "veyra/engine/PreviewGpuSession.h"
#include "veyra/engine/GraphDescription.h"
@@ -676,6 +677,220 @@ int timingCase(unsigned width, unsigned height, bool dense = false) {
return failures ? 1 : 0;
}
+
+// ---- DLAA (user request 2026-11-08): NGX DLSS at the picture's own size ---------------
+// dlaa-sdr: the list chain's anti-aliasing at the source size (NR and SR off), a
+// scene panning one pixel a frame: every frame runs DLSS in its DLAA mode with
+// optical-flow motion, flat areas stay close, edges change. dlaa-sr: the same in
+// front of DLSS SR. dlaa-hdr: P010 PQ input, scRGB output, no NaN/Inf, the flat
+// highlight patch and out-of-709 colours kept. dlaa-still: a still image passes
+// through bit-identical, with the notice, and DLSS never runs.
+AVFrame* shiftedFrame(const Scene& scene, double dx) {
+ AVFrame* f = av_frame_alloc();
+ if (!f) return nullptr;
+ f->format = AV_PIX_FMT_BGR0; f->width = int(scene.width); f->height = int(scene.height);
+ f->color_range = AVCOL_RANGE_UNSPECIFIED; f->color_trc = AVCOL_TRC_IEC61966_2_1; f->colorspace = AVCOL_SPC_RGB;
+ if (av_frame_get_buffer(f, 32) < 0) { av_frame_free(&f); return nullptr; }
+ for (unsigned y = 0; y < scene.height; ++y)
+ for (unsigned x = 0; x < scene.width; ++x) {
+ const int l = scene.label(x + 0.5 - dx, y + 0.5);
+ const uint8_t* c = l == 1 ? kShape : l == 2 ? kLine : kBackground;
+ auto* p = f->data[0] + size_t(y) * f->linesize[0] + size_t(x) * 4;
+ p[0] = c[2]; p[1] = c[1]; p[2] = c[0]; p[3] = 255;
+ }
+ return f;
+}
+bool readHalfFrom(gfx::D3D12DeviceContext& ctx, gfx::CommandSlotRing& ring, ID3D12Resource* texture, std::vector<float>& rgba) {
+ const auto d = texture->GetDesc();
+ if (d.Format != DXGI_FORMAT_R16G16B16A16_FLOAT) return false;
+ D3D12_PLACED_SUBRESOURCE_FOOTPRINT fp{}; UINT64 bytes = 0;
+ ctx.device()->GetCopyableFootprints(&d, 0, 1, 0, &fp, nullptr, nullptr, &bytes);
+ D3D12_HEAP_PROPERTIES heap{}; heap.Type = D3D12_HEAP_TYPE_READBACK;
+ D3D12_RESOURCE_DESC buffer{}; buffer.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER; buffer.Width = bytes;
+ buffer.Height = 1; buffer.DepthOrArraySize = 1; buffer.MipLevels = 1; buffer.SampleDesc.Count = 1;
+ buffer.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
+ Microsoft::WRL::ComPtr<ID3D12Resource> readback;
+ if (FAILED(ctx.device()->CreateCommittedResource(&heap, D3D12_HEAP_FLAG_NONE, &buffer, D3D12_RESOURCE_STATE_COPY_DEST, nullptr, IID_PPV_ARGS(&readback)))) return false;
+ Status st = Status::Ok; const auto slot = ring.slotCount() - 1; auto* list = ring.acquire(slot, st);
+ if (!list) return false;
+ D3D12_RESOURCE_BARRIER b{}; b.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
+ b.Transition = {texture, D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_COPY_SOURCE};
+ list->ResourceBarrier(1, &b);
+ D3D12_TEXTURE_COPY_LOCATION src{}, dst{};
+ src.pResource = texture; src.Type = D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;
+ dst.pResource = readback.Get(); dst.Type = D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT; dst.PlacedFootprint = fp;
+ list->CopyTextureRegion(&dst, 0, 0, 0, &src, nullptr);
+ std::swap(b.Transition.StateBefore, b.Transition.StateAfter); list->ResourceBarrier(1, &b);
+ if (!ring.submitAndSignal(slot) || !ring.waitIdle()) return false;
+ uint8_t* data = nullptr; D3D12_RANGE range{0, SIZE_T(bytes)};
+ if (FAILED(readback->Map(0, &range, reinterpret_cast<void**>(&data)))) return false;
+ rgba.resize(size_t(d.Width) * d.Height * 4);
+ for (UINT y = 0; y < d.Height; ++y) {
+ const auto* row = reinterpret_cast<const DirectX::PackedVector::HALF*>(data + fp.Offset + size_t(y) * fp.Footprint.RowPitch);
+ for (UINT x = 0; x < UINT(d.Width) * 4; ++x) rgba[size_t(y) * d.Width * 4 + x] = DirectX::PackedVector::XMConvertHalfToFloat(row[x]);
+ }
+ D3D12_RANGE empty{}; readback->Unmap(0, &empty);
+ return true;
+}
+struct DlaaRun { bool ok = false,modelRebuild=false,flowRebuild=false; uint64_t dlaa = 0, motion = 0, sr = 0; std::wstring notice; sink::RgbaImage last; std::vector<float> lastHalf; };
+// `frames` frames through a real graph (NGX), the scene moving `step` pixels a frame.
+DlaaRun dlaaRun(const AntiAliasSettings& a, unsigned frames, double step, bool sr, bool hdr, bool still,unsigned srQuality=0,bool two=false,bool large=false) {
+ DlaaRun r;
+ HRESULT com = CoInitializeEx(nullptr, COINIT_MULTITHREADED); (void)com;
+ engine::EnhancementSettings settings; settings.antiAlias = a; settings.multiplier = 1;
+ if (hdr) settings.hdrOutputMode = engine::HdrOutputMode::ScRgb;
+ if (sr) { settings.srTarget = large?pipeline::SrTarget::Uhd4K:pipeline::SrTarget::Qhd; settings.videoSrQuality = srQuality; }
+ if(two){settings.additionalAntiAliasCount=1;settings.additionalAntiAlias[0]=a;}
+ const Scene scene(large?2560:640,large?1440:360);
+ engine::StageRequest request; request.width = scene.width; request.height = scene.height; request.sr = sr; request.stillImage = still;
+ pipeline::EnhanceGraphDesc desc; engine::describeStages(request, settings, desc);
+ if (!desc.fixedExecutionPlanError.empty()) { std::cout << "plan error: " << desc.fixedExecutionPlanError << std::endl; return r; }
+ desc.rgbInput = !hdr; desc.hdrInput = hdr; desc.hdrOutput = hdr; desc.stillImage = still; desc.outputDitherStep = 0;
+ if(large){desc.flowWidth=1920;desc.flowHeight=1080;}
+ desc.runtimeAbsPath = runtime::localRuntimeDirectory().wstring();
+ engine::PreviewGpuSession session;
+ gfx::DeviceContextDesc device;device.enableDebugLayer=std::getenv("VEYRA_AA_GPU_DEBUG")!=nullptr;
+ Status status=Status::Ok;
+ bool ok=session.context.initialize(device,status)&&session.ring.initialize(session.context.device(),session.context.directQueue(),
+ session.context.fence(),session.context.fenceEvent(),4,status);
+ gfx::ComPtr<ID3D12InfoQueue> messages;
+ if(device.enableDebugLayer&&ok)session.context.device()->QueryInterface(IID_PPV_ARGS(&messages));
+ if(messages)messages->ClearStoredMessages();
+ ok=ok&&session.graph->initialize(desc)&&session.graph->createViews();
+ for (unsigned i = 0; ok && i < frames; ++i) {
+ AVFrame* frame = hdr ? hdrFrame(scene) : shiftedFrame(scene, step * i);
+ pipeline::EnhanceGraph::FrameOutputs out;
+ ok = frame && session.graph->process(frame, double(i) * 1000.0 / 30.0, i == 0, out, i + 1) && session.ring.waitIdle();
+ if (ok && i + 1 == frames) {
+ auto* texture = session.graph->videoFrameResource(out.videoSlot);
+ ok = texture && (hdr ? readHalfFrom(session.context, session.ring, texture, r.lastHalf)
+ : sink::readRgba8(session.context, session.ring, texture, r.last));
+ }
+ av_frame_free(&frame);
+ }
+ if (ok) {
+ r.dlaa = session.graph->dlaaEvaluateCount(); r.motion=session.graph->dlaaMotionEvaluateCount();
+ r.sr = session.graph->metrics().srEvaluateCount; r.notice = session.graph->antiAliasNotice();
+ if(a.enabled&&a.usesDlaa()&&!still){
+ auto changed=settings;changed.dlssSrModel=1;
+ r.modelRebuild=!session.graph->applySettings(changed);
+ changed=settings;changed.opticalFlowBackend=engine::OpticalFlowBackend::GpuDis;
+ r.flowRebuild=!session.graph->applySettings(changed);
+ }
+ }
+ r.ok = ok;
+ session.ring.drainQueue(); session.graph->shutdown(); session.shutdown();
+ if(messages){
+ size_t errors=0;
+ for(UINT64 i=0;i<messages->GetNumStoredMessagesAllowedByRetrievalFilter();++i){
+ SIZE_T bytes=0;messages->GetMessage(i,nullptr,&bytes);std::vector<uint8_t> storage(bytes);
+ auto* m=reinterpret_cast<D3D12_MESSAGE*>(storage.data());messages->GetMessage(i,m,&bytes);
+ if(m->Severity<=D3D12_MESSAGE_SEVERITY_ERROR){++errors;std::printf("D3D_ERROR %s\n",m->pDescription);}
+ }
+ check(errors==0,"DLAA/FSR graph: D3D12 debug layer reports zero errors");r.ok=r.ok&&errors==0;
+ }
+ return r;
+}
+int dlaaCase(const std::string& name, bool sr,bool two=false) {
+ const auto dlaa = aa(AntiAliasMethod::Dlaa, 0);
+ AntiAliasSettings off = dlaa; off.enabled = false;
+ constexpr unsigned frames = 12;
+ const auto on = dlaaRun(dlaa, frames, 1.0, sr, false, false,0,two), base = dlaaRun(off, frames, 1.0, sr, false, false,0,two);
+ check(on.ok && base.ok && on.last.pixels.size() == base.last.pixels.size(), name + ": real graph runs with DLAA on and off");
+ if (!on.ok || !base.ok || on.last.pixels.size() != base.last.pixels.size()) return 1;
+ std::printf("METRIC case=%s dlaaEvaluations=%llu srEvaluations=%llu out=%ux%u notice=%zu\n", name.c_str(),
+ (unsigned long long)on.dlaa, (unsigned long long)on.sr, on.last.width, on.last.height, on.notice.size());
+ check(on.dlaa == frames*(two?2:1) && on.notice.empty(), name + ": DLSS ran in its DLAA mode on every frame and instance");
+ check(on.modelRebuild&&on.flowRebuild,name+": model and flow backend changes require rebuilding the native features");
+ check(!sr || (on.sr > 0 && base.sr > 0), name + ": DLSS SR ran behind it");
+ if (!sr) {
+ // The last frame's scene: flat pixels nearly unchanged, edges changed.
+ const Scene scene; std::vector<uint8_t> labels(size_t(scene.width) * scene.height);
+ for (unsigned y = 0; y < scene.height; ++y)
+ for (unsigned x = 0; x < scene.width; ++x) labels[size_t(y) * scene.width + x] = uint8_t(scene.label(x + 0.5 - double(frames - 1), y + 0.5));
+ double flatDiff = 0, edgeDiff = 0; size_t flat = 0, edges = 0;
+ for (int y = 4; y + 4 < int(scene.height); ++y)
+ for (int x = 4; x + 4 < int(scene.width); ++x) {
+ const auto l = labels[size_t(y) * scene.width + x]; bool same = true, nearEdge = false;
+ for (int dy = -4; dy <= 4; ++dy)
+ for (int dx = -4; dx <= 4; ++dx) {
+ const bool s = labels[size_t(y + dy) * scene.width + x + dx] == l;
+ same &= s; if (std::abs(dx) <= 1 && std::abs(dy) <= 1) nearEdge |= !s;
+ }
+ double d = 0; const size_t i = (size_t(y) * scene.width + x) * 4;
+ for (unsigned c = 0; c < 3; ++c) d += std::abs(double(on.last.pixels[i + c]) - base.last.pixels[i + c]) / 3.0;
+ if (same) { flatDiff += d; ++flat; }
+ if (nearEdge) { edgeDiff += d; ++edges; }
+ }
+ flatDiff /= double(std::max<size_t>(flat, 1)); edgeDiff /= double(std::max<size_t>(edges, 1));
+ std::printf("METRIC case=%s flatMeanDiff=%.3f (n=%zu) edgeMeanDiff=%.3f (n=%zu) 8-bit\n", name.c_str(), flatDiff, flat, edgeDiff, edges);
+ check(flatDiff < 1.5, name + ": flat areas stay within 1.5/255 of the input on average");
+ check(edgeDiff > 2 * flatDiff && edgeDiff > 0.5, name + ": edges change more than flat areas");
+ }
+ return failures ? 1 : 0;
+}
+int dlaaHdrCase() {
+ const auto on = dlaaRun(aa(AntiAliasMethod::Dlaa, 0), 8, 0.0, false, true, false);
+ AntiAliasSettings offSettings = aa(AntiAliasMethod::Dlaa, 0); offSettings.enabled = false;
+ const auto off = dlaaRun(offSettings, 8, 0.0, false, true, false);
+ check(on.ok && off.ok && on.lastHalf.size() == off.lastHalf.size() && !on.lastHalf.empty(), "dlaa-hdr: real graph runs with HDR input and scRGB output");
+ if (!on.ok || !off.ok || on.lastHalf.size() != off.lastHalf.size() || on.lastHalf.empty()) return 1;
+ size_t bad = 0; double patchOn = 0, patchOff = 0; size_t patch = 0, negativeOff = 0, negativeOn = 0;
+ const Scene scene;
+ for (unsigned y = 0; y < scene.height; ++y)
+ for (unsigned x = 0; x < scene.width; ++x) {
+ const size_t i = (size_t(y) * scene.width + x) * 4;
+ for (unsigned c = 0; c < 3; ++c) bad += !std::isfinite(on.lastHalf[i + c]);
+ const bool negOff = std::min({off.lastHalf[i], off.lastHalf[i + 1], off.lastHalf[i + 2]}) < -1e-3f;
+ negativeOff += negOff; negativeOn += negOff && std::min({on.lastHalf[i], on.lastHalf[i + 1], on.lastHalf[i + 2]}) < -1e-3f;
+ if (inPatch(x, y) && inPatch(x - 4, y - 4) && inPatch(x + 4, y + 4)) {
+ patchOn += 0.2126 * on.lastHalf[i] + 0.7152 * on.lastHalf[i + 1] + 0.0722 * on.lastHalf[i + 2];
+ patchOff += 0.2126 * off.lastHalf[i] + 0.7152 * off.lastHalf[i + 1] + 0.0722 * off.lastHalf[i + 2]; ++patch;
+ }
+ }
+ const double ratio = patch && patchOff > 0 ? patchOn / patchOff : 0;
+ std::printf("METRIC case=dlaa-hdr dlaaEvaluations=%llu nonFinite=%zu highlightPatch=%zu ratio=%.4f negativeOff=%zu negativeKept=%zu\n",
+ (unsigned long long)on.dlaa, bad, patch, ratio, negativeOff, negativeOn);
+ check(on.dlaa == 8 && on.notice.empty(), "dlaa-hdr: DLSS ran in its DLAA mode on every frame");
+ check(bad == 0, "dlaa-hdr: no NaN / Inf in the scRGB output");
+ check(patch > 0 && std::abs(ratio - 1.0) < 0.02, "dlaa-hdr: the flat highlight patch keeps its luminance within 2%");
+ check(negativeOff > 0 && negativeOn == negativeOff, "dlaa-hdr: out-of-709 colours keep their negative components");
+ return failures ? 1 : 0;
+}
+int dlaaStillCase() {
+ const auto on = dlaaRun(aa(AntiAliasMethod::Dlaa, 0), 1, 0.0, false, false, true);
+ AntiAliasSettings offSettings = aa(AntiAliasMethod::Dlaa, 0); offSettings.enabled = false;
+ const auto off = dlaaRun(offSettings, 1, 0.0, false, false, true);
+ check(on.ok && off.ok, "dlaa-still: still-image graphs run");
+ check(on.ok && off.ok && on.last.pixels == off.last.pixels, "dlaa-still: the picture passes through bit-identical");
+ check(on.ok && on.dlaa == 0 && !on.notice.empty(), "dlaa-still: DLSS never runs and the notice says why");
+ return failures ? 1 : 0;
+}
+
+int temporalSrHdrCase(const char* name,unsigned quality){
+ AntiAliasSettings disabled;
+ const auto on=dlaaRun(disabled,4,0,true,true,false,quality);
+ const auto off=dlaaRun(disabled,4,0,false,true,false);
+ check(on.ok&&off.ok&&on.sr==4,std::string(name)+": HDR upscaling evaluates every source frame");
+ const Scene scene;
+ if(!on.ok||!off.ok||on.lastHalf.size()!=size_t(scene.width)*scene.height*64)return 1;
+ double error=0,lumaOn=0,lumaOff=0;size_t count=0,bad=0;
+ for(float v:on.lastHalf)bad+=!std::isfinite(v);
+ for(unsigned y=4;y+4<scene.height;++y)for(unsigned x=4;x+4<scene.width;++x){
+ if(!inPatch(x-4,y-4)||!inPatch(x+4,y+4))continue;
+ const auto b=(size_t(y)*scene.width+x)*4;
+ const auto a=(size_t(y*4+2)*(scene.width*4)+x*4+2)*4;
+ for(unsigned c=0;c<3;++c)error+=std::abs(on.lastHalf[a+c]-off.lastHalf[b+c]);
+ lumaOn+=0.2126*on.lastHalf[a]+0.7152*on.lastHalf[a+1]+0.0722*on.lastHalf[a+2];
+ lumaOff+=0.2126*off.lastHalf[b]+0.7152*off.lastHalf[b+1]+0.0722*off.lastHalf[b+2];
+ ++count;
+ }
+ const double mean=count?error/(count*3):1e9,ratio=lumaOff>0?lumaOn/lumaOff:0;
+ std::printf("METRIC %s nonFinite=%zu patch=%zu signedColorMeanError=%.6f lumaRatio=%.6f\n",name,bad,count,mean,ratio);
+ check(bad==0&&count>0&&mean<0.02&&std::abs(ratio-1)<0.02,std::string(name)+": saturated BT2020 patch preserves signed scRGB colour and luminance");
+ return failures?1:0;
+}
+
struct Case { std::string name; std::function<int()> run; };
std::vector<Case> cases() {
std::vector<Case> c;
@@ -694,6 +909,20 @@ std::vector<Case> cases() {
c.push_back({"node-prenr", [] { return nodeCase("node-prenr", {srNode(), aaNode(aa(AntiAliasMethod::Smaa, 2)), nrNode()}, 1); }});
c.push_back({"node-source-and-tail", [] {
return nodeCase("node-source-and-tail", {aaNode(aa(AntiAliasMethod::Smaa, 0)), srNode(), nrNode(), aaNode(aa(AntiAliasMethod::Fxaa, 1))}, 2); }});
+ c.push_back({"dlaa-sdr", [] { return dlaaCase("dlaa-sdr", false); }});
+ c.push_back({"dlaa-sr", [] { return dlaaCase("dlaa-sr", true); }});
+ c.push_back({"dlaa-two", [] { return dlaaCase("dlaa-two",false,true); }});
+ c.push_back({"fsr-hdr", [] { return temporalSrHdrCase("fsr-hdr",engine::kVideoSrFsr); }});
+ c.push_back({"dlss-hdr", [] { return temporalSrHdrCase("dlss-hdr",0); }});
+ c.push_back({"dlaa-1440p-flow", [] {
+ const auto r=dlaaRun(aa(AntiAliasMethod::Dlaa,0),4,2,true,false,false,2,false,true);
+ std::printf("METRIC dlaa-1440p-flow evaluations=%llu withMotion=%llu sr=%llu\n",
+ (unsigned long long)r.dlaa,(unsigned long long)r.motion,(unsigned long long)r.sr);
+ check(r.ok&&r.dlaa==4&&r.motion==3&&r.sr==4&&r.last.width==3840,"1440p DLAA uses the adapted 1080p flow with 4K SR active");
+ return failures?1:0;
+ }});
+ c.push_back({"dlaa-hdr", [] { return dlaaHdrCase(); }});
+ c.push_back({"dlaa-still", [] { return dlaaStillCase(); }});
c.push_back({"tiled-image", [] { return tiledCase(); }});
c.push_back({"real-frame", [] { return realFrameCase(); }});
c.push_back({"timing-1080p", [] { return timingCase(1920, 1080); }});
diff --git a/tests/integration/SrQualityTests.cpp b/tests/integration/SrQualityTests.cpp
index 84f53a49..dfe7c8dc 100644
--- a/tests/integration/SrQualityTests.cpp
+++ b/tests/integration/SrQualityTests.cpp
@@ -391,9 +391,8 @@ std::pair<double,bool> meanLinear(const sink::RgbaImage& img){
// Every backend pair with real SDK evaluations of both passes, zero and optical
// flow motion: sizes, two evaluations per frame, finite output with the source's
// mean brightness. Then a first DLSS SR pass with nothing to enlarge (a copy of
-// the source), DLSS SR pairs on HDR, and FSR's HDR refusal reported the way the
-// engine detects it (fsrSrRequested && !fsrSrEnabled disables SR with a notice).
-int any(const std::filesystem::path& directory){
+// the source), and HDR backend pairs including FSR in either or both passes.
+int any(const std::filesystem::path& directory,bool onlyHdr=false,bool onlySdr=false,int first=-1,int second=-1){
std::filesystem::create_directories(directory);Logger::instance().openFile((directory/L"engine.log").wstring());
gfx::D3D12DeviceContext ctx;gfx::CommandSlotRing ring;Status status;
if(!ctx.initialize({},status)||!ring.initialize(ctx.device(),ctx.directQueue(),ctx.fence(),ctx.fenceEvent(),4,status))return 2;
@@ -405,7 +404,9 @@ int any(const std::filesystem::path& directory){
// runtime/experimental is the NGX directory; Video Effects sits beside it.
const auto vfx=std::filesystem::exists(runtime::localRuntimeDirectory().parent_path()/L"nvidia-vfg"/L"nvVFXVideoSuperRes.dll");
struct Pair{unsigned first,second;};
- for(const auto pair:{Pair{0,0},Pair{0,2},Pair{2,0},Pair{0,5},Pair{5,0},Pair{5,5},Pair{5,2},Pair{2,5},Pair{17,0},Pair{0,19}}){
+ const auto selected=[&](Pair p){return first<0||(p.first==unsigned(first)&&p.second==unsigned(second));};
+ if(!onlyHdr)for(const auto pair:{Pair{0,0},Pair{0,2},Pair{2,0},Pair{0,5},Pair{5,0},Pair{5,5},Pair{5,2},Pair{2,5},Pair{17,0},Pair{0,19}}){
+ if(!selected(pair))continue;
if(!vfx&&(engine::vfxVideoSr(pair.first)||engine::vfxVideoSr(pair.second))){
std::cout<<"DUAL_ANY first="<<pair.first<<" second="<<pair.second<<" skipped=no-video-effects-runtime"<<std::endl;continue;}
for(bool flow:{false,true}){
@@ -418,7 +419,7 @@ int any(const std::filesystem::path& directory){
ok=ok&&passed;++cases;
}
}
- {
+ if(!onlyHdr&&first<0){
// A 4K source at the 4K base target: the first DLSS SR pass has nothing to enlarge.
const auto copy=run(ctx,ring,uhd.get(),false,mixed(0,0,SrTarget::Uhd4K,SrPrescale::P1080,SrTarget::Uhd4K,false),false,false,false,3,true);
double worst=0;bool sized=copy.ok&&copy.firstLinear.width==3840&&copy.firstLinear.height==2160;
@@ -427,24 +428,26 @@ int any(const std::filesystem::path& directory){
const bool passed=sized&&copy.evaluations==6&&copy.work==Extent{3840,2160}&&worst<0.002;
std::cout<<"DUAL_ANY copy first=0 second=0 evaluations="<<copy.evaluations<<" worst="<<worst<<" passed="<<passed<<std::endl;ok=ok&&passed;++cases;
}
- for(const auto pair:{Pair{0,0},Pair{2,0},Pair{0,2}}){
+ if(!onlySdr)for(const auto pair:{Pair{0,0},Pair{2,0},Pair{0,2},Pair{5,5},Pair{2,5},Pair{5,2},Pair{0,5},Pair{5,0}}){
+ if(!selected(pair))continue;
const auto h=run(ctx,ring,hdr.get(),true,mixed(pair.first,pair.second,SrTarget::Uhd4K,SrPrescale::P1080,SrTarget::Uhd4K,false),false,false,false,3,true);
const auto [mean,finite]=meanLinear(h.output);
const bool passed=h.ok&&h.evaluations==6&&h.firstLinear.width==3840&&h.output.width==3840&&finite&&mean>0;
std::cout<<"DUAL_ANY hdr first="<<pair.first<<" second="<<pair.second<<" evaluations="<<h.evaluations<<" mean="<<mean<<" passed="<<passed<<std::endl;
ok=ok&&passed;++cases;
}
- {
+ if(!onlySdr&&first<0){
engine::StageRequest request;request.width=1920;request.height=1080;request.sr=true;
auto settings=mixed(2,engine::kVideoSrFsr,SrTarget::Uhd4K,SrPrescale::P1080,SrTarget::Uhd4K,false);
pipeline::EnhanceGraphDesc desc;engine::describeStages(request,settings,desc);
desc.hdrInput=desc.hdrOutput=true;desc.runtimeAbsPath=runtime::localRuntimeDirectory().wstring();
pipeline::EnhanceGraph graph(ctx,ring);
const bool built=graph.initialize(desc);
- const bool passed=desc.dualSr&&built&&graph.fsrSrRequested()&&!graph.fsrSrEnabled();
+ const bool passed=desc.dualSr&&built&&graph.fsrSrRequested()&&graph.fsrSrEnabled();
std::cout<<"DUAL_ANY hdr-fsr second=5 requested="<<graph.fsrSrRequested()<<" enabled="<<graph.fsrSrEnabled()<<" passed="<<passed<<std::endl;
ok=ok&&passed;++cases;ring.drainQueue();graph.shutdown();
}
+ ok=ok&&cases>0;
ring.shutdown();ctx.shutdown();std::cout<<"DUAL_ANY cases="<<cases<<" passed="<<ok<<std::endl;return ok?0:1;
}
// Supersampling: one RTX Video SR pass at 8K shrunk to 4K equals the CPU area
@@ -545,6 +548,11 @@ int wmain(int argc,wchar_t** argv){
if(argc==3&&std::wstring_view(argv[2])==L"dual-boundaries"){const int result=stage::boundaries(argv[1]);CoUninitialize();return result;}
if(argc==3&&std::wstring_view(argv[2])==L"dual-capabilities"){const int result=stage::capabilities(argv[1]);CoUninitialize();return result;}
if(argc==3&&std::wstring_view(argv[2])==L"dual-any"){const int result=stage::any(argv[1]);CoUninitialize();return result;}
+ if((argc==3||argc==5)&&(std::wstring_view(argv[2])==L"dual-any-hdr"||std::wstring_view(argv[2])==L"dual-any-sdr")){
+ const bool hdr=std::wstring_view(argv[2])==L"dual-any-hdr";
+ const int result=stage::any(argv[1],hdr,!hdr,argc==5?std::stoi(argv[3]):-1,argc==5?std::stoi(argv[4]):-1);
+ CoUninitialize();return result;
+ }
if(argc==3&&std::wstring_view(argv[2])==L"supersample"){const int result=stage::supersample(argv[1]);CoUninitialize();return result;}
if(argc>=11&&std::wstring_view(argv[2])==L"sr-image"){
const int result=stage::image(argv[1],argv[3],argv[4],unsigned(std::stoi(argv[5])),argv[6],argv[7],argv[8],argv[9],unsigned(std::stoi(argv[10])),argc>11?argv[11]:L"video");
diff --git a/tests/qml/quick/tst_anti_alias_editor.qml b/tests/qml/quick/tst_anti_alias_editor.qml
index 8f05b6f9..9cf1725c 100644
--- a/tests/qml/quick/tst_anti_alias_editor.qml
+++ b/tests/qml/quick/tst_anti_alias_editor.qml
@@ -21,13 +21,24 @@ Item {
TestCase {
name: "AntiAliasEditor"
when: windowShown
- function init() { root.edits = []; root.params = root.smaa }
+ property var savedCapabilities
+ function init() { savedCapabilities = veyra.effectCapabilities; root.edits = []; root.params = root.smaa }
+ function cleanup() { veyra.effectCapabilities = savedCapabilities }
function withParams(changes) {
const p = Object.assign({}, root.smaa)
for (const k in changes) p[k] = changes[k]
root.params = p
}
function child(name) { const c = findChild(editor, "t-aa-" + name); verify(c !== null, name); return c }
+ // One option of a segmented control, by its id.
+ function option(seg, id) {
+ const visit = item => {
+ if (item.modelData !== undefined && item.modelData !== null && item.modelData.id === id) return item
+ for (let i = 0; i < item.children.length; ++i) { const f = visit(item.children[i]); if (f) return f }
+ return null
+ }
+ const found = visit(seg); verify(found !== null, "option " + id); return found
+ }
function test_smaa_rows() {
compare(child("quality").visible, true)
compare(child("quality").options.length, 4)
@@ -54,15 +65,35 @@ Item {
compare(child("temporal").visible, false)
}
function test_clicks_send_bridge_keys() {
- // The rightmost option of a segment sits at its right edge.
- const method = child("method")
- mouseClick(method, method.width - 14, method.height / 2)
+ // MLAA is the third method; the rightmost temporal option sits at its right edge.
+ const mlaa = option(child("method"), "2")
+ mouseClick(mlaa, mlaa.width / 2, mlaa.height / 2)
const temporal = child("temporal")
mouseClick(temporal, temporal.width - 12, temporal.height / 2)
compare(root.edits.length, 2)
compare(root.edits[0].key, "method"); compare(root.edits[0].amount, 2)
compare(root.edits[1].key, "temporal"); compare(root.edits[1].amount, 2)
}
+ // DLAA (2026-11-08): no tiers, no MLAA or SMAA rows.
+ function test_dlaa_rows() {
+ withParams({method: 3, quality: 0})
+ compare(child("quality").visible, false)
+ compare(child("temporal").visible, false)
+ compare(child("mlaa-threshold").visible, false)
+ compare(child("mlaa-strength").visible, false)
+ compare(child("method").current, "3")
+ }
+ // The DLAA option follows DLSS SR's availability (same runtime and adapters).
+ function test_dlaa_option_follows_dlss() {
+ compare(option(child("method"), "3").enabled, false)
+ const caps = Object.assign({}, savedCapabilities); caps.sr0 = {available: true, reason: ""}
+ veyra.effectCapabilities = caps
+ const dlaa = option(child("method"), "3")
+ compare(dlaa.enabled, true)
+ mouseClick(dlaa, dlaa.width / 2, dlaa.height / 2)
+ compare(root.edits.length, 1)
+ compare(root.edits[0].key, "method"); compare(root.edits[0].amount, 3)
+ }
function test_slider_edits_round() {
withParams({method: 2, quality: 0})
child("mlaa-threshold").moved(0.1234)
diff --git a/tests/unit/EffectChainTests.cpp b/tests/unit/EffectChainTests.cpp
index 34acc789..38fa0c4b 100644
--- a/tests/unit/EffectChainTests.cpp
+++ b/tests/unit/EffectChainTests.cpp
@@ -2,6 +2,7 @@
// modes must obey. These are the guards for the multi-NR and node-mode work.
#include "veyra/engine/EffectChain.h"
#include "veyra/engine/GraphDescription.h"
+#include "veyra/engine/BackendRecovery.h"
#include <type_traits>
#include <algorithm>
#include <random>
@@ -1568,6 +1569,23 @@ static void testSupersampleSr(){
}
int main() {
+ {
+ EnhancementSettings before;before.nr=before.sr=false;
+ before.antiAlias.enabled=true;before.antiAlias.method=AntiAliasMethod::Dlaa;before.antiAlias.quality=0;
+ auto after=before;after.dlssSrModel=1;
+ check(requiresGraphRebuild(before,after),"DLAA: model edits rebuild even when SR is disabled");
+ after=before;after.flow=FlowQuality::Quality;
+ check(!(before.activeVideoSettings()==after.activeVideoSettings()),"DLAA: flow tuning stays active with no other flow consumer");
+ before.antiAlias.enabled=false;after=before;after.dlssSrModel=1;
+ check(!requiresGraphRebuild(before,after),"DLAA: disabled instance does not activate the model");
+ for(auto failure:{FailedBackend::Dlaa,FailedBackend::NgxCore,FailedBackend::OpticalFlow}){
+ auto failed=before;
+ failed.antiAlias.enabled=true;
+ failed.additionalAntiAliasCount=1;failed.additionalAntiAlias[0].enabled=true;
+ check(disableFailedBackend(failed,failure)&&!failed.usesDlaa()&&failed.additionalAntiAlias[0].enabled,
+ "DLAA: recovery removes the failed consumer and leaves spatial anti-aliasing enabled");
+ }
+ }
{
using namespace veyra;using namespace veyra::engine;
EnhancementSettings original;original.nr=false;original.sr=true;original.videoSrQuality=0;
diff --git a/tests/unit/PresetLibraryTests.cpp b/tests/unit/PresetLibraryTests.cpp
index 19810bb4..d8545b59 100644
--- a/tests/unit/PresetLibraryTests.cpp
+++ b/tests/unit/PresetLibraryTests.cpp
@@ -3,6 +3,7 @@
#include "veyra/engine/PresetLibrary.h"
#include <algorithm>
+#include <chrono>
#include <cstdio>
#include <filesystem>
#include <fstream>
@@ -18,9 +19,21 @@ void check(bool ok, const char* label) {
if (!ok) ++failures;
}
std::filesystem::path scratch(const wchar_t* name) {
- auto dir = std::filesystem::temp_directory_path() / L"veyra-preset-library-tests";
- std::filesystem::create_directories(dir);
- auto path = dir / name;
+ // Sidecars belong to this invocation only, including after a failed test.
+ struct ScratchDirectory {
+ std::filesystem::path path;
+ ScratchDirectory() {
+ const auto parent=std::filesystem::temp_directory_path();
+ const auto stamp=std::chrono::steady_clock::now().time_since_epoch().count();
+ for(unsigned attempt=0;;++attempt){
+ path=parent/(L"veyra-preset-library-tests-"+std::to_wstring(stamp)+L"-"+std::to_wstring(attempt));
+ if(std::filesystem::create_directory(path))break;
+ }
+ }
+ ~ScratchDirectory(){std::error_code ec;std::filesystem::remove_all(path,ec);}
+ };
+ static const ScratchDirectory dir;
+ auto path = dir.path / name;
std::error_code ec;
std::filesystem::remove(path, ec);
return path;
@@ -1301,8 +1314,75 @@ __declspec(noinline) void testEffectNodeStorage() {
ChainSessionStore reopened(sessionPath);
check(reopened.load(*restored) && *restored == *session, "effects session: anti-aliasing round-trips through the session");
}
+
+// DLAA (method 3, 2026-11-08): readers up to library v19 / session v14 refuse the
+// value, so a library or session holding it gets its own version and file.
+__declspec(noinline) void testDlaaStorage() {
+ AntiAliasSettings dlaa; dlaa.enabled = true; dlaa.method = AntiAliasMethod::Dlaa; dlaa.quality = 0;
+ check(dlaa.validate().empty() && dlaa.usesDlaa(), "dlaa: method 3 with no tier is valid");
+ auto tiered = dlaa; tiered.quality = 1;
+ check(!tiered.validate().empty(), "dlaa: a quality tier is refused (DLAA has none)");
+ auto temporal = dlaa; temporal.temporal = AntiAliasTemporal::T2x;
+ check(!temporal.validate().empty(), "dlaa: the experimental SMAA accumulation is refused");
+ {
+ std::ostringstream o; o.imbue(std::locale::classic()); writeAntiAlias(o, dlaa);
+ std::istringstream in(o.str()); in.imbue(std::locale::classic()); AntiAliasSettings back;
+ check(readAntiAlias(in, back) && back == dlaa, "dlaa: the node block round-trips");
+ std::istringstream four("1 4 0 0.08 1 0 0.5 8"); four.imbue(std::locale::classic()); AntiAliasSettings bad;
+ check(!readAntiAlias(four, bad), "dlaa: method 4 stays refused");
+ }
+ const auto path = scratch(L"dlaa-library.v1");
+ const auto sidecar = std::filesystem::path(path).concat(L".dlaa");
+ std::filesystem::remove(sidecar);
+ PresetLibrary writer(path); writer.setIncludeBuiltins(false);
+ auto settings = sample();
+ settings.antiAlias.enabled = true; settings.antiAlias.method = AntiAliasMethod::Mlaa; settings.antiAlias.quality = 0;
+ auto mlaa = std::make_unique<PresetEntry>(); mlaa->name = L"mlaa"; mlaa->chain = toChain(settings);
+ check(writer.load() && writer.put(*mlaa), "dlaa storage: seed a library with an MLAA node");
+ const auto original = readBytes(path);
+ const auto before = std::filesystem::path(path).concat(L".effects");
+ const auto seeded = std::filesystem::exists(before) ? readBytes(before) : original;
+ check(!seeded.starts_with("VEYRA_PRESET_LIBRARY 20") && !std::filesystem::exists(sidecar), "dlaa storage: no DLAA keeps the older version and files");
+ settings.antiAlias = dlaa;
+ auto entry = std::make_unique<PresetEntry>(); entry->name = L"dlaa"; entry->chain = toChain(settings);
+ check(writer.put(*entry), "dlaa storage: save a DLAA chain");
+ const auto written = std::filesystem::exists(std::filesystem::path(before).concat(L".dlaa")) ? std::filesystem::path(before).concat(L".dlaa") : sidecar;
+ check(readBytes(written).starts_with("VEYRA_PRESET_LIBRARY 20\n") && readBytes(path) == original &&
+ (!std::filesystem::exists(before) || readBytes(before) == seeded),
+ "dlaa storage: v20 goes to its own file and the older libraries stay intact");
+ {
+ PresetLibrary reader(path); reader.setIncludeBuiltins(false);
+ check(reader.load() && reader.entries().size() == 2 && reader.entries()[1].chain == entry->chain,
+ "dlaa storage: the DLAA chain reloads exactly");
+ auto applied = sample(); PresetLibrary::apply(reader.entries()[1], applied);
+ check(applied.antiAlias == dlaa, "dlaa storage: applying the chain restores DLAA");
+ }
+ // A v19 header cannot carry method 3.
+ auto downgraded = readBytes(written);
+ downgraded.replace(0, std::string("VEYRA_PRESET_LIBRARY 20").size(), "VEYRA_PRESET_LIBRARY 19");
+ const auto downgradedPath = scratch(L"dlaa-downgraded.v1");
+ { std::ofstream f(downgradedPath, std::ios::binary); f << downgraded; }
+ {
+ PresetLibrary reader(downgradedPath); reader.setIncludeBuiltins(false);
+ check(!reader.load() || reader.entries().size() < 2, "dlaa storage: DLAA under a v19 header is refused");
+ }
+ const auto sessionPath = scratch(L"dlaa-session.v1");
+ std::filesystem::remove(std::filesystem::path(sessionPath).concat(L".dlaa"));
+ auto session = std::make_unique<ChainSession>(ChainSession::initial(sample()));
+ ChainSessionStore sessions(sessionPath);
+ check(sessions.save(*session), "dlaa session: save the older format first");
+ const auto rollback = readBytes(sessionPath);
+ session->configurations[0].chain = toChain(settings);
+ check(sessions.save(*session) && readBytes(sessionPath) == rollback &&
+ readBytes(std::filesystem::path(sessionPath).concat(L".dlaa")).starts_with("VEYRA_CHAIN_SESSION 15"),
+ "dlaa session: v15 goes to its own file beside the older session");
+ auto restored = std::make_unique<ChainSession>();
+ ChainSessionStore reopened(sessionPath);
+ check(reopened.load(*restored) && *restored == *session, "dlaa session: DLAA round-trips through the session");
+}
int main() {
testEffectNodeStorage();
+ testDlaaStorage();
testBeautyNodeStorage();
testDlssSrModels();
testSrStageStorage();