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++
Draw the interface in software by default; keep GPU drawing as a setting
Veyra Goal Agent41f099448e8e
diff --git a/AGENTS.md b/AGENTS.mdindex 9aa3ecc9..4313e126 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -1,5 +1,7 @@# Veyra 项目 Agent 执行规则+> **2026-10-26 界面默认软件绘制(Claude)**:用户依据GPU/软件界面A/B(reports/claude-ui-renderer-ab-20261026)要求默认界面改为软件绘制,设置里保留“GPU 绘制”(需重启),自动兼容逻辑不变。从main 68def10在claude/software-ui-default-20261026按docs/SOFTWARE_UI_DEFAULT_PLAN_2026-10-26.md施工,起点标签checkpoint/pre-software-ui-default-20261026;允许main.cpp启动选择/桥接偏好/设置页QML/翻译/定向测试接点,覆盖这些范围旧冻结。视频D3D12链路、OBS与监控软件兼容判定、VEYRA_UI_RHI、33ms/250ms刷新不变。单Agent、全E盘、复用build/claude-screen-recording-20261022构建-j2<=900秒/单测<=300秒;不改运行库/模型/驱动/真实配置,无merge/push/Release,Lecram暂停。上一分支claude/vrr-event-query-20261025保留,不并入本分支。+> **2026-10-25 采集内置音频修复与整合授权**:用户明确要求修复 CV710 开监听卡画面,并把近期全部修复/功能合入本地 main。从207555b在codex/capture-audio-main-20261025按docs/CAPTURE_AUDIO_MAIN_PLAN_2026-10-25.md施工;包含 #67/全屏退出与当前录制/AMD SR关/旋转/NR比例/FG异步查询/NR导出,覆盖这些接点旧冻结及无main合并限制。先存档原main与101工作树/原全屏脏文件,不覆盖其它工作树。保持单Agent、全E盘、-j2构建<=900秒/单测试<=300秒、真实配置/运行库/模型/驱动不变。CV710现场修复必须原卡复测,不拿本机卡或夹具替代;无push/Release/代发/关机授权,Lecram暂停。> **2026-10-25 社区NR导出尺寸补丁接入(用户授权)**:从038beac在codex/export-nr-scale-20261025按docs/EXPORT_NR_SCALE_PLAN_2026-10-25.md接入固定档与百分比的视频导出NR尺寸,允许必要export policy/图描述/执行计划/导出日志/QML四语/定向测试接点,覆盖这些范围旧UI冻结及此前“导出保持Native”限制。输出尺寸不变、图片完整处理、AMD预算、非法值校验及既有NR手动编码保留。不改补帧调度/运行库/模型/驱动/真实配置;单Agent、全E盘、复用构建-j2<=900秒/单测<=300秒,无merge/push/Release,Lecram暂停。diff --git a/apps/veyra-qml/main.cpp b/apps/veyra-qml/main.cppindex 27eb74d1..77999258 100644--- a/apps/veyra-qml/main.cpp+++ b/apps/veyra-qml/main.cpp@@ -53,6 +53,7 @@#include "veyra/engine/ExportJobManager.h"#include "veyra/engine/PresentationGeometry.h"#include "veyra/gfx/PresentationHooks.h"+#include "veyra/ui/InterfaceRenderer.h"#include "veyra/ui/QmlDataDirectory.h"#include "veyra/ui/QmlPlayerBridge.h"#include "veyra/ui/ThumbnailProvider.h"@@ -501,6 +502,7 @@ static int runApplication(int argc, char** argv, QString& restartProgram, QStrinbool obsGameCapture = false;bool overlayCompatAuto = true; // 设置 → 监控软件兼容: "auto" (default) or "off"bool overlayCompatRestart = false;+ bool gpuUiChosen = false; // 设置 → 界面绘制: "software" (default) or "gpu"{int count = 0;LPWSTR* args = CommandLineToArgvW(GetCommandLineW(), &count);@@ -518,6 +520,7 @@ static int runApplication(int argc, char** argv, QString& restartProgram, QStrinuiScale = saved.value(QStringLiteral("uiScale")).toInt();obsGameCapture = saved.value(QStringLiteral("obsGameCapture")).toBool();overlayCompatAuto = saved.value(QStringLiteral("overlayCompat")).toString() != QStringLiteral("off");+ gpuUiChosen = saved.value(QStringLiteral("uiRenderer")).toString() == QStringLiteral("gpu");}obsGameCapture = obsGameCapture || obsGameCaptureArg;if (uiScale == 100 || uiScale == 125 || uiScale == 150) {@@ -561,19 +564,26 @@ static int runApplication(int argc, char** argv, QString& restartProgram, QStrin// the other capture and overlay tools; the bridge also lowers the GPU priority while// it runs. VEYRA_TEST_IGNORE_DOUYIN=1 starts as if it were not running.const bool douyin = !GetEnvironmentVariableW(L"VEYRA_TEST_IGNORE_DOUYIN", nullptr, 0) && veyra::gfx::douyinLiveCompanionRunning();- const bool overlayCompat = !obsGameCapture && overlayCompatAuto- && (rivaTuner || nvidiaOverlay || gamePP || douyin || overlayCompatRestart) && !forcedRenderer[0];- const bool softwareUi = obsGameCapture || overlayCompat;- if (softwareUi)- veyra::log::info("app", "software UI: cached raster paths; normal partial updates; no additional frame requests");- if (obsGameCapture) {+ // 设置 → 界面绘制 (software unless GPU is chosen) together with the compatibility+ // rules above, which are unchanged: veyra/ui/InterfaceRenderer.h.+ const auto renderer = veyra::ui::decideInterfaceRenderer({gpuUiChosen, obsGameCapture, overlayCompatAuto,+ rivaTuner || nvidiaOverlay || gamePP || douyin, overlayCompatRestart, forcedRenderer[0] != 0});+ const bool overlayCompat = renderer.overlayCompat;+ const bool softwareUi = renderer.software;+ if (softwareUi) {QQuickWindow::setSceneGraphBackend(QStringLiteral("software"));+ veyra::log::info("app", "software UI: cached raster paths; normal partial updates; no additional frame requests");+ }+ using Reason = veyra::ui::InterfaceRendererReason;+ if (renderer.reason == Reason::ObsGameCapture)veyra::log::info("app", "OBS game capture compatibility: software UI; native D3D12 video unchanged");- } else if (overlayCompat) {- QQuickWindow::setSceneGraphBackend(QStringLiteral("software"));+ else if (renderer.reason == Reason::OverlayCompat)veyra::log::info("app", std::format("RTSS compatibility: software UI; activeServer={} nvidiaOverlay={} gamePP={} douyinCompanion={} acceptedRestart={}; native D3D12 video unchanged",rivaTuner, nvidiaOverlay, gamePP, douyin, overlayCompatRestart));- }+ else if (renderer.reason == Reason::Default)+ veyra::log::info("app", "software UI by default (interface drawing preference: software); native D3D12 video unchanged");+ else+ veyra::log::info("app", std::format("GPU UI: {}", forcedRenderer[0] ? "renderer forced by VEYRA_UI_RHI" : "interface drawing preference: GPU"));{// A GPU interface keeps RTSS from drawing in this process at all, so a RivaTuner// started after Veyra (or kept with 监控软件兼容 off) cannot take the device down.@@ -606,7 +616,7 @@ static int runApplication(int argc, char** argv, QString& restartProgram, QStrin}app.setWindowIcon(appIcon);veyra::log::info("app-icon", std::format("embedded window icon sizes={}", appIcon.availableSizes().size()));- // The interface draws with Direct3D 12, like the video. Qt's default is Direct3D 11,+ // A GPU interface (设置 → 界面绘制 = GPU, or VEYRA_UI_RHI) draws with Direct3D 12, like the video. Qt's default is Direct3D 11,// and a D3D11 device in the process changed how overlays treat it: RivaTuner (MSI// Afterburner) then crashed in d3d11.dll inside its own hooks while drawing its OSD on// the XeSS swapchain through D3D11On12 (field dumps 2026-10-01). 1.4.4 drew its UI withdiff --git a/docs/SOFTWARE_UI_DEFAULT_PLAN_2026-10-26.md b/docs/SOFTWARE_UI_DEFAULT_PLAN_2026-10-26.mdnew file mode 100644index 00000000..c38b6f44--- /dev/null+++ b/docs/SOFTWARE_UI_DEFAULT_PLAN_2026-10-26.md@@ -0,0 +1,36 @@+# 2026-10-26 界面默认软件绘制(Claude)++用户依据 GPU/软件界面 A/B 决定:默认界面改为软件绘制,设置里保留“GPU 绘制”(需重启),自动兼容逻辑不变。从 main 68def10 开 `claude/software-ui-default-20261026`,起点标签 `checkpoint/pre-software-ui-default-20261026`,开工状态 `archives/claude-software-ui-default-20261026/start.json`。单 Agent、全 E 盘、复用 `build/claude-screen-recording-20261022`(-j2、≤900 秒)、单测试 ≤300 秒;不改运行库/模型/驱动/真实配置,不 merge/push/Release,Lecram 暂停。上一分支 `claude/vrr-event-query-20261025` 保留,不并入。++## 依据++`reports/claude-ui-renderer-ab-20261026/ab.json`:RTX 5070、4K30 + VFG 2X、2400×1300 窗口、320 Hz,GPU/软件/软件/GPU 四轮。+- GPU 界面进程显存 469 MiB,软件界面 105 MiB。+- 界面静止时 GPU 占用相同(约 19%);连续切换标签页时,GPU 界面约 30%,软件界面约 15%。+- 软件界面在切换时多用约 6.6% 的单核 CPU。四轮视频都是 60 fps、0 跳帧。+- 现场问题(RTSS 设备移除、NVIDIA 浮窗/游戏加加死锁、抖音直播伴侣卡死、OBS 抓到界面背景、GPU 卡死时界面与视频共用 D3D12 设备一起停)都来自 GPU 界面的交换链或设备。++## 方案++1. 新偏好 `uiRenderer`:`software`(缺省、无效值)或 `gpu`,由 `main.cpp` 在 Qt 启动前读取。启动选择提取为无 Qt 依赖的 `include/veyra/ui/InterfaceRenderer.h`:+ - OBS 游戏采集兼容:软件(不变)。+ - 监控软件兼容(自动 + 检测到 RTSS/NVIDIA 浮窗/游戏加加/抖音直播伴侣,或已接受兼容重启,且未设 `VEYRA_UI_RHI`):软件(判定不变)。+ - 设了 `VEYRA_UI_RHI`:按它选 GPU 接口(不变)。+ - 其余:按 `uiRenderer`,缺省软件。+ - 选 GPU 时照旧优先 D3D12;RTSS OSD 环境变量、晚到浮窗的重启提示等仍只看“实际是否软件界面”。+2. 设置 → 兼容:新增“界面绘制:软件 / GPU”(需重启,沿用现有重启确认)。提示说明当前实际渲染器,以及 OBS/监控软件兼容覆盖 GPU 选择的原因。“监控软件兼容”的提示和重启判断改为只在选了 GPU 时才有意义。分组说明加上“界面绘制”。+3. 桥接:`setPreference` 接受 `uiRenderer`;新增常量属性 `softwareUiActive`。新文案补繁中/英/日翻译。+4. 不改视频呈现、软件界面的绘制细节、OBS 兼容效果、33ms/250ms 刷新与 GPU 优先级。++## 验证++- UI 合同测试新增启动选择各组合:缺省、GPU、GPU + 检测到监控软件(自动/关闭)、GPU + 兼容重启、OBS、强制 RHI。+- 构建 `veyra_qml_ui` 与相关测试,运行 UI 合同、Repair 合同、翻译、QtQuick,以及 `scripts/i18n/extract.py --check`。+- 私有配置实机启动(确认没有其他 Veyra 进程),看日志里的实际渲染器:+ - 全新配置 → 软件;+ - 在设置里选 GPU 后重启 → D3D12;+ - GPU + `--overlay-compat-restart` → 软件(兼容);+ - 再选回软件后重启 → 软件。+ - 另截取设置页“兼容”分组两种状态的截图。++产物:`E:/项目/Veyra/{tests,logs,tmp,reports,archives}/claude-software-ui-default-20261026`。diff --git a/i18n/catalog.json b/i18n/catalog.jsonindex e1f552a1..3ac4198b 100644--- a/i18n/catalog.json+++ b/i18n/catalog.json@@ -1618,11 +1618,11 @@"ja": "OBS ゲームキャプチャ互換でインターフェースはソフトウェア描画です。RTSS の OSD は映像にだけ表示されます"},{- "zh": "OBS、监控软件兼容需重启;HDR 补帧兼容可在播放中切换。",+ "zh": "OBS 游戏采集兼容开启时,界面始终软件绘制","src": "qml/SettingsPage.qml",- "zh-TW": "OBS、監控軟體相容需重新啟動;HDR 補幀相容可在播放中切換。",- "en": "OBS and monitoring compatibility require a restart; HDR frame generation compatibility can be switched during playback.",- "ja": "OBS とモニタリングソフトの互換設定は再起動が必要です。HDR フレーム生成の互換設定は再生中に切り替えられます。"+ "zh-TW": "OBS 遊戲擷取相容開啟時,介面一律以軟體繪製",+ "en": "With OBS game capture compatibility on, the interface is always drawn in software",+ "ja": "OBS ゲームキャプチャ互換がオンの間、インターフェースは常にソフトウェア描画です"},{"zh": "PC 串流",@@ -5111,6 +5111,13 @@"en": "Compress changes toward blown whites; retain highlight darkening","ja": "白飛びする変化だけを圧縮し、ハイライトの減光は保持します"},+ {+ "zh": "只在“界面绘制”选 GPU 时起作用;软件绘制时小飞机 OSD 只显示在视频上",+ "src": "qml/SettingsPage.qml",+ "zh-TW": "只在「介面繪製」選 GPU 時起作用;軟體繪製時小飛機 OSD 只顯示在影片上",+ "en": "Only matters when Interface drawing is set to GPU; with software drawing the RTSS OSD shows on the video only",+ "ja": "「インターフェース描画」が GPU のときだけ有効です。ソフトウェア描画では RTSS の OSD は映像にだけ表示されます"+ },{"zh": "只在这个亮度以下的暗部生效","src": "qml/ProPage.qml",@@ -10131,6 +10138,13 @@"en": "The GPU was reset at frame {}; the first {:.1f} s are saved, exporting the rest","ja": "{} フレーム目で GPU がリセットされました。最初の {:.1f} 秒は保存済みで、残りを書き出します"},+ {+ "zh": "显卡绘制:动画更顺,带阴影与模糊;占用显存和 GPU,可能与小飞机等监控软件冲突",+ "src": "qml/SettingsPage.qml",+ "zh-TW": "顯示卡繪製:動畫更順,帶陰影與模糊;佔用顯示記憶體和 GPU,可能與小飛機等監控軟體衝突",+ "en": "GPU drawing: smoother animation with shadows and blur; uses video memory and GPU time, and may conflict with RTSS and other monitoring overlays",+ "ja": "GPU 描画:アニメーションが滑らかで影・ぼかしあり。VRAM と GPU を使い、RTSS などのモニタリングソフトと競合することがあります"+ },{"zh": "显卡调度、预热与资源监控。默认设置适合大多数机器。","src": "qml/SettingsPage.qml",@@ -10957,6 +10971,13 @@"en": "VRAM kept growing in fullscreen during this session. Use windowed playback; reopen the source to test fullscreen again.","ja": "この再生では全画面中に VRAM が増え続けました。ウィンドウ表示を使用してください。ソースを開き直すと全画面を再テストできます。"},+ {+ "zh": "本次检测到监控软件,仍用软件绘制(监控软件兼容:自动)",+ "src": "qml/SettingsPage.qml",+ "zh-TW": "本次偵測到監控軟體,仍以軟體繪製(監控軟體相容:自動)",+ "en": "A monitoring overlay was detected at this start, so the interface is still drawn in software (monitoring overlay compatibility: Auto)",+ "ja": "今回の起動でモニタリングソフトを検出したため、ソフトウェア描画のままです(モニタリングソフト互換:自動)"+ },{"zh": "本软件开源免费,如果对你有帮助,你可以 →","src": "qml/HomePage.qml",@@ -12588,6 +12609,20 @@"en": "The capture session in the interface state is damaged","ja": "画面状態のキャプチャーセッションが破損しています"},+ {+ "zh": "界面绘制",+ "src": "qml/SettingsPage.qml",+ "zh-TW": "介面繪製",+ "en": "Interface drawing",+ "ja": "インターフェース描画"+ },+ {+ "zh": "界面绘制、OBS、监控软件兼容需重启;HDR 补帧兼容可在播放中切换。",+ "src": "qml/SettingsPage.qml",+ "zh-TW": "介面繪製、OBS、監控軟體相容需重新啟動;HDR 補幀相容可在播放中切換。",+ "en": "Interface drawing, OBS and monitoring compatibility require a restart; HDR frame generation compatibility can be switched during playback.",+ "ja": "インターフェース描画、OBS、モニタリングソフトの互換設定は再起動が必要です。HDR フレーム生成の互換設定は再生中に切り替えられます。"+ },{"zh": "界面缩放","src": "qml/SettingsPage.qml",@@ -15654,6 +15689,13 @@"en": "Convert subtitles","ja": "字幕の変換"},+ {+ "zh": "软件",+ "src": "qml/SettingsPage.qml",+ "zh-TW": "軟體",+ "en": "Software",+ "ja": "ソフトウェア"+ },{"zh": "软件不检测、不拦截两者叠加,也不修改驱动配置;AMD FSR 补帧暂不提供。","src": "qml/SettingsPage.qml",@@ -15675,6 +15717,13 @@"en": "Audio/video offset measured inside the app, not at the speakers; only for live capture card / PS5 input","ja": "アプリ内で測定した音声と映像のずれで、スピーカーでの実測ではありません。キャプチャーカード / PS5 のライブ入力時のみ"},+ {+ "zh": "软件绘制:兼容性最好,不占显存,不和视频抢 GPU;部分阴影与模糊简化",+ "src": "qml/SettingsPage.qml",+ "zh-TW": "軟體繪製:相容性最好,不佔顯示記憶體,不和影片搶 GPU;部分陰影與模糊簡化",+ "en": "Software drawing: best compatibility, no video memory, no competition with the video for the GPU; some shadows and blur are simplified",+ "ja": "ソフトウェア描画:互換性が最も高く、VRAM を使わず、映像と GPU を取り合いません。一部の影・ぼかしは簡略化されます"+ },{"zh": "软件解码","src": "qml/StreamHud.qml",diff --git a/include/veyra/ui/InterfaceRenderer.h b/include/veyra/ui/InterfaceRenderer.hnew file mode 100644index 00000000..ea5f10d1--- /dev/null+++ b/include/veyra/ui/InterfaceRenderer.h@@ -0,0 +1,35 @@+#pragma once++namespace veyra::ui {+// How the interface draws, decided in main.cpp before Qt starts (2026-10-26,+// docs/SOFTWARE_UI_DEFAULT_PLAN_2026-10-26.md). Software is the default: the+// interface then has no swapchain or D3D12 device of its own, so overlays and+// capture tools hook only the video, a GPU fault in the video leaves the+// interface running, and it uses no video memory (A/B 2026-10-26: 469 vs 105 MiB,+// about half the GPU load while the interface animates). 设置 → 界面绘制 = GPU+// draws it with the GPU again. The compatibility switches keep their meaning:+// OBS game capture and an overlay seen at start (监控软件兼容 = 自动) still draw+// in software when GPU is chosen, and VEYRA_UI_RHI still picks a GPU renderer.+struct InterfaceRendererInputs {+ bool gpuChosen=false; // 设置 → 界面绘制 = GPU+ bool obsGameCapture=false; // 设置 → OBS 游戏采集兼容, or --obs-game-capture+ bool overlayCompatAuto=true; // 设置 → 监控软件兼容 = 自动+ bool overlayRunning=false; // RTSS / NVIDIA overlay / GamePP / 抖音直播伴侣 at start+ bool compatRestart=false; // --overlay-compat-restart: an accepted compatibility restart+ bool rendererForced=false; // VEYRA_UI_RHI+};+enum class InterfaceRendererReason { Gpu, Default, ObsGameCapture, OverlayCompat };+struct InterfaceRendererDecision {+ bool software=false;+ bool overlayCompat=false; // the 监控软件兼容 rule applied (logged, shown in 设置)+ InterfaceRendererReason reason=InterfaceRendererReason::Gpu;+};+constexpr InterfaceRendererDecision decideInterfaceRenderer(const InterfaceRendererInputs& in) {+ InterfaceRendererDecision d;+ d.overlayCompat=!in.obsGameCapture&&in.overlayCompatAuto&&(in.overlayRunning||in.compatRestart)&&!in.rendererForced;+ if(in.obsGameCapture){d.software=true;d.reason=InterfaceRendererReason::ObsGameCapture;}+ else if(d.overlayCompat){d.software=true;d.reason=InterfaceRendererReason::OverlayCompat;}+ else if(!in.gpuChosen&&!in.rendererForced){d.software=true;d.reason=InterfaceRendererReason::Default;}+ return d;+}+}diff --git a/include/veyra/ui/QmlPlayerBridge.h b/include/veyra/ui/QmlPlayerBridge.hindex d8d54c0e..ad84ea56 100644--- a/include/veyra/ui/QmlPlayerBridge.h+++ b/include/veyra/ui/QmlPlayerBridge.h@@ -237,6 +237,9 @@ class QmlPlayerBridge : public QObject {// This run draws the interface in software because RivaTuner (RTSS) was running at start// (设置 → 监控软件兼容, main.cpp): its OSD then sits on the video only.Q_PROPERTY(bool overlayCompatActive READ overlayCompatActive CONSTANT)+ // This run draws the interface in software: 设置 → 界面绘制 (software unless GPU is+ // chosen) or one of the compatibility rules above (veyra/ui/InterfaceRenderer.h).+ Q_PROPERTY(bool softwareUiActive READ softwareUiActive CONSTANT)// Audio output (P4-d): the active WASAPI render endpoints by device id, the// stored choice (preferences.audioDevice, empty = system default) and what// the renderer actually opened, including a fallback to the default.@@ -812,6 +815,7 @@ public:int uiScaleActive() const;bool obsGameCaptureActive() const;bool overlayCompatActive() const;+ bool softwareUiActive() const;// RivaTuner Statistics Server is running now (gfx::rivaTunerRunning).Q_INVOKABLE bool rivaTunerRunning() const;// An overlay that 监控软件兼容 reacts to is running now: RTSS, NVIDIA's in-game overlaydiff --git a/qml/Veyra/SettingsPage.qml b/qml/Veyra/SettingsPage.qmlindex b58c5378..14822fd5 100644--- a/qml/Veyra/SettingsPage.qml+++ b/qml/Veyra/SettingsPage.qml@@ -766,7 +766,7 @@ VPage {visible: root.section === "compat"VH1 { text: qsTr("兼容") }Text {- text: qsTr("OBS、监控软件兼容需重启;HDR 补帧兼容可在播放中切换。")+ text: qsTr("界面绘制、OBS、监控软件兼容需重启;HDR 补帧兼容可在播放中切换。")color: Theme.t2font.family: Theme.fontUifont.pixelSize: Theme.fsBody@@ -774,6 +774,40 @@ VPage {wrapMode: Text.WordWrap}VGroup {+ VRow {+ // 界面绘制 (veyra/ui/InterfaceRenderer.h, read by main.cpp at start).+ // Software by default: no swapchain or D3D12 device of its own for+ // overlays to hook, and no video memory. OBS 游戏采集兼容 and+ // 监控软件兼容 still draw in software when GPU is chosen.+ readonly property bool gpuChosen: veyra.preferences.uiRenderer === "gpu"+ label: qsTr("界面绘制")+ hint: gpuChosen+ ? (!veyra.softwareUiActive+ ? qsTr("显卡绘制:动画更顺,带阴影与模糊;占用显存和 GPU,可能与小飞机等监控软件冲突")+ : veyra.obsGameCaptureActive+ ? qsTr("OBS 游戏采集兼容开启时,界面始终软件绘制")+ : veyra.overlayCompatActive+ ? qsTr("本次检测到监控软件,仍用软件绘制(监控软件兼容:自动)")+ : qsTr("重启后生效"))+ : (veyra.softwareUiActive+ ? qsTr("软件绘制:兼容性最好,不占显存,不和视频抢 GPU;部分阴影与模糊简化")+ : qsTr("重启后生效"))+ VSeg {+ objectName: "set-ui-renderer"+ options: [{ id: "software", label: qsTr("软件") }, { id: "gpu", label: "GPU" }]+ current: veyra.preferences.uiRenderer === "gpu" ? "gpu" : "software"+ onPicked: id => {+ // A restart changes the renderer unless a compatibility rule+ // keeps the interface in software anyway.+ const changes = id === "gpu"+ ? veyra.softwareUiActive && !veyra.obsGameCaptureActive+ && !((veyra.preferences.overlayCompat || "auto") === "auto" && veyra.presentationOverlayRunning())+ : !veyra.softwareUiActive+ if (veyra.setPreference("uiRenderer", id) && changes)+ obsRestart.open()+ }+ }+ }VRow {label: qsTr("HDR 补帧闪黑兼容")hint: qsTr("默认关闭。仅 NVIDIA HDR10 补帧时生效;4K 额外约 32 MiB 显存,可能增加 GPU 开销。切换时画面可能短暂停顿。")@@ -801,11 +835,16 @@ VPage {VRow {// RivaTuner (MSI Afterburner's OSD), NVIDIA's in-game overlay and GamePP: see// main.cpp. Auto draws the interface in software when one runs at start, so- // they only hook the video.+ // they only hook the video. With 界面绘制 = 软件 (the default) the interface+ // is drawn in software anyway, and this choice changes nothing.+ id: overlayCompatRowreadonly property bool automatic: (veyra.preferences.overlayCompat || "auto") === "auto"+ readonly property bool gpuChosen: veyra.preferences.uiRenderer === "gpu"label: qsTr("监控软件兼容")hint: veyra.obsGameCaptureActive? qsTr("OBS 游戏采集兼容已让界面软件绘制,小飞机 OSD 只显示在视频上")+ : !gpuChosen+ ? qsTr("只在“界面绘制”选 GPU 时起作用;软件绘制时小飞机 OSD 只显示在视频上"): (automatic !== veyra.overlayCompatActive && (veyra.overlayCompatActive || veyra.presentationOverlayRunning()))? qsTr("重启后生效"): veyra.overlayCompatActive@@ -819,6 +858,7 @@ VPage {current: veyra.preferences.overlayCompat || "auto"onPicked: id => {if (veyra.setPreference("overlayCompat", id) && !veyra.obsGameCaptureActive+ && overlayCompatRow.gpuChosen&& (id === "auto") !== veyra.overlayCompatActive&& (veyra.overlayCompatActive || veyra.presentationOverlayRunning()))obsRestart.open()diff --git a/scripts/acceptance/ui-renderer-default.py b/scripts/acceptance/ui-renderer-default.pynew file mode 100644index 00000000..6f65dae6--- /dev/null+++ b/scripts/acceptance/ui-renderer-default.py@@ -0,0 +1,102 @@+"""设置 → 界面绘制 across real launches (claude-software-ui-default-20261026).++Four launches of the task build on one fresh private profile, in a hard-linked copy of+the 2.1.0 NVIDIA runtime base with this tree's QML/i18n; no media, capture or user+package. ui-renderer-default.qml picks values through the real 设置 control.+ 1 fresh profile -> software by default; picking GPU asks to restart+ 2 preference GPU -> D3D12 interface; picking 软件 asks to restart (GPU kept)+ 3 GPU + --overlay-compat-restart -> software (compatibility); picking 软件 needs no restart+ 4 preference software -> software by default+usage: py -3.11 -X utf8 -B -I scripts/acceptance/ui-renderer-default.py+"""+from pathlib import Path+import hashlib, json, os, re, shutil, subprocess++B = Path('E:/项目/Veyra'); T = 'claude-software-ui-default-20261026'; R = Path(__file__).resolve().parents[2]+D = B/'build/claude-screen-recording-20261022'; A = B/'tests'/T/'app'; P = B/'tests'/T/'profile'+L = B/'logs'/T/'launches'; TMP = B/'tmp'/T/'launches'; OUT = B/'reports'/T; SHOTS = B/'tests'/T/'shots'+for p in [L, TMP, OUT, SHOTS]: p.mkdir(parents=True, exist_ok=True)+if P.exists(): shutil.rmtree(P)+P.mkdir(parents=True)+++def sha(p):+ with p.open('rb') as f: return hashlib.file_digest(f, 'sha256').hexdigest()+++def replace(p, data):+ # Unlink first: a hard link to the donor is never written through.+ p.parent.mkdir(parents=True, exist_ok=True)+ if p.exists(): p.unlink()+ p.write_bytes(data)+++donor = B/'releases/release-2.1.0-20261019/runtime-base/NVIDIA'+manifest = json.loads((donor/'package-manifest.json').read_text('utf8'))+if not A.exists():+ for e in manifest['files']:+ rel = e['path']+ if rel.startswith('logs/') or any(x.startswith('user-data-') for x in Path(rel).parts): continue+ p = A/rel; p.parent.mkdir(parents=True, exist_ok=True); os.link(donor/rel, p)+ shutil.copyfile(donor/'package-manifest.json', A/'package-manifest.json')+replace(A/'veyra_qml_ui.exe', (D/'veyra_qml_ui.exe').read_bytes())+for folder in ['qml', 'i18n']:+ for p in (R/folder).rglob('*'):+ if p.is_file(): replace(A/folder/p.relative_to(R/folder), p.read_bytes())+for e in manifest['files']:+ if Path(e['path']).suffix.lower() in ['.dll', '.onnx', '.tflite', '.hsaco', '.dxil']: assert sha(A/e['path']) == e['sha256'], e['path']+(P/'qml-preferences.v1.json').write_text(json.dumps(dict(language='zh-CN', autoResume=False, prewarmEnhancement=False)), 'utf8')+env = {k: v for k, v in os.environ.items() if not k.upper().startswith(('VEYRA_', 'QT_', 'QSG_', 'QML_'))}+env.update(TEMP=str(TMP), TMP=str(TMP), APPDATA=str(P/'AppData'), LOCALAPPDATA=str(P/'LocalAppData'), CUDA_CACHE_PATH=str(TMP/'cuda'),+ QML_DISABLE_DISK_CACHE='1', QT_FORCE_STDERR_LOGGING='1')+main = (R/'qml/Veyra/Main.qml').read_text('utf8'); pos = main.rfind('}')+expect = {+ 1: dict(app='software UI by default', renderer='software', state='softwareUiActive=true overlayCompatActive=false pref= segment=software',+ picked='picked=gpu pref=gpu confirmShown=true', done='done pref=gpu'),+ 2: dict(app='GPU UI: interface drawing preference: GPU', renderer='d3d12', state='softwareUiActive=false overlayCompatActive=false pref=gpu segment=gpu',+ picked='picked=software pref=software confirmShown=true', done='done pref=gpu'),+ 3: dict(app='RTSS compatibility: software UI', renderer='software', state='softwareUiActive=true overlayCompatActive=true pref=gpu segment=gpu',+ picked='picked=software pref=software confirmShown=false', done='done pref=software'),+ 4: dict(app='software UI by default', renderer='software', state='softwareUiActive=true overlayCompatActive=false pref=software segment=software',+ picked=None, done='done pref=software'),+}+running = subprocess.check_output(['tasklist', '/fo', 'csv', '/nh'], text=True, errors='replace')+assert not any(l.lower().startswith('"veyra') for l in running.splitlines()), 'another player is running; do not compete'+results = []+try:+ for step, want in expect.items():+ log_file = L/f'engine-{step}.log'; console = L/f'console-{step}.log'+ for f in (log_file, console):+ if f.exists(): f.unlink()+ shot = SHOTS/f'settings-compat-{step}.png'+ if shot.exists(): shot.unlink()+ loader = ('\nLoader { source: ' + json.dumps((R/'scripts/acceptance/ui-renderer-default.qml').as_uri()) ++ '; onLoaded: { item.shot=' + json.dumps(shot.as_posix()) + '; item.step=' + str(step) + ' } }\n')+ replace(A/'qml/Veyra/Main.qml', (main[:pos] + loader + main[pos:]).encode('utf8'))+ args = [str(A/'veyra_qml_ui.exe'), '--page', 'home', '--size', '1280x800', '--data-dir', str(P), '--exit-after', '40000']+ if step == 3: args.append('--overlay-compat-restart')+ with console.open('wb') as f:+ p = subprocess.run(args, cwd=A, env={**env, 'VEYRA_LOG_FILE': str(log_file)}, stdout=f, stderr=subprocess.STDOUT, timeout=70)+ log = log_file.read_text('utf8', errors='replace'); text = console.read_text('utf8', errors='replace')+ renderer = 'd3d12' if 'interface renderer=d3d12' in log else ('d3d11' if 'interface renderer=d3d11' in log else ('software' if '[app] software UI:' in log else 'unknown'))+ lines = [m.group(1) for m in re.finditer(r'\[ui-renderer-test\] (.+)', log)]+ problems = []+ if p.returncode != 0: problems.append(f'exit {p.returncode}')+ if 'UIR_PASS' not in text or 'UIR_FAIL' in text: problems.append('driver did not pass')+ if f'[app] {want["app"]}' not in log: problems.append(f'missing app log: {want["app"]}')+ if renderer != want['renderer']: problems.append(f'renderer {renderer}, expected {want["renderer"]}')+ if not any(l.endswith(want['state']) for l in lines): problems.append(f'state line {want["state"]!r} missing: {lines}')+ if want['picked'] and want['picked'] not in lines: problems.append(f'pick line {want["picked"]!r} missing: {lines}')+ if want['done'] not in lines: problems.append(f'done line {want["done"]!r} missing: {lines}')+ errors = [x for x in text.splitlines() if any(s in x for s in ['[ERROR]', 'ReferenceError:', 'TypeError:', 'Binding loop detected'])]+ if errors: problems.append('QML/engine errors')+ results.append(dict(step=step, renderer=renderer, passed=not problems, problems=problems, lines=lines, errors=errors[:10],+ screenshot=str(shot) if shot.exists() else None, log=str(log_file)))+ print(json.dumps(results[-1], ensure_ascii=False), flush=True)+finally:+ replace(A/'qml/Veyra/Main.qml', (R/'qml/Veyra/Main.qml').read_bytes())+passed = all(r['passed'] for r in results) and len(results) == 4+(OUT/'launches.json').write_text(json.dumps(dict(passed=passed, exeSha256=sha(A/'veyra_qml_ui.exe'), launches=results,+ scope='four real launches on one private profile; 设置 control picked through its own signal; renderer read from the app log'),+ ensure_ascii=False, indent=1), 'utf8')+assert passed, 'see ' + str(OUT/'launches.json')diff --git a/scripts/acceptance/ui-renderer-default.qml b/scripts/acceptance/ui-renderer-default.qmlnew file mode 100644index 00000000..ba8eec24--- /dev/null+++ b/scripts/acceptance/ui-renderer-default.qml@@ -0,0 +1,58 @@+// Loaded only into a private staging copy, never the user's running package.+// claude-software-ui-default-20261026: one launch of a four-launch sequence on+// one private profile. Opens 设置 → 兼容, logs the actual renderer and the+// 界面绘制 choice, picks a value through the real control and records whether+// the restart confirmation opened.+import QtQuick+Item {+ id: test+ property int step: 0+ property string shot: ""+ property int phase: 0+ property int ticks: 0+ property bool shotSaved: false+ function check(ok,why){if(!ok)throw new Error(why)}+ function find(item,name){+ if(!item)return null+ if(item.objectName===name)return item+ const kids=item.children||[]+ for(let i=0;i<kids.length;++i){const found=find(kids[i],name);if(found)return found}+ return null+ }+ function log(text){veyra.logUi("ui-renderer-test",text);console.log("UIR",text)}+ Timer {interval: 250;repeat: true;running: test.step>0+ onTriggered: {try {+ ++test.ticks+ if(test.phase===0){+ if(test.ticks<6)return+ root.page="set";settingsPage.section="compat";test.phase=1;test.ticks=0+ }else if(test.phase===1){+ if(test.ticks<8)return+ const seg=find(settingsPage,"set-ui-renderer"),confirm=find(settingsPage,"obs-restart-confirm")+ check(seg!==null&&confirm!==null,"界面绘制 control and restart confirmation found")+ log("step="+test.step+" softwareUiActive="+veyra.softwareUiActive+" overlayCompatActive="+veyra.overlayCompatActive+ +" pref="+(veyra.preferences.uiRenderer||"")+" segment="+seg.current)+ // The grab is asynchronous: pick only after the PNG of the state before the pick is written.+ if(test.shot!=="")root.contentItem.grabToImage(r=>{test.shotSaved=r.saveToFile(test.shot)})+ test.phase=2;test.ticks=0+ }else if(test.phase===2){+ if(test.shot!==""&&!test.shotSaved&&test.ticks<20)return+ check(test.shot===""||test.shotSaved,"screenshot saved")+ const seg=find(settingsPage,"set-ui-renderer"),confirm=find(settingsPage,"obs-restart-confirm")+ // 1 picks GPU from the software default, 2 picks 软件 from GPU (then GPU is+ // stored again for 3), 3 picks 软件 while compatibility keeps it in software.+ const target=test.step===1?"gpu":test.step===2||test.step===3?"software":""+ if(target!==""){+ seg.picked(target)+ log("picked="+target+" pref="+(veyra.preferences.uiRenderer||"")+" confirmShown="+confirm.shown)+ if(confirm.shown){confirm.close();confirm.rejected()}+ }+ if(test.step===2)check(veyra.setPreference("uiRenderer","gpu"),"GPU stored again for the next launch")+ test.phase=3;test.ticks=0+ }else if(test.phase===3){+ if(test.ticks<4)return+ log("done pref="+(veyra.preferences.uiRenderer||""));console.log("UIR_PASS");Qt.quit()+ }+ }catch(e){console.error("UIR_FAIL",test.phase,e.message);Qt.quit()}}+ }+}diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cppindex 2c52aadc..2c47f00a 100644--- a/src/ui/QmlPlayerBridge.cpp+++ b/src/ui/QmlPlayerBridge.cpp@@ -6857,6 +6857,11 @@ bool QmlPlayerBridge::setPreference(const QString& key, const QVariant& value) {const QString v = value.toString();if (v != QLatin1String("auto") && v != QLatin1String("off")) return false;stored = v;+ } else if (key == QLatin1String("uiRenderer")) {+ // 设置 → 界面绘制 (veyra/ui/InterfaceRenderer.h); read by main.cpp before Qt starts.+ const QString v = value.toString();+ if (v != QLatin1String("software") && v != QLatin1String("gpu")) return false;+ stored = v;} else if (key == QLatin1String("gpuPriority")) {const QString v=value.toString();if(v!=QLatin1String("normal")&&v!=QLatin1String("high")&&v!=QLatin1String("realtime"))return false;@@ -7127,6 +7132,7 @@ void QmlPlayerBridge::resetShortcuts() {}bool QmlPlayerBridge::obsGameCaptureActive() const { return qApp && qApp->property("veyraObsGameCapture").toBool(); }bool QmlPlayerBridge::overlayCompatActive() const { return qApp && qApp->property("veyraOverlayCompat").toBool(); }+bool QmlPlayerBridge::softwareUiActive() const { return qApp && qApp->property("veyraSoftwareUi").toBool(); }bool QmlPlayerBridge::rivaTunerRunning() const { return gfx::rivaTunerRunning(); }bool QmlPlayerBridge::presentationOverlayRunning() const {return gfx::rivaTunerRunning() || gfx::nvidiaOverlayRunning() || gfx::gamePPRunning() || gfx::douyinLiveCompanionRunning();diff --git a/tests/unit/UiContractTests.cpp b/tests/unit/UiContractTests.cppindex 8e4280d1..93a67215 100644--- a/tests/unit/UiContractTests.cpp+++ b/tests/unit/UiContractTests.cpp@@ -11,6 +11,7 @@#include "veyra/engine/PreviewView.h"#include "veyra/source/CaptureAudioClock.h"#include "veyra/source/DeckLinkInputConnection.h"+#include "veyra/ui/InterfaceRenderer.h"#include <iostream>#include <vector>#include <stdexcept>@@ -99,9 +100,40 @@ void outputRateContracts(){require(std::wstring(h.rateStatus(s))==L"补帧调度降档","uncapped FG admission shortfall retains its own warning");std::cout<<"PASS output-rate policy: dedup, static, half-rate, display sync, caps, provider, speed, comparison, real deficits and resets\n";}+// 设置 → 界面绘制 (2026-10-26): software unless GPU is chosen; the OBS and 监控软件兼容+// rules and VEYRA_UI_RHI keep the meaning they had before the default changed.+static void interfaceRendererContracts(){+ using namespace veyra::ui;+ using R=InterfaceRendererReason;+ auto decide=[](bool gpu,bool obs,bool autoCompat,bool overlay,bool restart,bool forced){+ return decideInterfaceRenderer({gpu,obs,autoCompat,overlay,restart,forced});+ };+ auto d=decide(false,false,true,false,false,false);+ require(d.software&&d.reason==R::Default&&!d.overlayCompat,"a fresh profile draws the interface in software");+ d=decide(true,false,true,false,false,false);+ require(!d.software&&d.reason==R::Gpu,"GPU chosen and nothing to stay compatible with: GPU interface");+ d=decide(true,false,true,true,false,false);+ require(d.software&&d.reason==R::OverlayCompat&&d.overlayCompat,"GPU chosen, an overlay at start and 监控软件兼容 auto: software as before");+ d=decide(true,false,false,true,false,false);+ require(!d.software&&!d.overlayCompat,"GPU chosen with 监控软件兼容 off stays GPU next to an overlay, as before");+ d=decide(true,false,true,false,true,false);+ require(d.software&&d.reason==R::OverlayCompat,"an accepted compatibility restart draws in software");+ for(bool gpu:{false,true})for(bool forced:{false,true}){+ d=decide(gpu,true,true,true,false,forced);+ require(d.software&&d.reason==R::ObsGameCapture&&!d.overlayCompat,"OBS game capture always draws in software");+ }+ d=decide(false,false,true,true,false,false);+ require(d.software&&d.reason==R::OverlayCompat&&d.overlayCompat,"software default with an overlay still reports the compatibility rule");+ for(bool gpu:{false,true})for(bool overlay:{false,true}){+ d=decide(gpu,false,true,overlay,false,true);+ require(!d.software&&d.reason==R::Gpu&&!d.overlayCompat,"VEYRA_UI_RHI picks a GPU renderer and skips the compatibility rule");+ }+ std::cout<<"PASS interface renderer: software default, GPU choice, OBS / overlay compatibility and VEYRA_UI_RHI precedence\n";+}int wmain(int argc,wchar_t** argv){try{using namespace veyra;outputRateContracts();+ interfaceRendererContracts();// Manual turns compose with metadata, including an already-oriented DAR.for(int metadata:{0,90,180,270})for(int mode=0;mode<=6;++mode){engine::PreviewView v;v.rotationDegrees=metadata;v.mode=mode;