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(latency): review fixes for NVIDIA low latency and capture latency A/B
Veyra Goal Agente7a9ae1e72f7
diff --git a/AGENTS.md b/AGENTS.mdindex c741feef..9d8b8088 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -1,6 +1,6 @@# Veyra Agent 工作规则-> **2026-10-28/29英伟达低延迟任务**:当前隔离分支`codex/nvidia-low-latency-20261028`,基线main4351bbd;用户授权完善Reflex并改为“英伟达低延迟:关/开/开+增强”。直接NVAPI,源帧Sleep与生成帧带外队列标记分开;当前本机DLSS/VFG/FSR原生路径验证,XeSS保持提供方调度并显示不生效。真实证据、失败修正和硬件边界见`docs/NVIDIA_LOW_LATENCY_2026-10-28.md`与`reports/nvidia-low-latency-20261028/FINAL.json`。不合并main、不push/Release,不改真实配置、驱动、SDK/模型/DLL;使用私有测试配置。+> **2026-10-28/29英伟达低延迟任务**:当前隔离分支`codex/nvidia-low-latency-20261028`,基线main4351bbd;用户授权完善Reflex并改为“英伟达低延迟:关/开/开+增强”。直接NVAPI,源帧Sleep与生成帧带外队列标记分开;当前本机DLSS/VFG/FSR原生路径验证,XeSS保持提供方调度并显示不生效。真实证据、失败修正和硬件边界见`docs/NVIDIA_LOW_LATENCY_2026-10-28.md`与`reports/nvidia-low-latency-20261028/FINAL.json`。2026-10-29 Claude复查修正(非英伟达显卡低排队归属、状态逐段翻译、摘要、未补帧通知降级)与屏幕采集延迟对比已提交到本分支(未合并main),见执行记录末节及`reports/claude-nvidia-ll-review-20261029/FINAL.json`。不合并main、不push/Release,不改真实配置、驱动、SDK/模型/DLL;使用私有测试配置。> **2026-10-28后续(用户选择)**:同分支新增“超分后缩回到”超采样选项:单次RTX视频超分到目标尺寸,再线性光精确缩回`srOutput`,NR/补帧/显示按缩回尺寸运行;双重开启时不用、保留选择。复用`srOutput`字段与`SrResolve`,导出协议14,超采样图同双重图走WDDM预算准入。读`docs/SR_SUPERSAMPLE_2026-10-28.md`及`reports/claude-sr-supersample-20261028/FINAL.json`。用户随后要求直接合并:双重超分、复查修正与超采样已合入本地main(未push/Release),活动树切回main,其余限制同下条。diff --git a/docs/CURRENT_STATUS.md b/docs/CURRENT_STATUS.mdindex 6460d130..1c1facd3 100644--- a/docs/CURRENT_STATUS.md+++ b/docs/CURRENT_STATUS.md@@ -2,7 +2,7 @@更新:2026-10-28。这里只描述现在;历史过程见[历史索引](history/INDEX.md)。-2026-10-28/29当前任务:隔离分支`codex/nvidia-low-latency-20261028`完善“英伟达低延迟”三档(关/开/开+增强),基线为下述合并后的main4351bbd。直接NVAPI,生成帧不重复Sleep;DLSS/VFG/FSR与提供方回退、GUI/保存验证见[执行记录](NVIDIA_LOW_LATENCY_2026-10-28.md)。尚未合并main或发布,正式版仍2.1.1。+2026-10-28/29当前任务:隔离分支`codex/nvidia-low-latency-20261028`完善“英伟达低延迟”三档(关/开/开+增强),基线为下述合并后的main4351bbd。直接NVAPI,生成帧不重复Sleep;DLSS/VFG/FSR与提供方回退、GUI/保存验证见[执行记录](NVIDIA_LOW_LATENCY_2026-10-28.md)。2026-10-29 Claude复查后在同分支工作区修正非英伟达显卡低排队关不掉、状态翻译、专业页摘要与未补帧通知降级,并做屏幕采集延迟对比(已提交到本分支,结果见执行记录末节)。尚未合并main或发布,正式版仍2.1.1。## 正式版与开发基线diff --git a/docs/NVIDIA_LOW_LATENCY_2026-10-28.md b/docs/NVIDIA_LOW_LATENCY_2026-10-28.mdindex 54c9e507..d512698b 100644--- a/docs/NVIDIA_LOW_LATENCY_2026-10-28.md+++ b/docs/NVIDIA_LOW_LATENCY_2026-10-28.md@@ -41,3 +41,30 @@分支本地提交、main保持4351bbd,不push/Release。复用tests/claude-sr-stage-20261028/app,以新文件替换EXE/QML,不写穿供体硬链接;97个运行组件与正式供体及其1730文件manifest复核。独立交互入口tests/nvidia-low-latency-20261028/启动英伟达低延迟测试.cmd,不使用原用户配置。reports/logs/tests/tmp对应任务目录保留必要回执、原失败证据和脚本;收尾仅清本轮唯一数字TEMP目录中的重建缓存,实际逻辑删除量记录FINAL,不将逻辑字节冒充物理净回收。原8K NR/VFG整机卡死组合未复测,Lecram继续暂停。++## Claude复查修正(2026-10-29)++用户请Claude复查本分支后选择“修完再测效果”。复查在本机实测确认1个bug和2个界面问题,另从代码看出1个隐患;四处修正已提交到本分支,未合并main。++1. **非英伟达运算显卡上低延迟队列关不掉(bug,实测复现)**:保存过开/开+增强后把运算显卡切到AMD核显,旧“低延迟队列”开关关掉后引擎仍`requested=false effective=true`。现由`PresentationSettings.h`的`syncNvidiaLowLatencyQueue`统一归属:英伟达显卡上三档决定低排队(关不会再留下隐藏低排队),其他显卡由普通开关决定,英伟达选择只保留到下次回到英伟达显卡;`VideoPresenter::configurePresentation`只在英伟达适配器上把三档折算为低排队,其他适配器把它当关。启动、切换运算显卡和改档位都按同一规则归一;其他显卡上英伟达控件显示“关”且变灰。+2. **英文/日文/繁中界面状态里中文片段不翻译(实测)**:原因是状态由带“ · ”尾巴或含“;”的字面量拼接,运行时按分隔符拆开后查不到。现在状态行由不含分隔符的片段统一以“ · ”拼接;新增/改写17条翻译,“英伟达低延迟:关”、XeSS、回退提示以及同一行原有的显示同步/屏幕队列片段都能完整翻译。+3. **专业页“已开启”摘要仍写“低延迟队列”(实测)**:英伟达显卡上改为“英伟达低延迟 · 开/开+增强”,驱动回退或XeSS接管时显示“英伟达低延迟 · 当前未生效”。+4. **未补帧时也要求带外队列通知成功(代码隐患)**:通知失败时,未补帧改为退回设备内标记、照常Sleep;补帧仍必须有带外队列,否则不启用。++另:`ReflexSession`在关闭日志里记录驱动Sleep实际耗时(`sleepMeanMs/sleepMaxMs`),用于判断“开”档到底让源帧等了多久;`PresentationPacingTests`新增`latency-screen`/`latency-screen-sr`屏幕采集延迟对比场景(档位-1关、0仅低排队、1开、2开+增强)。++### 修正后验证++- 构建:五目标78.6秒,增量16.4/4.4秒,退出0;新增代码无新警告。EXE/测速程序/1个QML/翻译以新文件写入`tests/claude-sr-stage-20261028/app`,97个运行组件与2.1.1供体一致。+- RepairContract 300项0失败(新增归属规则4项、通知失败3项);i18n 0失败(新增两条英文状态);QtQuick 117/0/1既有跳过。+- 真实GUI:AMD核显上关低排队后`requested=false effective=false`,英伟达控件显示“关”;切回英伟达重开后开+增强恢复并由驱动启用。英文界面关/开/开+增强在自动与垂直同步下状态均无中文残留,摘要显示“NVIDIA Low Latency · On + Boost”。原配置SHA不变,Main.qml复原,无QML错误。+- GPU回归9组全部通过:plain开/增强、DLSS 2X/6X、VFG 2X、FSR 2X、XeSS回退、NR+SR+DLSS、生命周期。++### 效果实测(本机RTX5070,屏幕采集代替采集卡)++- **驱动几乎不让程序等**:所有用例里`NvAPI_D3D_Sleep`平均约0.002毫秒、最长0.13毫秒(文件播放、各补帧后端、NR+SR+补帧、60fps窗口采集都一样)。Veyra自己的调度已经不让帧排队,Reflex没有可削减的排队。+- **GPU处理时间不变**:窗口采集各档GPU处理p50都在0.68–0.74毫秒;本机显卡空闲也停在P0满频,增强档无从加速。+- **无补帧窗口采集有与本功能无关的旧问题**:呈现时间按第一帧锚定,第一帧读得多晚,整场每帧就固定多等多久;8轮里这段固定等待p50为3.1–52毫秒,而读到GPU完成始终不到1毫秒;打开低排队时,等待超过一帧间隔还会把下一帧的读取再推迟约15毫秒。采集卡(无补帧时按就绪呈现)和串流(逐帧重新锚定)不受影响。因此无补帧的绝对延迟不能拿来比较档位,只比较读帧与GPU阶段:四档无差别。+- **补帧窗口采集(每帧重新锚定,可直接比较)**:60fps窗口采集、显示同步自动,档位-1/0/1/2各两轮(ABCD DCBA,每轮10秒)。DLSS 2X:采集到呈现p50为关16.88–17.03、仅低排队16.89–16.96、开16.87–17.01、开+增强16.94–16.98毫秒;SR 4K+DLSS 2X:关18.03–18.05、仅低排队17.93–18.00、开18.01–18.04、开+增强18.06–18.15毫秒。档位差别都不到0.2毫秒,在两轮波动之内;其中约16.5毫秒是补帧必须等下一帧的固定前瞻,GPU处理(含SR)约1–2.4毫秒,各档相同。+- **垂直同步下同样无差别**:DLSS 2X窗口采集、显示同步改垂直同步,p50为关16.91–17.05、仅低排队16.87、开16.89–16.91、开+增强16.91–16.99毫秒。+- **结论(仅本机)**:在文件播放、补帧、SR+补帧、窗口采集(自动/垂直同步)下,开与开+增强相对关或原低延迟队列都没有可测的延迟收益;驱动Sleep几乎为零说明Veyra调度本身已不排队。增强档在会降频的显卡上可能缩短1–4毫秒级的GPU处理但增加功耗,本机无法验证。未测采集卡、串流主机、30/40系和屏幕光电延迟。diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex f2607088..851b1651 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -145,3 +145,17 @@ A/B(GTA VI原生4K两帧,全部质量4,完整表见DUAL_SR_PLAN“复查入口`E:/项目/Veyra/tests/nvidia-low-latency-20261028/启动英伟达低延迟测试.cmd`使用私有interactive-profile,初始关闭、不自动开媒体;启动冒烟退出0。运行目录仍`tests/claude-sr-stage-20261028/app`。回执/脚本`reports/nvidia-low-latency-20261028`,日志`logs/nvidia-low-latency-20261028`,截图`tests/nvidia-low-latency-20261028/controls.png`,执行细节`docs/NVIDIA_LOW_LATENCY_2026-10-28.md`。未测30/40系持卡、采集卡、真实VRR/物理屏幕端延迟与长时稳定性;不重跑原8K最终输出+NR+VFG整机卡死组合。主线仍4351bbd,正式版仍2.1.1;本分支本地提交哈希与干净状态写入FINAL,不push/Release。Lecram继续暂停。++## 2026-10-29 英伟达低延迟复查修正与效果实测(Claude)++用户请Claude复查Codex的`4edcb49`后选择“修完再测效果”。修正提交到同分支,未合并main、未push/Release;真实配置、驱动、SDK/模型/DLL不动,测试全部用私有data-dir。++复查实测(修前,`reports/claude-nvidia-ll-review-20261029/ui-amd.json`、`ui-en.json`):保存开+增强后把运算显卡切到本机AMD核显,关掉旧“低延迟队列”后引擎仍`requested=false effective=true`;英文界面状态显示“英伟达低延迟:关 · Display sync: allow tearing”;专业页摘要只写“低延迟队列”。另从代码看出未补帧时带外队列通知失败会整段降级。DLSS 6X文件播放关/仅低排队/开/开+增强各两轮(`fg-ab.json`)均180帧/秒、生成帧0过期,四档无可测差别。本机RTX5070在Veyra关闭时也停在P0约2730MHz,增强档在本机测不出时钟/功耗差别。++修正:`syncNvidiaLowLatencyQueue`统一低排队归属(英伟达上三档决定,其他显卡普通开关决定、英伟达选择只保留),`configurePresentation`只在英伟达适配器上折算;状态行改为无分隔符片段拼接并补17条翻译(`extract.py`→填写→`--check`缺失0);摘要显示英伟达三档;未补帧时通知失败退回设备内标记。附带:关闭日志记录驱动Sleep耗时,测试程序新增`latency-screen[-sr]`屏幕采集场景。++构建(`tmp/claude-nvidia-ll-review-20261029/build/build.py`,并发2):五目标78.6秒、增量16.4/4.4秒退出0;新增代码无新警告(日志中C4244来自既有PreviewView.h)。暂存:EXE、测速程序、1个QML、翻译以新文件写入`tests/claude-sr-stage-20261028/app`,97个运行组件与2.1.1供体manifest一致。++验证(脚本`tmp/claude-nvidia-ll-review-20261029/review.py`,每项≤300秒):RepairContract 300项0失败(新增7项:归属规则4项、通知失败3项);i18n 0失败(新增英文状态两项);QtQuick 117/0/1既有跳过。真实GUI:AMD核显上关低排队后`requested=false effective=false`,英伟达控件显示“关”;切回英伟达重开后开+增强恢复且驱动已启用;英文界面关/开/开+增强在自动与垂直同步下状态无中文残留,摘要“NVIDIA Low Latency · On + Boost”。两次GUI前后原配置SHA不变、Main.qml复原,无QML错误。GPU回归9组(plain开/增强、DLSS 2X/6X、VFG、FSR、XeSS回退、NR+SR+DLSS、生命周期)全部通过;驱动Sleep平均约0.002毫秒、最长0.13毫秒。++效果实测(`review.py latency <场景> <倍率> 10 <显示同步>`,档位-1关/0仅低排队/1开/2开+增强各两轮,窗口采集60fps代替采集卡;拆分脚本`latency_split.py`):驱动Sleep平均约0.003毫秒;DLSS 2X窗口采集四档采集到呈现p50 16.87–17.03毫秒,SR 4K+DLSS 2X 17.93–18.15毫秒,档位差别<0.2毫秒;GPU处理各档相同。无补帧窗口采集另发现与本功能无关的旧问题:呈现按首帧锚定,整场固定多等3.1–52毫秒(读到GPU完成<1毫秒),因此无补帧绝对延迟不用于档位比较。垂直同步DLSS 2X四档p50 16.87–17.05毫秒,同样无差别。未测采集卡、串流、30/40系与屏幕光电延迟。diff --git a/i18n/catalog.json b/i18n/catalog.jsonindex c28d6e1c..6d472243 100644--- a/i18n/catalog.json+++ b/i18n/catalog.json@@ -266,13 +266,6 @@"en": " · calibrating","ja": " · 補正中"},- {- "zh": " · 此补帧提供方暂不支持独立输出限帧;已保留设置",- "src": "src/engine/VideoPresenter.cpp",- "zh-TW": " · 此補幀提供方暫不支援獨立輸出限幀;已保留設定",- "en": " · this frame generation provider cannot cap its own output yet; setting kept",- "ja": " · このフレーム生成方式は出力上限を個別に設定できません。設定は保持しました"- },{"zh": " · 等待 ","src": "qml/ExportPage.qml",@@ -2332,11 +2325,11 @@"ja": "XeSS はエンコード可能な補間テクスチャを公開していません。書き出しには FSR、DLSS または VFG を選択してください。"},{- "zh": "XeSS 提供方自行调度:英伟达低延迟与输出上限不生效,选择已保留 · ",+ "zh": "XeSS 提供方自行调度:英伟达低延迟与输出上限不生效,选择已保留","src": "src/engine/VideoPresenter.cpp",- "zh-TW": "XeSS 提供方自行調度:NVIDIA 低延遲與輸出上限不生效,選擇已保留 · ",- "en": "XeSS owns scheduling: NVIDIA Low Latency and output cap are inactive; selections retained · ",- "ja": "XeSS がスケジュールを管理:NVIDIA 低遅延と出力制限は無効です。選択は保持されます · "+ "zh-TW": "XeSS 提供方自行調度:NVIDIA 低延遲與輸出上限不生效,選擇已保留",+ "en": "XeSS owns scheduling: NVIDIA Low Latency and output cap are inactive; selections retained",+ "ja": "XeSS がスケジュールを管理:NVIDIA 低遅延と出力制限は無効です。選択は保持されます"},{"zh": "XeSS 未启用:运行时或设备不兼容;当前为普通呈现",@@ -2660,6 +2653,13 @@"en": "Don't forward this PC's controller input to the PS5","ja": "この PC のコントローラー入力を PS5 に転送しない"},+ {+ "zh": "不撕裂,也不等待垂直同步(延迟最低)",+ "src": "src/engine/VideoPresenter.cpp",+ "zh-TW": "不撕裂,也不等待垂直同步(延遲最低)",+ "en": "no tearing and no VSync wait (lowest latency)",+ "ja": "ティアリングなし、垂直同期を待たない(最小遅延)"+ },{"zh": "不支持","src": "src/ui/bridge/FrameGeneration.cpp",@@ -5280,11 +5280,11 @@"ja": "可変リフレッシュ · ドライバーの確認待ち"},{- "zh": "可变刷新:超过屏幕最高刷新时只排 1 帧 · ",+ "zh": "可变刷新:超过屏幕最高刷新时只排 1 帧","src": "src/engine/VideoPresenter.cpp",- "zh-TW": "可變刷新:超過螢幕最高刷新時只排 1 幀 · ",- "en": "Variable refresh: only 1 frame queued above the display maximum · ",- "ja": "可変リフレッシュ:画面の最大リフレッシュを超えると 1 フレームだけキュー · "+ "zh-TW": "可變刷新:超過螢幕最高刷新時只排 1 幀",+ "en": "Variable refresh: only 1 frame queued above the display maximum",+ "ja": "可変リフレッシュ:画面の最大リフレッシュを超えると 1 フレームだけキュー"},{"zh": "可用",@@ -5805,18 +5805,18 @@"ja": "垂直同期"},{- "zh": "垂直同步:屏幕队列 1 帧,读帧前等待刷新 · ",+ "zh": "垂直同步:屏幕队列 1 帧,读帧前等待刷新","src": "src/engine/VideoPresenter.cpp",- "zh-TW": "垂直同步:螢幕佇列 1 幀,讀幀前等待刷新 · ",- "en": "VSync: 1-frame display queue, waits for refresh before reading a frame · ",- "ja": "垂直同期:画面キュー 1 フレーム、フレーム読み込み前にリフレッシュを待機 · "+ "zh-TW": "垂直同步:螢幕佇列 1 幀,讀幀前等待刷新",+ "en": "VSync: 1-frame display queue, waits for refresh before reading a frame",+ "ja": "垂直同期:画面キュー 1 フレーム、フレーム読み込み前にリフレッシュを待機"},{- "zh": "垂直同步:屏幕队列控制不可用 · ",+ "zh": "垂直同步:屏幕队列控制不可用","src": "src/engine/VideoPresenter.cpp",- "zh-TW": "垂直同步:螢幕佇列控制不可用 · ",- "en": "VSync: display queue control unavailable · ",- "ja": "垂直同期:画面キュー制御は使用できません · "+ "zh-TW": "垂直同步:螢幕佇列控制不可用",+ "en": "VSync: display queue control unavailable",+ "ja": "垂直同期:画面キュー制御は使用できません"},{"zh": "基础设置",@@ -7099,6 +7099,13 @@"en": "The display is in variable refresh (enabled by the driver)","ja": "ディスプレイは可変リフレッシュ中(ドライバーで有効)"},+ {+ "zh": "屏幕跟着画面刷新,不撕裂",+ "src": "src/engine/VideoPresenter.cpp",+ "zh-TW": "螢幕跟著畫面更新,不撕裂",+ "en": "the display refreshes with each frame, no tearing",+ "ja": "画面がフレームに合わせて更新、ティアリングなし"+ },{"zh": "屏幕跟着画面刷新:不撕裂,也几乎不用等刷新","src": "src/ui/bridge/FrameGeneration.cpp",@@ -7708,6 +7715,13 @@"en": "VRR presentation requested; the driver has not confirmed activation. Check windowed/fullscreen G-SYNC settings. This does not mean the driver setting is off.","ja": "VRR 表示を要求しましたが、ドライバーはまだ動作を確認していません。ウィンドウ/全画面の G-SYNC 設定を確認できます。この状態は設定がオフという意味ではありません。"},+ {+ "zh": "已请求,等待驱动确认",+ "src": "src/engine/VideoPresenter.cpp",+ "zh-TW": "已請求,等待驅動確認",+ "en": "requested, awaiting driver confirmation",+ "ja": "要求済み、ドライバーの確認待ち"+ },{"zh": "已达到导入上限(最多10000项),其余文件未添加","src": "src/ui/PlaylistModel.cpp",@@ -10349,25 +10363,18 @@"ja": "表示の同期:垂直同期"},{- "zh": "显示同步:自动 + 可变刷新 · 屏幕跟着画面刷新,不撕裂",- "src": "src/engine/VideoPresenter.cpp",- "zh-TW": "顯示同步:自動 + 可變更新 · 螢幕跟著畫面更新,不撕裂",- "en": "Display sync: auto + variable refresh · the display refreshes with each frame, no tearing",- "ja": "表示の同期:自動 + 可変リフレッシュ · 画面がフレームに合わせて更新、ティアリングなし"- },- {- "zh": "显示同步:自动 + 可变刷新 · 已请求,等待驱动确认",+ "zh": "显示同步:自动","src": "src/engine/VideoPresenter.cpp",- "zh-TW": "顯示同步:自動 + 可變更新率 · 已請求,等待驅動確認",- "en": "Display sync: Auto + variable refresh · requested, awaiting driver confirmation",- "ja": "表示同期:自動 + 可変リフレッシュ · 要求済み、ドライバーの確認待ち"+ "zh-TW": "顯示同步:自動",+ "en": "Display sync: auto",+ "ja": "表示の同期:自動"},{- "zh": "显示同步:自动 · 不撕裂,也不等待垂直同步(延迟最低)",+ "zh": "显示同步:自动 + 可变刷新","src": "src/engine/VideoPresenter.cpp",- "zh-TW": "顯示同步:自動 · 不撕裂,也不等待垂直同步(延遲最低)",- "en": "Display sync: auto · no tearing and no VSync wait (lowest latency)",- "ja": "表示の同期:自動 · ティアリングなし、垂直同期を待たない(最小遅延)"+ "zh-TW": "顯示同步:自動 + 可變更新",+ "en": "Display sync: auto + variable refresh",+ "ja": "表示の同期:自動 + 可変リフレッシュ"},{"zh": "显示器",@@ -10433,11 +10440,11 @@"ja": "マスクを表示"},{- "zh": "显示队列恢复失败 · ",+ "zh": "显示队列恢复失败","src": "src/engine/VideoPresenter.cpp",- "zh-TW": "顯示佇列恢復失敗 · ",- "en": "Display queue could not be restored · ",- "ja": "表示キューを復元できませんでした · "+ "zh-TW": "顯示佇列恢復失敗",+ "en": "Display queue could not be restored",+ "ja": "表示キューを復元できませんでした"},{"zh": "显示队列等待失败,垂直同步屏幕队列不再限制;详见日志",@@ -11846,6 +11853,13 @@"en": "This version does not include Magewell SDK support","ja": "このバージョンには Magewell SDK のサポートが含まれていません"},+ {+ "zh": "此补帧提供方暂不支持独立输出限帧,已保留设置",+ "src": "src/engine/VideoPresenter.cpp",+ "zh-TW": "此補幀提供方暫不支援獨立輸出限幀,已保留設定",+ "en": "this frame generation provider cannot cap its own output yet; setting kept",+ "ja": "このフレーム生成方式は出力上限を個別に設定できません。設定は保持しました"+ },{"zh": "此软件包没有附带性能模式所需的 DLSS 帧生成 310.9.16 运行库","src": "src/ui/bridge/FrameGeneration.cpp",@@ -14458,18 +14472,39 @@"ja": "NVIDIA 低遅延"},{- "zh": "英伟达低延迟不可用,当前使用低排队;详见日志",+ "zh": "英伟达低延迟 · 开",+ "src": "src/ui/bridge/Status.cpp",+ "zh-TW": "NVIDIA 低延遲 · 開",+ "en": "NVIDIA Low Latency · On",+ "ja": "NVIDIA 低遅延 · オン"+ },+ {+ "zh": "英伟达低延迟 · 开+增强",+ "src": "src/ui/bridge/Status.cpp",+ "zh-TW": "NVIDIA 低延遲 · 開+增強",+ "en": "NVIDIA Low Latency · On + Boost",+ "ja": "NVIDIA 低遅延 · オン+ブースト"+ },+ {+ "zh": "英伟达低延迟 · 当前未生效",+ "src": "src/ui/bridge/Status.cpp",+ "zh-TW": "NVIDIA 低延遲 · 目前未生效",+ "en": "NVIDIA Low Latency · currently inactive",+ "ja": "NVIDIA 低遅延 · 現在無効"+ },+ {+ "zh": "英伟达低延迟不可用,当前使用低排队(详见日志)","src": "src/engine/VideoPresenter.cpp",- "zh-TW": "NVIDIA 低延遲無法使用,目前使用低排隊;詳見記錄",- "en": "NVIDIA Low Latency unavailable; using low queue depth. See logs.",- "ja": "NVIDIA 低遅延は利用できません。低遅延キューを使用中です。ログをご確認ください。"+ "zh-TW": "NVIDIA 低延遲無法使用,目前使用低排隊(詳見記錄)",+ "en": "NVIDIA Low Latency unavailable; using low queue depth (see the log)",+ "ja": "NVIDIA 低遅延は利用できません。低遅延キューを使用中です(ログを参照)"},{- "zh": "英伟达低延迟撤销失败;请关闭视频后重试 · ",+ "zh": "英伟达低延迟撤销失败,请关闭视频后重试","src": "src/engine/VideoPresenter.cpp",- "zh-TW": "NVIDIA 低延遲停用失敗;請關閉影片後重試 · ",- "en": "Could not disable NVIDIA Low Latency; close the video and retry · ",- "ja": "NVIDIA 低遅延を無効にできません。動画を閉じて再試行してください · "+ "zh-TW": "NVIDIA 低延遲停用失敗,請關閉影片後重試",+ "en": "Could not disable NVIDIA Low Latency; close the video and retry",+ "ja": "NVIDIA 低遅延を無効にできません。動画を閉じて再試行してください"},{"zh": "英伟达低延迟调用及撤销失败;请关闭视频后重试",@@ -14486,18 +14521,11 @@"ja": "NVIDIA 低遅延の呼び出しに失敗しました。低遅延キューを使用中です。ログをご確認ください。"},{- "zh": "英伟达低延迟需要 NVIDIA 显卡,当前使用低排队",- "src": "src/engine/VideoPresenter.cpp",- "zh-TW": "NVIDIA 低延遲需要 NVIDIA 顯示卡,目前使用低排隊",- "en": "NVIDIA Low Latency requires an NVIDIA GPU; using low queue depth",- "ja": "NVIDIA 低遅延には NVIDIA GPU が必要です。低遅延キューを使用中です"- },- {- "zh": "英伟达低延迟:关 · ",+ "zh": "英伟达低延迟:关","src": "src/engine/VideoPresenter.cpp",- "zh-TW": "NVIDIA 低延遲:關 · ",- "en": "NVIDIA Low Latency: Off · ",- "ja": "NVIDIA 低遅延:オフ · "+ "zh-TW": "NVIDIA 低延遲:關",+ "en": "NVIDIA Low Latency: Off",+ "ja": "NVIDIA 低遅延:オフ"},{"zh": "英伟达低延迟:开(已启用)",diff --git a/include/veyra/engine/PresentationSettings.h b/include/veyra/engine/PresentationSettings.hindex 841a2774..d85187db 100644--- a/include/veyra/engine/PresentationSettings.h+++ b/include/veyra/engine/PresentationSettings.h@@ -31,6 +31,16 @@ struct PresentationSettings {bool operator==(const PresentationSettings&) const = default;bool valid()const{return unsigned(mode)<=2&&unsigned(display)<=2&&unsigned(outputRate)<=2&&unsigned(nvidiaLowLatency)<=2&&std::isfinite(customFps)&&customFps>=1.0&&customFps<=1000.0;}};+// Who owns the low queue in the interface: on an NVIDIA adapter the three+// NVIDIA states (开/开+增强 imply it, 关 clears it); on another adapter the+// plain low-queue switch, and the NVIDIA choice is only kept for the next+// NVIDIA session. Returns whether `enabled` had to change (review 2026-10-29:+// a kept 开+增强 used to force the queue on an AMD compute GPU for good).+constexpr bool syncNvidiaLowLatencyQueue(PresentationSettings& p,bool nvidiaAdapter){+ const bool queue=p.nvidiaLowLatency!=NvidiaLowLatency::Off;+ if(!nvidiaAdapter||p.enabled==queue)return false;+ p.enabled=queue;return true;+}// Automatic never waits for vertical sync and never requests tearing: a// flip-model Present(0, 0) replaces a frame that has not been shown yet at the// next refresh, so the newest finished frame is the one shown and nothingdiff --git a/include/veyra/gfx/ReflexSession.h b/include/veyra/gfx/ReflexSession.hindex f023a1c9..c085d1db 100644--- a/include/veyra/gfx/ReflexSession.h+++ b/include/veyra/gfx/ReflexSession.h@@ -1,6 +1,8 @@#pragma once#include <windows.h>#include <d3d12.h>+#include <algorithm>+#include <chrono>#include <cstdint>#include <format>#include "veyra/Log.h"@@ -38,7 +40,8 @@ public:active_=false;if(driverEnabled_&&api_.set){SleepParams p{};p.version=sizeof(p)|(1u<<16);const int r=api_.set(device_,&p);- log::info("reflex",std::format("disable status={} successfulSleeps={} successfulMarkers={} oobMarkers={} realPresents={} generatedPresents={}",r,sleeps_,markers_,oobMarkers_,realPresents_,generatedPresents_));+ log::info("reflex",std::format("disable status={} successfulSleeps={} sleepMeanMs={:.3f} sleepMaxMs={:.3f} successfulMarkers={} oobMarkers={} realPresents={} generatedPresents={}",+ r,sleeps_,sleeps_?sleepUs_/1000.0/double(sleeps_):0.0,maxSleepUs_/1000.0,markers_,oobMarkers_,realPresents_,generatedPresents_));if(r){failed_=true;return false;}driverEnabled_=false;}return true;@@ -54,12 +57,15 @@ public:if(queue&&api_.notify){const int r=api_.notify(queue,3); // OUT_OF_BAND_RENDER_PRESENTlog::info("reflex",std::format("present queue out-of-band status={}",r));- if(r)return false;queueMarkers_=true;+ // Only generated frames need the out-of-band queue. Source Sleep and+ // in-band markers ran without it before frame generation support.+ if(r&&generated)return false;+ queueMarkers_=r==0;}SleepParams p{};p.version=sizeof(p)|(1u<<16);p.low=1;p.boost=boost;p.markers=1;const int r=api_.set(device_,&p);log::info("reflex",std::format("enable status={} intervalUs=0 boost={} frameGeneration={} queueMarkers={}",r,boost,generated,queueMarkers_));- sleeps_=markers_=oobMarkers_=realPresents_=generatedPresents_=0;firstFrame_=next_+1;+ sleeps_=sleepUs_=maxSleepUs_=markers_=oobMarkers_=realPresents_=generatedPresents_=0;firstFrame_=next_+1;return active_=driverEnabled_=r==0;}void mark(uint64_t frame,uint32_t type){@@ -70,8 +76,12 @@ public:}uint64_t begin(){if(!active_)return 0;+ // How long the driver really holds the source read, for the disable log.+ const auto start=std::chrono::steady_clock::now();const int r=api_.sleep(device_);if(r){fail("sleep",r);return 0;}- ++sleeps_;const auto frame=++next_;mark(frame,0);return active_?frame:0;+ const auto us=uint64_t(std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::steady_clock::now()-start).count());+ ++sleeps_;sleepUs_+=us;maxSleepUs_=std::max(maxSleepUs_,us);+ const auto frame=++next_;mark(frame,0);return active_?frame:0;}void renderStart(uint64_t frame){mark(frame,1);mark(frame,2);}void renderEnd(uint64_t frame){if(queueMarkers_)mark(frame,3);}@@ -114,6 +124,6 @@ private:}DriverApi api_{};HMODULE module_=nullptr;ID3D12Device* device_=nullptr;ID3D12CommandQueue* queue_=nullptr;bool initialized_=false,active_=false,driverEnabled_=false,boost_=false,generated_=false,queueMarkers_=false,failed_=false;- uint64_t next_=0,firstFrame_=1,presentId_=0,sleeps_=0,markers_=0,oobMarkers_=0,realPresents_=0,generatedPresents_=0;+ uint64_t next_=0,firstFrame_=1,presentId_=0,sleeps_=0,sleepUs_=0,maxSleepUs_=0,markers_=0,oobMarkers_=0,realPresents_=0,generatedPresents_=0;};}diff --git a/qml/Veyra/NvidiaLowLatencyEditor.qml b/qml/Veyra/NvidiaLowLatencyEditor.qmlindex 1c150d96..36bcd5eb 100644--- a/qml/Veyra/NvidiaLowLatencyEditor.qml+++ b/qml/Veyra/NvidiaLowLatencyEditor.qml@@ -15,7 +15,9 @@ ColumnLayout {enabled: root.availableopacity: enabled ? 1 : 0.4options: [{id:"0",label:qsTr("关")},{id:"1",label:qsTr("开")},{id:"2",label:qsTr("开+增强")}]- current: String(veyra.nvidiaLowLatency ?? 0)+ // Another adapter shows 关: the NVIDIA choice is kept for the next+ // NVIDIA session but does nothing there.+ current: root.available ? String(veyra.nvidiaLowLatency ?? 0) : "0"onPicked: id => veyra.nvidiaLowLatency=Number(id)}}diff --git a/src/engine/VideoPresenter.cpp b/src/engine/VideoPresenter.cppindex 3e1c748f..b666c39d 100644--- a/src/engine/VideoPresenter.cpp+++ b/src/engine/VideoPresenter.cpp@@ -555,7 +555,12 @@ double VideoPresenter::displayRefreshHz(){return refreshHz_;}PresentationSettings VideoPresenter::configurePresentation(gfx::D3D12DeviceContext& ctx,PresentationSettings requested,bool fg,std::wstring& status){- if(requested.nvidiaLowLatency!=NvidiaLowLatency::Off)requested.enabled=true;+ // The NVIDIA choice only runs on an NVIDIA adapter, where it implies the+ // low queue. Another adapter keeps the plain switch's value; the UI retains+ // the choice for the next NVIDIA session (syncNvidiaLowLatencyQueue).+ const bool nvidia=ctx.adapter().isNvidia;+ if(!nvidia)requested.nvidiaLowLatency=NvidiaLowLatency::Off;+ else if(requested.nvidiaLowLatency!=NvidiaLowLatency::Off)requested.enabled=true;bool wanted=requested.hdrFgCompatibility&©Eligible_;wchar_t copyOverride[4]{};if(GetEnvironmentVariableW(L"VEYRA_TEST_HDR_PRESENT_COPY",copyOverride,4)&©Override[1]==L'\0'){@@ -592,7 +597,7 @@ PresentationSettings VideoPresenter::configurePresentation(gfx::D3D12DeviceConte// Provider owns generated Present calls. Capping our real-frame input// would change the source cadence, not cap its final output.effective.outputRate=OutputRateMode::Off;- capNotice=L" · 此补帧提供方暂不支持独立输出限帧;已保留设置";+ capNotice=L"此补帧提供方暂不支持独立输出限帧,已保留设置";}// 可变刷新: when the applied monitor mode can request VRR, Automatic presents like// explicit Vsync - the G-SYNC/FreeSync + V-SYNC combination. Inside the@@ -608,8 +613,16 @@ PresentationSettings VideoPresenter::configurePresentation(gfx::D3D12DeviceConteif(vrrSync_){requested.display=DisplaySync::Vsync;effective.display=DisplaySync::Vsync;}const bool vsync=presentationVsync(requested),tearing=presentationTearing(requested);providerOwnedPresentation_=xessActive();- const std::wstring sync=vrrSync_?(gfx::vrrLevel(vrr_)>=4?L"显示同步:自动 + 可变刷新 · 屏幕跟着画面刷新,不撕裂":L"显示同步:自动 + 可变刷新 · 已请求,等待驱动确认"):requested.display==DisplaySync::Automatic?L"显示同步:自动 · 不撕裂,也不等待垂直同步(延迟最低)":vsync?L"显示同步:垂直同步":L"显示同步:允许撕裂";- if(!reflexDisabled){effective.enabled=false;effective.nvidiaLowLatency=NvidiaLowLatency::Off;sink_.configurePacing(false,vsync,tearing);status=L"英伟达低延迟撤销失败;请关闭视频后重试 · "+sync;return effective;}+ // The interface translates this line piece by piece at " · " and ";"+ // (UiLanguage), so every piece is its own catalog entry without separators.+ const auto join=[](std::initializer_list<std::wstring> pieces){+ std::wstring line;+ for(const auto& piece:pieces)if(!piece.empty())line+=(line.empty()?L"":L" · ")+piece;+ return line;+ };+ const std::wstring syncMode=vrrSync_?L"显示同步:自动 + 可变刷新":requested.display==DisplaySync::Automatic?L"显示同步:自动":vsync?L"显示同步:垂直同步":L"显示同步:允许撕裂";+ const std::wstring syncDetail=vrrSync_?(gfx::vrrLevel(vrr_)>=4?L"屏幕跟着画面刷新,不撕裂":L"已请求,等待驱动确认"):requested.display==DisplaySync::Automatic?L"不撕裂,也不等待垂直同步(延迟最低)":L"";+ if(!reflexDisabled){effective.enabled=false;effective.nvidiaLowLatency=NvidiaLowLatency::Off;sink_.configurePacing(false,vsync,tearing);status=join({L"英伟达低延迟撤销失败,请关闭视频后重试",syncMode,syncDetail});return effective;}if(xessActive()){// The provider owns Present for its generated frames, so neither the// latency waiter nor an output cap can reach them. Only the DXGI VSync@@ -618,7 +631,7 @@ PresentationSettings VideoPresenter::configurePresentation(gfx::D3D12DeviceConteeffective.nvidiaLowLatency=NvidiaLowLatency::Off;providerOwnedPresentation_=true;sink_.configurePacing(false,vsync,tearing);- status=L"XeSS 提供方自行调度:英伟达低延迟与输出上限不生效,选择已保留 · "+sync;+ status=join({L"XeSS 提供方自行调度:英伟达低延迟与输出上限不生效,选择已保留",syncMode,syncDetail});return effective;}providerOwnedPresentation_=false;@@ -634,21 +647,21 @@ PresentationSettings VideoPresenter::configurePresentation(gfx::D3D12DeviceConte// there would throttle presents to the refresh, the wait they avoid.const bool paced=vsync&&sink_.configurePacing(true,vsync,tearing);const bool restored=paced||sink_.configurePacing(false,vsync,tearing);- const std::wstring queue=paced?(vrrSync_?L"可变刷新:超过屏幕最高刷新时只排 1 帧 · ":L"垂直同步:屏幕队列 1 帧,读帧前等待刷新 · "):vsync?L"垂直同步:屏幕队列控制不可用 · ":restored?L"":L"显示队列恢复失败 · ";+ const std::wstring queue=paced?(vrrSync_?L"可变刷新:超过屏幕最高刷新时只排 1 帧":L"垂直同步:屏幕队列 1 帧,读帧前等待刷新"):vsync?L"垂直同步:屏幕队列控制不可用":restored?L"":L"显示队列恢复失败";std::wstring cap;if(followDisplay)cap=std::format(L"输出上限:跟随显示器 {:.0f} Hz",requested.customFps);else if(requested.outputRate==OutputRateMode::Custom)cap=std::format(L"输出上限:{:.3f} FPS",requested.customFps);else cap=L"输出上限:关闭";- if(!requested.enabled){status=(ctx.adapter().isNvidia?std::wstring(L"英伟达低延迟:关 · "):std::wstring())+queue+sync;if(effective.outputRate==OutputRateMode::Custom)status+=L" · "+cap;status+=capNotice;return effective;}+ if(!requested.enabled){status=join({nvidia?L"英伟达低延迟:关":L"",queue,syncMode,syncDetail,effective.outputRate==OutputRateMode::Custom?cap:L"",capNotice});return effective;}// Source cadence owns Sleep. Generated/copy work on the presentation queue// carries out-of-band markers, never another source-frame Sleep.std::wstring latency=L"低延迟队列:已开启";if(requested.nvidiaLowLatency!=NvidiaLowLatency::Off){- if(ctx.adapter().isNvidia&&reflex_.enable(ctx.device(),requested.nvidiaLowLatency==NvidiaLowLatency::Boost,fg,presentationQueue_.Get()))+ if(reflex_.enable(ctx.device(),requested.nvidiaLowLatency==NvidiaLowLatency::Boost,fg,presentationQueue_.Get()))latency=requested.nvidiaLowLatency==NvidiaLowLatency::Boost?L"英伟达低延迟:开+增强(已启用)":L"英伟达低延迟:开(已启用)";- else{effective.nvidiaLowLatency=NvidiaLowLatency::Off;latency=ctx.adapter().isNvidia?L"英伟达低延迟不可用,当前使用低排队;详见日志":L"英伟达低延迟需要 NVIDIA 显卡,当前使用低排队";}+ else{effective.nvidiaLowLatency=NvidiaLowLatency::Off;latency=L"英伟达低延迟不可用,当前使用低排队(详见日志)";}}- status=latency+L" · "+cap+L" · "+queue+sync;+ status=join({latency,cap,queue,syncMode,syncDetail});return effective;}Microsoft::WRL::ComPtr<ID3D12Resource> VideoPresenter::presentedResourceForTest() {diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cppindex 10d7fdc9..dec46cf6 100644--- a/src/ui/QmlPlayerBridge.cpp+++ b/src/ui/QmlPlayerBridge.cpp@@ -287,8 +287,9 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesystpr.hdrFgCompatibility = impl_->prefBool("hdrFgCompatibility", false);if (!saved.isEmpty()) {pr.enabled = saved.value(QStringLiteral("lowQueue")).toBool();- pr.nvidiaLowLatency=engine::savedNvidiaLowLatency(saved.value(QStringLiteral("nvidiaLowLatency"),pr.enabled&&primaryGpuVendor()==0x10de?1:0).toInt());- if(pr.nvidiaLowLatency!=engine::NvidiaLowLatency::Off)pr.enabled=true;+ // Before the three states the low queue was 开 on NVIDIA.+ pr.nvidiaLowLatency=engine::savedNvidiaLowLatency(saved.value(QStringLiteral("nvidiaLowLatency"),pr.enabled&&nvidiaLowLatencyAvailable()?1:0).toInt());+ engine::syncNvidiaLowLatencyQueue(pr,nvidiaLowLatencyAvailable());pr.display = static_cast<engine::DisplaySync>(std::clamp(saved.value(QStringLiteral("display")).toInt(), 0, 2));pr.outputRate = static_cast<engine::OutputRateMode>(std::clamp(saved.value(QStringLiteral("outputRate")).toInt(), 0, 2));pr.customFps = std::clamp(saved.value(QStringLiteral("customFps"), 60.0).toDouble(), 1.0, 1000.0);diff --git a/src/ui/bridge/FrameGeneration.cpp b/src/ui/bridge/FrameGeneration.cppindex ce24bc3a..88098cf9 100644--- a/src/ui/bridge/FrameGeneration.cpp+++ b/src/ui/bridge/FrameGeneration.cpp@@ -169,10 +169,13 @@ void QmlPlayerBridge::setFgLowQueue(bool value) {int QmlPlayerBridge::nvidiaLowLatency()const{return int(impl_->presentation.nvidiaLowLatency);}bool QmlPlayerBridge::nvidiaLowLatencyAvailable()const{return primaryGpuVendor()==0x10de;}void QmlPlayerBridge::setNvidiaLowLatency(int value){- if(value<0||value>2||(!nvidiaLowLatencyAvailable()&&value!=0))return;- auto& p=impl_->presentation;- if(int(p.nvidiaLowLatency)==value&&p.enabled==(value!=0))return;- p.nvidiaLowLatency=engine::NvidiaLowLatency(value);p.enabled=value!=0;applyPresentation();+ const bool nvidia=nvidiaLowLatencyAvailable();+ if(value<0||value>2||(!nvidia&&value!=0))return;+ // On NVIDIA the three states own the low queue; elsewhere only the kept choice changes.+ auto p=impl_->presentation;p.nvidiaLowLatency=engine::NvidiaLowLatency(value);+ engine::syncNvidiaLowLatencyQueue(p,nvidia);+ if(p==impl_->presentation)return;+ impl_->presentation=p;applyPresentation();}// --- design gap A1-A5: flow, cadence, presentation ----------------------------diff --git a/src/ui/bridge/Preferences.cpp b/src/ui/bridge/Preferences.cppindex d6b58814..fa545bce 100644--- a/src/ui/bridge/Preferences.cpp+++ b/src/ui/bridge/Preferences.cpp@@ -394,6 +394,9 @@ void QmlPlayerBridge::applyPreference(const QString& key) {}}emit effectCapabilitiesChanged(); emit fgChoicesChanged();+ // The low queue follows the new card's own control: the NVIDIA states+ // there, the plain switch elsewhere (the NVIDIA choice is kept).+ if (engine::syncNvidiaLowLatencyQueue(impl_->presentation, nvidiaLowLatencyAvailable())) applyPresentation();if (impl_->snapshot.running)emit notice(impl_->computeLuid ? tr("运算显卡已切换为「%1」,重新打开视频后生效").arg(impl_->computeGpuName): tr("运算显卡已恢复默认(性能最强的显卡),重新打开视频后生效"), false);diff --git a/src/ui/bridge/Status.cpp b/src/ui/bridge/Status.cppindex 615c0f36..156b4abe 100644--- a/src/ui/bridge/Status.cpp+++ b/src/ui/bridge/Status.cpp@@ -421,7 +421,12 @@ void QmlPlayerBridge::updateRunStatus() {options<<tr("输出限帧 · 跟随屏幕");else options<<tr("输出限帧 · %1 fps").arg(i.presentation.customFps,0,'f',1);}- if(i.presentation.enabled)options<<(s.running&&!s.presentationEffective.enabled?tr("低延迟队列 · 当前未生效"):tr("低延迟队列"));+ // On NVIDIA the three states own the low queue, so the summary names them.+ if(nvidiaLowLatencyAvailable()&&i.presentation.nvidiaLowLatency!=engine::NvidiaLowLatency::Off){+ if(s.running&&s.presentationEffective.nvidiaLowLatency==engine::NvidiaLowLatency::Off)options<<tr("英伟达低延迟 · 当前未生效");+ else options<<(i.presentation.nvidiaLowLatency==engine::NvidiaLowLatency::Boost?tr("英伟达低延迟 · 开+增强"):tr("英伟达低延迟 · 开"));+ }+ else if(i.presentation.enabled)options<<(s.running&&!s.presentationEffective.enabled?tr("低延迟队列 · 当前未生效"):tr("低延迟队列"));if(!s.capture&&std::abs(s.playbackRate-1.0)>.001)options<<tr("播放速度 %1×").arg(s.playbackRate,0,'f',2);if(i.compareMode!=0)options<<tr("画面对比 · 补帧暂停");QStringList detail;diff --git a/tests/integration/PresentationPacingTests.cpp b/tests/integration/PresentationPacingTests.cppindex b484a475..b93729ee 100644--- a/tests/integration/PresentationPacingTests.cpp+++ b/tests/integration/PresentationPacingTests.cpp@@ -31,11 +31,14 @@ int wmain(int argc,wchar_t** argv){const int mode=_wtoi(argv[3]),display=_wtoi(argv[4]),multiplier=_wtoi(argv[5]),seconds=std::clamp(_wtoi(argv[6]),3,120);if(mode< -1||mode>2||display<0||display>2)return 2;const std::wstring scenario=argc>7?argv[7]:L"";- const bool screen=scenario==L"screen-xess"||scenario==L"screen-dlss";+ // latency-screen[-sr]: a live 60 fps window capture for capture-to-present+ // A/B runs. mode -1 off, 0 low queue only, 1 NVIDIA 开, 2 NVIDIA 开+增强.+ const bool latency=scenario.starts_with(L"latency-");+ const bool screen=scenario==L"screen-xess"||scenario==L"screen-dlss"||latency;const bool xess=scenario==L"xess"||scenario==L"screen-xess"||scenario==L"native-xess";if(scenario==L"legacy"){if(mode!=-1)return 2;SetEnvironmentVariableW(L"VEYRA_TEST_LEGACY_SWAPCHAIN",L"1");}std::filesystem::path dir=argv[2];std::filesystem::create_directories(dir);- SetEnvironmentVariableW(L"VEYRA_VERBOSE_FRAME_LOGS",screen?L"0":L"1");+ SetEnvironmentVariableW(L"VEYRA_VERBOSE_FRAME_LOGS",screen&&!latency?L"0":L"1");veyra::Logger::instance().openFile((dir/L"engine.log").wstring());veyra::Logger::instance().setConsoleEnabled(false);if(FAILED(CoInitializeEx(nullptr,COINIT_MULTITHREADED)))return 2;const bool physical=scenario==L"capture-nr"||scenario==L"capture-nr-recovery";@@ -69,7 +72,7 @@ int wmain(int argc,wchar_t** argv){if(!inputWindow)std::this_thread::sleep_for(std::chrono::milliseconds(10));}if(!inputWindow){TerminateProcess(inputProcess.hProcess,2);WaitForSingleObject(inputProcess.hProcess,1000);CloseHandle(inputProcess.hProcess);return 2;}- veyra::source::ScreenCaptureOptions input;input.target=reinterpret_cast<uint64_t>(inputWindow);input.fps=30;input.cursor=false;+ veyra::source::ScreenCaptureOptions input;input.target=reinterpret_cast<uint64_t>(inputWindow);input.fps=latency?60:30;input.cursor=false;sourcePath=input.uri();}MONITORINFOEXW monitor{};monitor.cbSize=sizeof(monitor);GetMonitorInfoW(MonitorFromWindow(window,MONITOR_DEFAULTTONEAREST),&monitor);@@ -81,16 +84,18 @@ int wmain(int argc,wchar_t** argv){PresentationSettings p{mode>=0,PacingMode(std::max(0,mode)),DisplaySync(display)};engine.requestPresentation(p);const bool native=scenario.starts_with(L"native-");if(native){p.nvidiaLowLatency=mode<0?NvidiaLowLatency::Off:mode==2?NvidiaLowLatency::Boost:NvidiaLowLatency::On;engine.requestPresentation(p);}+ if(latency){p.nvidiaLowLatency=mode==1?NvidiaLowLatency::On:mode==2?NvidiaLowLatency::Boost:NvidiaLowLatency::Off;engine.requestPresentation(p);}EnhancementSettings effects;effects.multiplier=unsigned(multiplier);if(xess)effects.frameGenerationBackend=FrameGenerationBackend::XeSS;if(scenario==L"native-vfg")effects.frameGenerationBackend=FrameGenerationBackend::Vfg;if(scenario==L"native-fsr")effects.frameGenerationBackend=FrameGenerationBackend::Fsr;if(scenario==L"effects"||scenario==L"native-effects"){effects.nr=true;effects.sr=true;effects.srTarget=veyra::pipeline::SrTarget::Qhd;}+ if(scenario==L"latency-screen-sr"){effects.sr=true;effects.srTarget=veyra::pipeline::SrTarget::Uhd4K;}if(physical){effects.nr=true;effects.sr=false;}auto options=PlayerOptions::from(effects);options.captureReplayForTest=scenario==L"replay";engine.open(window,sourcePath,options);auto pump=[] {MSG msg;while(PeekMessageW(&msg,nullptr,0,0,PM_REMOVE)){TranslateMessage(&msg);DispatchMessageW(&msg);}};auto wait=[&](auto predicate,int ms=15000){auto end=Clock::now()+std::chrono::milliseconds(ms);while(Clock::now()<end){pump();auto s=engine.snapshot();if(s.failed)return false;if(predicate(s))return true;std::this_thread::sleep_for(std::chrono::milliseconds(2));}return false;};- check(wait([](auto& s){return s.frames>10;},scenario==L"native-effects"?30000:15000),"first frames");+ check(wait([](auto& s){return s.frames>10;},scenario==L"native-effects"||scenario==L"latency-screen-sr"?30000:15000),"first frames");if(physical){const auto warm=Clock::now();check(wait([&](auto& s){return Clock::now()-warm>=std::chrono::seconds(10)&&s.nrActive&&s.fgActive;},20000),"ten second warmup with NR and DLSS active");}std::ofstream samples(dir/L"snapshots.csv");samples<<"wall,position,frames,generated,lateMs,queueReadyMs,presentMs,skipped,effective,mode,sync,revision\n";const auto start=Clock::now();auto last=engine.snapshot();const auto first=last;@@ -111,9 +116,9 @@ int wmain(int argc,wchar_t** argv){if(multiplier>1)check(last.fgActive&&last.generated>first.generated,"real provider generated frames during measurement");if(scenario==L"effects"||scenario==L"native-effects")check(last.nrActive&&last.srActive&&last.nrEvaluated>first.nrEvaluated,"NR and SR remain active with pacing");if(mode>=0&&!xess)check(last.presentationEffective.enabled,"optional pacing active");- if(native&&mode>=0&&!xess)check(last.presentationEffective.nvidiaLowLatency==p.nvidiaLowLatency,"requested native NVIDIA low latency mode actually active with or without FG");+ if((native||latency)&&mode>=0&&!xess)check(last.presentationEffective.nvidiaLowLatency==p.nvidiaLowLatency,"requested native NVIDIA low latency mode actually active with or without FG");if(mode>=0&&xess)check(!last.presentationEffective.enabled&&last.fgActive,"provider remains pacing owner");- if(screen){+ if(screen&&!latency){for(unsigned cycle=0;cycle<3;++cycle){SetEnvironmentVariableW(L"VEYRA_TEST_VIDEO_WORK_MS",L"80");auto before=engine.snapshot();diff --git a/tests/unit/NvidiaLowLatencyTests.h b/tests/unit/NvidiaLowLatencyTests.hindex bad3b966..d178bf25 100644--- a/tests/unit/NvidiaLowLatencyTests.h+++ b/tests/unit/NvidiaLowLatencyTests.h@@ -6,17 +6,25 @@ using R=veyra::gfx::ReflexSession;struct Event {uint64_t frame;uint32_t type;uint64_t present;bool async;};inline std::vector<R::SleepParams> modes;inline std::vector<Event> events;-inline int sleeps=0;inline bool failSleep=false,failQueue=false,failDisable=false;+inline int sleeps=0;inline bool failSleep=false,failQueue=false,failDisable=false,failNotify=false;inline int __cdecl set(IUnknown*,R::SleepParams* p){if(!p->low&&failDisable)return -1;modes.push_back(*p);return 0;}inline int __cdecl sleep(IUnknown*){++sleeps;return failSleep?-1:0;}inline int __cdecl marker(IUnknown* target,R::MarkerParams* p){const bool queue=target==reinterpret_cast<IUnknown*>(uintptr_t(2));events.push_back({p->frame,p->type,0,queue});return queue&&failQueue?-1:0;}-inline int __cdecl notify(ID3D12CommandQueue*,uint32_t type){return type==3?0:-1;}+inline int __cdecl notify(ID3D12CommandQueue*,uint32_t type){return type==3&&!failNotify?0:-1;}template<class Check>void run(Check check){using namespace veyra::engine;PresentationSettings p;check(p.valid()&&p.nvidiaLowLatency==NvidiaLowLatency::Off,"NVIDIA low latency defaults off");p.nvidiaLowLatency=NvidiaLowLatency(3);check(!p.valid(),"invalid NVIDIA low latency mode rejected");check(savedNvidiaLowLatency(-1)==NvidiaLowLatency::Off&&savedNvidiaLowLatency(99)==NvidiaLowLatency::Off&&savedNvidiaLowLatency(2)==NvidiaLowLatency::Boost,"invalid saved mode falls back to off rather than accidentally enabling Boost");- modes.clear();events.clear();sleeps=0;failSleep=failQueue=failDisable=false;+ {+ PresentationSettings kept;kept.nvidiaLowLatency=NvidiaLowLatency::Boost;+ check(!syncNvidiaLowLatencyQueue(kept,false)&&!kept.enabled&&kept.nvidiaLowLatency==NvidiaLowLatency::Boost,"another adapter keeps its plain low-queue switch off and only retains the NVIDIA choice");+ check(syncNvidiaLowLatencyQueue(kept,true)&&kept.enabled,"back on NVIDIA the retained Boost owns the low queue again");+ PresentationSettings plain;plain.enabled=true;+ check(!syncNvidiaLowLatencyQueue(plain,false)&&plain.enabled,"another adapter keeps its plain low queue on");+ check(syncNvidiaLowLatencyQueue(plain,true)&&!plain.enabled,"NVIDIA 关 never leaves a hidden low queue running");+ }+ modes.clear();events.clear();sleeps=0;failSleep=failQueue=failDisable=failNotify=false;auto* device=reinterpret_cast<ID3D12Device*>(uintptr_t(1));auto* queue=reinterpret_cast<ID3D12CommandQueue*>(uintptr_t(2));R r({set,sleep,marker,notify});check(r.begin()==0&&modes.empty()&&events.empty(),"off makes no driver calls");@@ -40,6 +48,17 @@ template<class Check>void run(Check check){check(r.enable(device),"enable before disable failure");failDisable=true;check(!r.disable()&&r.disablePending()&&!r.enable(device,true),"failed disable is not reported as off or re-enabled over pending state");failDisable=false;check(r.disable()&&!r.disablePending(),"failed disable can be retried cleanly");+ failNotify=true;+ check(r.enable(device,true,false,queue)&&r.active(),"without frame generation a refused queue notification keeps native Sleep and markers");+ {+ const auto id=r.begin();const auto before=events.size();+ r.renderStart(id);r.renderEnd(id);r.blitStart(id);r.blitEnd(id);r.presentStart(id,false);r.presentEnd(id,false);+ bool inBand=events.size()==before+5;+ for(auto k=before;inBand&&k<events.size();++k)inBand=!events[k].async&&events[k].type==k-before+1;+ check(inBand,"a refused queue notification falls back to in-band submit and Present markers");+ }+ check(!r.enable(device,true,true,queue)&&!r.active(),"frame generation still requires the out-of-band queue");+ failNotify=false;R old({set,sleep,marker,nullptr});check(!old.enable(device,false,true,queue)&&!old.active(),"FG does not masquerade as enabled on a driver without out-of-band queue notification");}}diff --git a/tests/unit/UiLanguageTests.cpp b/tests/unit/UiLanguageTests.cppindex 2b3c8f01..f8404d46 100644--- a/tests/unit/UiLanguageTests.cpp+++ b/tests/unit/UiLanguageTests.cpp@@ -34,6 +34,12 @@ int main(int argc, char** argv) {// A capture format label with a technical tag at the end.expect(i18n::text(QStringLiteral("1920 x 1080 @ 120.00 fps · NV12 · 原生 · 低延迟 [format 16]")),QStringLiteral("1920 x 1080 @ 120.00 fps · NV12 · Native · low latency [format 16]"), "tagged segment");+ // The presentation status (VideoPresenter) joins its pieces with " · "; each is its own entry.+ expect(i18n::text(QStringLiteral("英伟达低延迟:关 · 显示同步:自动 · 不撕裂,也不等待垂直同步(延迟最低)")),+ QStringLiteral("NVIDIA Low Latency: Off · Display sync: auto · no tearing and no VSync wait (lowest latency)"), "presentation status pieces");+ expect(i18n::text(QStringLiteral("英伟达低延迟不可用,当前使用低排队(详见日志) · 输出上限:关闭 · 垂直同步:屏幕队列 1 帧,读帧前等待刷新 · 显示同步:垂直同步")),+ QStringLiteral("NVIDIA Low Latency unavailable; using low queue depth (see the log) · Output cap: off · VSync: 1-frame display queue, waits for refresh before reading a frame · Display sync: VSync"),+ "presentation fallback status pieces");// Unknown text and paths come back unchanged.expect(i18n::text(QStringLiteral("D:/视频/我的片子.mkv")), QStringLiteral("D:/视频/我的片子.mkv"), "path untouched");