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++

test(perf): archive ordinary R0 regression and exit crash evidence

Veyra Goal Agenteb8b1a2dc124
diff --git a/docs/PERF_R0_ACCEPTANCE_2026-10-05.md b/docs/PERF_R0_ACCEPTANCE_2026-10-05.md
index be7d2873..f7df0e06 100644
--- a/docs/PERF_R0_ACCEPTANCE_2026-10-05.md
+++ b/docs/PERF_R0_ACCEPTANCE_2026-10-05.md
@@ -13,3 +13,48 @@
5. 翻译/源码边界/运行库原字节/工作树保护/最终源码存档、可运行候选路径及完成账本。
尚未运行的检查不能提前标通过。可运行测试失败先保留证据并修复;不可通过的软件候选要回退。需要用户真实来源或主观画质的缺口单独列明。
+
+## 当前产品及已执行的功能回归
+
+产品源码仍是 `e8f0bd1082293c88a3ca1db851667162e4cef7a9`,其后的提交只补文档/测试;当前 `B2d/veyra_qml_ui.exe` SHA256 `8c2276d68d15c2e4466befcf367439b7efc42c68defd5ef93182398c9e8d8a03`。实际NR原件 SHA256 `f95feb54137ea11979f9b4ec4f00afd84b5c98a5624d3388fbf6a87714a39fcc`,Lecram 310.8.3.0 / HashMismatch;不改字节、不冒充官方签名。Qt/FFmpeg/其他增强组件来自封存完整NVIDIA依赖。所有测试独立目录,末尾校验EXE/DLL/QML未改,未写入用户profile。
+
+| 检查 | 实际结果与证据 |
+|---|---|
+| 当前构建 | `build-r0-contracts-v1`44步成功;增加Auto ID6后的效果链测试v2两步、Qt Quick夹具v3/v4重建成功。产品EXE没有因此重写引擎 |
+| 定向合同15项 | `R0-contracts-v2`其中14项通过:repair、Xbox、1008个链组合/原生导出/图片边界、preset Auto往返、availability、UI合同、VFG设置、Auto控制器、三语i18n、qml-data、easing、音频倍速、字幕文本/合成。Qt Quick在`R0-contracts-v5`独立通过39项、0失败/0跳过。Xbox是软件合同测试,未新增主机实测 |
+| 实际Qt功能/布局 | `R0-product-ui-v1-summary`GPU及`--obs-game-capture`软件绘制各功能/布局,共4/4通过。真实内嵌字幕逗号/三行、倍速1.3/1.8/0.25/4/1媒体时间、非法值/取消、全屏菜单遮挡、AMD能力灰态;720/1280/1600宽度专业模式布局、全屏菜单保持/锁定隐藏/退出恢复及最大化恢复。无ERROR/FATAL/ReferenceError/TypeError |
+| 严格页面启动 | `nr-r0-smoke.py B2d R0-qml-smoke-v4`实际home/minimal/pro/node/export/settings/capture-dialog/playback共8项通过,0跳过;3500ms每项,无测试Loader。记录`logs/perf-nr-20261004/R0-qml-smoke-v4/run-20261004T214158154Z-77eec4cd/result.json` |
+| 实际RTSS | `R0-rtss-ordinary-v1`本机安装原件,低/大OSD两套profile各普通播放/单NR参数/resize-pause-seek三项,共6通过。实际hook、共享内存OSD、原生目标窗口与视频/UI截图,背景alpha=255,无重启循环;cleanup逐字节恢复全部用户Profiles并退出本轮helper。没有额外GPU竞争/高倍率/4K压力 |
+| 当前导出worker | `nr-export-worker.py B2d R0-export-worker-v1`真实lifecycle、取消边界、队列、HEVC MP4/MKV共5/5通过;队列四个完整输出文件SHA相同。工作线程EXE SHA256 `ced1ca191f975a0bb661c2889774aa9386bb911c3317e36afff9cb62a61d46fc`。原生Auto导出240全解码帧另在3b证据中一致 |
+
+上述原始证据根目录都是`E:/项目/Veyra/logs/perf-nr-20261004/`,逐案例保存命令/实际EXE/运行日志/结果,不合并失败原记录。普通播放33组已完成;OBS实际游戏采集尚未运行,不能把软件绘制启动当作OBS已抓到视频。
+
+## 回归夹具失败与处理
+
+- `R0-contracts-v1`效果链硬编码864组合在增加第七策略后已过时,真实组合数1008;只修期望数量。VFG测试缺scratch参数、easing缺offscreen plugin,补齐隔离目录/Qt测试依赖;只停止挂住的本轮easing PID44288,未动其他进程。
+- Qt Quick原断言只允许6档;保留旧六档编号及标签,追加Auto ID6/灰态检查。注册的inline NR卡使用引擎创建context,显式注入UI-only snapshot,真实bridge覆盖仍由实际Qt进程承担。补齐snapshot.logUi后菜单关闭正常;四卡点击前等500ms accordion动画完成,v5通过。初版失败v1–v4全保留。Quick测试仍有既有独立ExportPage/PlaybackRate夹具初始undefined、focus警告;未改产品去迁就夹具,实际产品回归无对应错误。
+- `R0-qml-smoke-v1`子Windows PowerShell继承了桌面bundled PowerShell的PSModulePath而找不到Get-FileHash;wrapper显式导入该子进程自己的Utility/Management模块。v2引用的参数名被当位置参数、v3缺要求的qml-tests/QtTest/offscreen依赖;按现存readonly入口合同补齐独立stage,v4真正执行8项通过。未修改验收脚本、全局环境或降低必测项。
+
+## 普通播放收尾:33/33通过
+
+`nr-r0-normal.py B2d R0-normal-v1`串行执行同源M1、固定1280×800、实际GPU进程普通档,各S1/S2-720/S3/S4/S5-existing封存A/当前B各3轮;S4另测同B关闭3c队列分工各3轮,共33个普通50秒进程,全部通过且sourceSkipped=0。无竞争程序;Auto默认off。最后NR的滚动P95观察中位与全增强合并区间分别报告,不冒充全帧总体P95或物理显示延迟。
+
+| 配置 | A最后NR / B最后NR ms | A增强 / B增强 ms | A / B成功软件Present P99 ms |
+|---|---|---|---|
+| S1 单层原生1080 | 6.129 / 6.159 | 7.002 / 7.086 | 34.044 / 33.999 |
+| S2 单层720(尺寸66.7%) | 3.670 / 3.669 | 4.273 / 4.274 | 34.066 / 34.032 |
+| S3 单NR1080上限+SR4K | 6.221 / 6.189 | 10.310 / 10.237 | 34.054 / 34.046 |
+| S4 双NR1080上限+SR4K+DLSS2X | 6.431 / 5.989 | 19.481 / 18.795 | 17.236 / 17.233 |
+| S5 既有480/720/1080三层 | 6.272 / 6.289 | 12.796 / 12.817 | 34.038 / 34.017 |
+
+S4完整候选对基线增强区间下降3.52%;同一B的DIRECT增强19.299ms,队列分工对其下降2.61%。其余微小差异没有稳定收益,不能冒充NR模型提速。成功Present P99几乎没变;全矩阵最长110.209ms,图提交仍约109.793ms。33组未复现此前2.8秒断档不等于根治;所有运行稳态UI active=false,不能替代点击桌面前后完整焦点对照。封存日志`R0-normal-v1-summary/{artifacts.json,completed.json,comparison.json,per-run.csv}`及逐组原始证据。
+
+## 退出重建:阻塞交付的真实崩溃
+
+`nr-r0-close.py B2d R0-close-rebuild-v1`普通双NR+SR4K+DLSS2X播放,请求FSR3.1,200ms后Qt.quit,第一例访问违规退出3221225477(0xC0000005)。Qt确已退出,但后台继续NGX创建,向已销毁HWND创建交换链得到0x80070005,随后清理时崩溃。`nr-r0-close.py A R0-close-baseline-v1 fsr3`封存基线也同样崩溃,证明是既有退出边界缺陷,不能作为优化收益或新增回归隐瞒。两次player/console/result/minidump原件在同名日志目录保留。
+
+源码根因:PresentSink::shutdown未清空非拥有queue_;VideoPresenter随后释放该队列。下次initialize在交换链成功后才赋新queue_,中途失败导致shutdown向悬空旧queue_调用Signal。EngineController初始化及失败回滚缺停止检查,退出仍尝试向失效窗口建图。先封存当前回归工具/数据说明,再最小修复PresentSink清理及初始化失败、EngineController长调用返回后的取消检查;不修改NR算法、运行库或稳态调度。候选此时不可交付;所有退出场景和真实OBS检查尚待修复后验证。
+
+## OBS(尚待执行)
+
+OBS按官方32.1.2源码的portable配置及obs-websocket RPC1另写隔离驱动;只复制只读安装payload、临时认证服务,只选择本轮唯一标题的Veyra窗口,禁用桌面/麦克风输入和网络推流。仅待普通计时结束后执行正常录制、暂停恢复/缩放/全屏功能;未执行前无通过结论。
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index a1996c74..bd5b479e 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -8334,3 +8334,11 @@ before347a184/candidate5edbf79,v1因不存在nrLayers成员构建失败,58f5
`nr-auto-final.py B2d B3b-product-native-v1`10/10通过,470原生全帧/PTS/history,包括200默认off与旧B4b完整CSV一致;120帧×2的实际NVENC/mux Auto与固定原生整文件SHA相同,`nr-quality-review.py`完整240解码MD5/PTS/元数据一致。12对PNG+SSIM+PSNR存B3b-product-native-v1-quality/review.html;低档改变画面,不冒充主观批准。Auto控制器当前构建CPU运行通过;策略/preset合同扩展到policy6待R0构建。证据E:/项目/Veyra/logs/perf-nr-20261004/B3b-{normal-v1,product-ui-v2,product-native-v1}-summary。
5a保存原方案检测填黑反例:18/255暗边误判抹529920像素、后出现字幕滞回抹2640像素。B5a-native-v1 base错误借同Core触发refused-prepare,改无NGX base后v2十二组480完整RGBA重复无差异/debug0、ROI外保原图为0差异。实际ROI GPU区间减少17.44/19.69%,但有效区PSNR31.64–35.03/最大55,成本不含额外base及回读,不能视为产品收益。已查看生成对照;没有真实电影/采集验收。拒绝默认检测/ROI/填黑,产品从未接入,无生产改动需回退;独立实验/失败原图保留。文档PERF_5A_LETTERBOX及B5a-native-v2-summary。
+
+## 2026-10-05 R0普通回归及退出崩溃存档
+
+R0合同14项+Qt Quick39项通过;真实Qt GPU/软件功能布局4/4、严格8页启动8/8、实际RTSS两OSD×三正常场景6/6且用户Profiles恢复、当前导出worker5/5通过。夹具过时组合数量/第七策略、inline context、accordion动画、子PowerShell模块/参数/QtTest依赖失败已保存并定向修正;不改产品迁就测试。证据详PERF_R0_ACCEPTANCE_2026-10-05及同名E盘logs。
+
+`nr-r0-normal.py B2d R0-normal-v1`33/33正常负载交错通过:M1各五配置A/B三轮、S4同B DIRECT三轮,sourceSkipped全0。S4增强19.481→18.795ms(3.52%),同B DIRECT19.299→18.795(2.61%);其余配置无稳定收益,单NR原生约6.1ms,软件Present P99几乎未变。最长成功Present110.209ms,CPU图提交长尾仍在;不宣称后台掉帧根治或NR内核提速。全部payload SHA原样。原日志/JSON/CSV在E:/项目/Veyra/logs/perf-nr-20261004/R0-normal-v1-summary及33原始目录。
+
+`nr-r0-close.py B2d R0-close-rebuild-v1`请求FSR后200ms退出实际C0000005;封存A的`R0-close-baseline-v1 fsr3`同样失败。初始化在Qt HWND销毁后继续,CreateSwapChainForHwnd 80070005后清理崩溃。源码确认PresentSink非拥有旧队列未清空,交换链失败前未赋新队列,随后VideoPresenter释放旧队列;重建缺取消检查/停止后仍回滚。先存档本候选和完整失败证据,再最小修复queue生命周期/长初始化取消。没有压力/GPU竞争/设备移除;OBS真实采集仍待,候选尚不可交付。
diff --git a/scripts/perf/nr-final-package.py b/scripts/perf/nr-final-package.py
new file mode 100644
index 00000000..e5531403
--- /dev/null
+++ b/scripts/perf/nr-final-package.py
@@ -0,0 +1,74 @@
+"""Local complete NVIDIA candidate using unchanged approved dependencies.
+
+No upload/release or AMD validation. Current build and tracked QML are copied,
+test loaders/tools are excluded, a complete manifest and source ZIP are kept.
+"""
+from pathlib import Path
+import importlib.util, json, os, re, shutil, subprocess, sys, zipfile
+
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='perf-nr-20261004'
+spec=importlib.util.spec_from_file_location('matrix',ROOT/'scripts/perf/nr-matrix.py');matrix=importlib.util.module_from_spec(spec);spec.loader.exec_module(matrix)
+variant,label=sys.argv[1:3]
+assert label.replace('-','').isalnum()
+matrix.assert_gpu_tests_idle()
+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/perf/nr-control.py'),'guard'],check=True)
+assert not subprocess.check_output(['git','-C',str(ROOT),'status','--porcelain=v1']).strip(), 'Commit the tested source first'
+head=subprocess.check_output(['git','-C',str(ROOT),'rev-parse','HEAD']).decode().strip()
+parent=BASE/'test-packages'/TASK
+package=parent/('Veyra-'+label+'-NVIDIA-win64-portable');assert not package.exists()
+source=BASE/'test-packages'/TASK/'Veyra-2.0.3-perf-baseline-A-NVIDIA-win64-portable'
+shutil.copytree(source,package,copy_function=matrix.copy_dependency,
+ ignore=shutil.ignore_patterns('*.log','logs','user-data*','*.dmp','*tests.exe','qml-tests','QtTest','Qt6Test.dll','Qt6QuickTest.dll','qoffscreen.dll'))
+build=BASE/'build'/TASK/variant
+shutil.copy2(build/'veyra_qml_ui.exe',package/'veyra_qml_ui.exe')
+shutil.copytree(ROOT/'qml',package/'qml',dirs_exist_ok=True)
+build_shaders=build/'shaders'
+if build_shaders.is_dir():shutil.copytree(build_shaders,package/'shaders',dirs_exist_ok=True)
+assert not any(p.name.startswith('veyra_') and p.name.endswith('_tests.exe') for p in package.rglob('*.exe'))
+assert not any(value in (package/'qml/Veyra/Main.qml').read_text(encoding='utf-8') for value in ('PerfProbe.qml','CloseProbe.qml','ObsProbe.qml','test-loader'))
+assert not (package/'runtime_local/amd/nr').exists()
+deps={p.relative_to(source).as_posix():matrix.digest(p) for p in source.rglob('*.dll')}
+assert all(matrix.digest(package/name)==sha for name,sha in deps.items() if (package/name).is_file())
+for path in ROOT.glob('docs/PERF_*.md'):
+ dest=package/'docs'/path.name;dest.parent.mkdir(exist_ok=True);shutil.copy2(path,dest)
+source_zip=parent/('Veyra-'+label+'-veyra-source.zip')
+subprocess.run(['git','-C',str(ROOT),'archive','--format=zip','--output='+str(source_zip),head],check=True)
+cache=(build/'CMakeCache.txt').read_text(encoding='utf-8')
+display=re.search(r'^VEYRA_DISPLAY_VERSION:STRING=(.+)$',cache,re.M).group(1)
+manifest=json.loads((package/'package-manifest.json').read_text(encoding='utf-8-sig'))
+manifest.update(candidate=label,displayVersion=display,baseCommit='8cdc612120cbf23ba116a33c3cb0a53e2043f718',
+ productCodeCommit='e8f0bd1082293c88a3ca1db851667162e4cef7a9',sourceArchiveCommit=head,worktreeDirty=False,
+ releaseReady=False,localOnly=True,gpuPackage='NVIDIA',sourceZipSha256=matrix.digest(source_zip),
+ validation='RTX5070/616.56 normal-load candidate; other GPUs, real consoles/capture and physical display latency unverified')
+manifest['correspondingSource']['application']='../'+source_zip.name
+manifest['correspondingSource']['displayVersionOverride']='-DVEYRA_DISPLAY_VERSION='+display
+manifest['files']=[{'path':p.relative_to(package).as_posix(),'size':p.stat().st_size,'sha256':matrix.digest(p)}
+ for p in sorted(package.rglob('*')) if p.is_file() and p.name!='package-manifest.json']
+(package/'package-manifest.json').write_text(json.dumps(manifest,ensure_ascii=False,indent=2),encoding='utf-8')
+archive=parent/(package.name+'.zip');assert not archive.exists()
+with zipfile.ZipFile(archive,'x',compression=zipfile.ZIP_DEFLATED,compresslevel=6) as z:
+ for path in sorted(package.rglob('*')):
+ if path.is_file():z.write(path,arcname=path.relative_to(parent).as_posix())
+verify=BASE/'verify'/TASK/label;verify.mkdir(parents=True,exist_ok=False)
+with zipfile.ZipFile(archive) as z:z.extractall(verify)
+extracted=verify/package.name
+for row in manifest['files']:
+ assert matrix.digest(extracted/row['path'])==row['sha256'], row['path']
+profile=BASE/'tests'/TASK/(label+'-package-profile');profile.mkdir(exist_ok=False)
+tmp=BASE/'tmp'/TASK/(label+'-package');tmp.mkdir(exist_ok=False)
+logs=BASE/'logs'/TASK/(label+'-package');logs.mkdir(exist_ok=False)
+env={k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_','QT_QUICK_BACKEND','QSG_RHI_BACKEND'))}
+env.update(TEMP=str(tmp),TMP=str(tmp),VEYRA_LOG_FILE=str(logs/'player.log'),QT_FORCE_STDERR_LOGGING='1',QML_DISABLE_DISK_CACHE='1')
+command=[str(extracted/'veyra_qml_ui.exe'),'--data-dir',str(profile),'--page','pro','--size','1280x800','--exit-after','7000',str(matrix.SOURCES['M1'])]
+with (logs/'console.log').open('xb') as stream:
+ rc=subprocess.run(command,cwd=extracted,env=env,stdout=stream,stderr=subprocess.STDOUT,timeout=60).returncode
+text=(logs/'player.log').read_text(encoding='utf-8',errors='replace')
+assert rc==0 and 'Veyra QML session started' in text and 'playback' in text.lower()
+assert not any(value in text for value in ('[ERROR]','[FATAL]','ReferenceError:','TypeError:','no root object'))
+assert all(matrix.digest(extracted/row['path'])==row['sha256'] for row in manifest['files'])
+receipt={'sourceArchiveCommit':head,'productCodeCommit':manifest['productCodeCommit'],'displayVersion':display,
+ 'package':str(package),'archive':str(archive),'archiveSha256':matrix.digest(archive),'archiveBytes':archive.stat().st_size,
+ 'sourceZip':str(source_zip),'sourceZipSha256':matrix.digest(source_zip),'verifiedExtraction':str(extracted),
+ 'fileCount':len(manifest['files']),'command':command,'exitCode':rc,'passed':True,'localOnly':True}
+(logs/'result.json').write_text(json.dumps(receipt,ensure_ascii=False,indent=2),encoding='utf-8')
+matrix.assert_gpu_tests_idle();print('FINAL_LOCAL_PACKAGE',json.dumps(receipt,ensure_ascii=False),flush=True)
diff --git a/scripts/perf/nr-r0-close.py b/scripts/perf/nr-r0-close.py
new file mode 100644
index 00000000..6fdd7368
--- /dev/null
+++ b/scripts/perf/nr-r0-close.py
@@ -0,0 +1,40 @@
+"""Close during ordinary user-requested provider/NR rebuild; no forced GPU fault."""
+from pathlib import Path
+import importlib.util, json, os, shutil, subprocess, sys, time
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='perf-nr-20261004'
+spec=importlib.util.spec_from_file_location('matrix',ROOT/'scripts/perf/nr-matrix.py');matrix=importlib.util.module_from_spec(spec);spec.loader.exec_module(matrix)
+variant,label=sys.argv[1:3];selected=sys.argv[3:];matrix.assert_gpu_tests_idle();folder=BASE/'logs'/TASK/(label+'-summary');folder.mkdir(exist_ok=False)
+app=BASE/'tests'/TASK/(label+'-app');assert not app.exists()
+shutil.copytree(BASE/'test-packages'/TASK/'Veyra-2.0.3-perf-baseline-A-NVIDIA-win64-portable',app,copy_function=matrix.copy_dependency)
+shutil.copy2(BASE/'build'/TASK/variant/'veyra_qml_ui.exe',app/'veyra_qml_ui.exe')
+if variant != 'A':shutil.copytree(ROOT/'qml',app/'qml',dirs_exist_ok=True)
+shutil.copy2(ROOT/'scripts/perf/nr-r0-close.qml',app/'qml/Veyra/CloseProbe.qml')
+main=app/'qml/Veyra/Main.qml';text=main.read_text(encoding='utf-8');at=text.rfind('}')
+main.write_text(text[:at]+'\n Loader { source:"CloseProbe.qml"; onLoaded:{const r=new XMLHttpRequest();r.open("GET","'+(app/'close-run.json').as_uri()+'",false);r.send();const c=JSON.parse(r.responseText);item.media=c.media;item.action=c.action} }\n'+text[at:],encoding='utf-8')
+payload={p.relative_to(app).as_posix():matrix.digest(p) for p in app.rglob('*') if p.is_file() and p.suffix.lower() in ('.exe','.dll','.qml')}
+(folder/'artifacts.json').write_text(json.dumps(payload,ensure_ascii=False,indent=2),encoding='utf-8');results=[]
+actions=('fsr3','xess','vfg','nr-runtime','nr-size','nr-layer','stop')
+if selected:
+ assert all(action in actions for action in selected)
+ actions=tuple(action for action in actions if action in selected)
+for action in actions:
+ matrix.assert_gpu_tests_idle();name=label+'-'+action;out=BASE/'logs'/TASK/name;tmp=BASE/'tmp'/TASK/name;profile=BASE/'tests'/TASK/name/'profile'
+ for path in (out,tmp,profile):path.mkdir(parents=True,exist_ok=False)
+ (profile/'qml-preferences.v1.json').write_text(json.dumps({'overlayCompat':'off','prewarmEnhancement':False,'gpuPriority':'normal'}),encoding='utf-8')
+ (app/'close-run.json').write_text(json.dumps({'action':action,'media':str(matrix.SOURCES['M1']).replace('\\','/')}),encoding='utf-8')
+ env={k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_','QT_QUICK_BACKEND','QSG_RHI_BACKEND'))}
+ env.update(TEMP=str(tmp),TMP=str(tmp),VEYRA_LOG_FILE=str(out/'player.log'),QML_DISABLE_DISK_CACHE='1',QML_XHR_ALLOW_FILE_READ='1',QT_FORCE_STDERR_LOGGING='1')
+ command=[str(app/'veyra_qml_ui.exe'),'--data-dir',str(profile),'--page','pro','--size','1280x800','--exit-after','60000'];start=time.monotonic();print('R0_CLOSE_START',action,flush=True)
+ with (out/'console.log').open('xb') as stream:
+ try:rc=subprocess.run(command,cwd=app,env=env,stdout=stream,stderr=subprocess.STDOUT,timeout=70).returncode
+ except subprocess.TimeoutExpired:rc=124
+ text=(out/'player.log').read_text(encoding='utf-8',errors='replace')
+ errors=[line for line in text.splitlines() if any(value in line for value in ('[ERROR]','[FATAL]','CLOSE_UI_FAIL','ReferenceError:','TypeError:','leaked parameter block'))]
+ row={'action':action,'command':command,'exitCode':rc,'wallSeconds':time.monotonic()-start,'exeSha256':matrix.digest(app/'veyra_qml_ui.exe'),'quitEvidence':[line for line in text.splitlines() if 'CLOSE_UI_QUIT' in line],'errors':errors,
+ 'passed':rc==0 and 'CLOSE_UI_PASS' in text and not errors,'pressure':False}
+ results.append(row);(out/'result.json').write_text(json.dumps(row,ensure_ascii=False,indent=2),encoding='utf-8');(folder/'completed.json').write_text(json.dumps(results,ensure_ascii=False,indent=2),encoding='utf-8')
+ print('R0_CLOSE_RESULT',action,row['passed'],rc,flush=True)
+ if not row['passed']:print(text[-5000:],flush=True);raise SystemExit(1)
+assert all(matrix.digest(app/name)==sha for name,sha in payload.items());matrix.assert_gpu_tests_idle()
+(folder/'summary.json').write_text(json.dumps({'runs':results,'passed':True,'payloadUnchanged':True,'pressure':False},ensure_ascii=False,indent=2),encoding='utf-8')
+print('R0_CLOSE_COMPLETE',len(results),flush=True)
diff --git a/scripts/perf/nr-r0-close.qml b/scripts/perf/nr-r0-close.qml
new file mode 100644
index 00000000..d7ba9ba4
--- /dev/null
+++ b/scripts/perf/nr-r0-close.qml
@@ -0,0 +1,48 @@
+import QtQuick
+Item {
+ id: probe
+ property var appWindow: Window.window
+ property string media: ""
+ property string action: ""
+ property int phase: 0
+ property double phaseAt: 0
+ property double started: Date.now()
+ function require(ok, why) { if (!ok) { console.log("CLOSE_UI_FAIL", why); Qt.exit(3); throw new Error(why) } }
+ Timer {
+ interval: 100; running: true; repeat: true
+ onTriggered: {
+ const now = Date.now()
+ probe.require(now-probe.started < 55000, "timeout")
+ if (!probe.media) return
+ if (probe.phase === 0) {
+ veyra.muted = true; veyra.lowLatency = false
+ veyra.videoHdr = false; veyra.colorEnabled = false
+ veyra.nrEnabled = true; veyra.srEnabled = false; veyra.fgEnabled = false
+ probe.require(veyra.duplicateNrLayer(veyra.nrLayers[0].index) >= 0, "duplicate")
+ for (let layer of veyra.nrLayers) {
+ probe.require(veyra.setNrLayerParameter(layer.index,"runtime",0), "runtime")
+ probe.require(veyra.setNrLayerParameter(layer.index,"sizePolicy",0), "1080 cap")
+ probe.require(veyra.setNrLayerParameter(layer.index,"temporal",0), "temporal")
+ }
+ veyra.videoSrQuality = 0; veyra.srTargetIndex = 2; veyra.srEnabled = true
+ veyra.fgBackendName = "dlss"; veyra.fgMultiplier = 2; veyra.fgEnabled = true
+ veyra.openPath(probe.media); probe.phase = 1; return
+ }
+ probe.require(!veyra.failed, "engine failure")
+ if (probe.phase === 1) {
+ if (!veyra.nrActive || !veyra.srActive || !veyra.fgActive || veyra.position < 2) return
+ if (probe.action === "fsr3" || probe.action === "xess" || probe.action === "vfg") veyra.fgBackendName = probe.action
+ else if (probe.action === "nr-runtime") probe.require(veyra.setNrLayerParameter(veyra.nrLayers[0].index,"runtime",2), "SF-v2 switch")
+ else if (probe.action === "nr-size") probe.require(veyra.setNrLayerParameter(veyra.nrLayers[0].index,"sizePolicy",3), "size switch")
+ else if (probe.action === "nr-layer") probe.require(veyra.duplicateNrLayer(veyra.nrLayers[0].index) >= 0, "third layer")
+ else if (probe.action === "stop") veyra.stopPlayback()
+ else probe.require(false,"unknown action")
+ probe.phaseAt = now; probe.phase = 2; return
+ }
+ if (probe.phase === 2 && now-probe.phaseAt >= 200) {
+ console.log("CLOSE_UI_QUIT", probe.action, "applying="+veyra.applying, veyra.runStatusDetail)
+ console.log("CLOSE_UI_PASS"); Qt.quit(); probe.phase = 3
+ }
+ }
+ }
+}
diff --git a/scripts/perf/nr-r0-contracts.py b/scripts/perf/nr-r0-contracts.py
new file mode 100644
index 00000000..c75bf30d
--- /dev/null
+++ b/scripts/perf/nr-r0-contracts.py
@@ -0,0 +1,48 @@
+"""Directed product regression; no pressure/competition/device removal fixtures."""
+from pathlib import Path
+import ctypes,importlib.util,json,os,shutil,subprocess,sys,time
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='perf-nr-20261004'
+spec=importlib.util.spec_from_file_location('matrix',ROOT/'scripts/perf/nr-matrix.py');matrix=importlib.util.module_from_spec(spec);spec.loader.exec_module(matrix)
+variant,label=sys.argv[1:3];selected=sys.argv[3:];matrix.assert_gpu_tests_idle();folder=BASE/'logs'/TASK/label;folder.mkdir(parents=True,exist_ok=False)
+app=BASE/'tests'/TASK/(label+'-app');shutil.copytree(BASE/'test-packages'/TASK/'Veyra-2.0.3-perf-baseline-A-NVIDIA-win64-portable',app,copy_function=matrix.copy_dependency)
+shutil.copy2(BASE/'build'/TASK/variant/'veyra_qml_ui.exe',app/'veyra_qml_ui.exe');shutil.copytree(ROOT/'qml',app/'qml',dirs_exist_ok=True)
+shutil.copytree(ROOT/'tests/qml/quick',app/'qml-tests');qt=Path('C:/veyra-deps/qt-veyra/6.8.3/msvc2022_64')
+for dll in ('Qt6QuickTest.dll','Qt6Test.dll'):
+ if not (app/dll).exists():shutil.copy2(qt/'bin'/dll,app/dll)
+shutil.copytree(qt/'qml/QtTest',app/'qml/QtTest',copy_function=matrix.copy_dependency)
+shutil.copy2(qt/'plugins/platforms/qoffscreen.dll',app/'platforms/qoffscreen.dll')
+# Only this Python parent and its test children inherit no crash dialog. No
+# Windows setting or unrelated process is changed.
+ctypes.windll.kernel32.SetErrorMode(0x0002)
+fixtures=BASE/'tests/playback-smoothness-20261004/fixtures';assert (fixtures/'tone.wav').is_file()
+cases=[('repair','veyra_repair_contract_tests',[]),('xbox','veyra_xbox_tests',[]),('effect-chain','veyra_effect_chain_tests',[]),
+ ('preset','veyra_repair_preset_tests',[str(BASE/'tests'/TASK/label/'presets.v1')]),('availability','veyra_effect_availability_tests',[]),
+ ('ui-contract','veyra_ui_contract_tests',[str(BASE/'tests'/TASK/label/'ui-contract')]),('vfg-settings','veyra_vfg_settings_tests',[str(BASE/'tests'/TASK/label/'vfg-settings')]),
+ ('auto-controller','veyra_nr_auto_controller_tests',[]),('i18n','veyra_ui_i18n_tests',[]),
+ ('qml-data','veyra_qml_data_tests',[str(BASE/'tests'/TASK/label/'qml-data')]),('qml-easing','veyra_qml_easing_tests',[]),
+ ('qml-quick','veyra_qml_quick_tests',[]),('audio-rates','veyra_audio_playback_rate_tests',[str(fixtures/'tone.wav')]),
+ ('subtitle-text','veyra_subtitle_text_tests',[str(fixtures)]),('subtitle-overlay','veyra_subtitle_overlay_tests',[])]
+if selected:
+ assert all(name in {c[0] for c in cases} for name in selected)
+ cases=[c for c in cases if c[0] in selected]
+for _,target,_ in cases:shutil.copy2(BASE/'build'/TASK/variant/(target+'.exe'),app/(target+'.exe'))
+payload={p.relative_to(app).as_posix():matrix.digest(p) for p in app.rglob('*') if p.is_file() and p.suffix.lower() in ('.exe','.dll','.qml')}
+(folder/'artifacts.json').write_text(json.dumps(payload,ensure_ascii=False,indent=2),encoding='utf-8');results=[]
+for suffix,target,args in cases:
+ matrix.assert_gpu_tests_idle();name=label+'-'+suffix;tmp=BASE/'tmp'/TASK/name;tmp.mkdir(parents=True,exist_ok=False)
+ scratch=BASE/'tests'/TASK/label;scratch.mkdir(parents=True,exist_ok=True)
+ (scratch/'qml-export').mkdir(exist_ok=True)
+ env={k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_','QT_QUICK_BACKEND','QSG_RHI_BACKEND'))}
+ env.update(TEMP=str(tmp),TMP=str(tmp),VEYRA_LOG_FILE=str(folder/(suffix+'-engine.log')),VEYRA_DATA_DIR=str(scratch/suffix),
+ VEYRA_EXPORT_TEST_ARTIFACTS=str(scratch/'qml-export'),QML_DISABLE_DISK_CACHE='1',QT_FORCE_STDERR_LOGGING='1')
+ if suffix=='qml-quick':env['QT_QUICK_BACKEND']='software'
+ command=[str(app/(target+'.exe')),*args];print('START',name,flush=True);start=time.monotonic()
+ with (folder/(suffix+'.log')).open('xb') as stream:
+ try:rc=subprocess.run(command,cwd=tmp,env=env,stdout=stream,stderr=subprocess.STDOUT,timeout=250).returncode
+ except subprocess.TimeoutExpired:rc=124
+ row={'name':name,'command':command,'exitCode':rc,'passed':rc==0,'wallSeconds':time.monotonic()-start,'exeSha256':matrix.digest(app/(target+'.exe')),'extraGpuLoad':False}
+ results.append(row);(folder/'completed.json').write_text(json.dumps(results,ensure_ascii=False,indent=2),encoding='utf-8');print('RESULT',name,rc,flush=True)
+ if rc:print((folder/(suffix+'.log')).read_text(encoding='utf-8',errors='replace')[-9000:],flush=True)
+assert all(matrix.digest(app/name)==sha for name,sha in payload.items());matrix.assert_gpu_tests_idle()
+(folder/'summary.json').write_text(json.dumps({'runs':results,'payloadUnchanged':True,'passed':all(r['passed'] for r in results),'extraGpuLoad':False},ensure_ascii=False,indent=2),encoding='utf-8')
+print('R0_CONTRACTS_COMPLETE',all(r['passed'] for r in results),len(results),flush=True);raise SystemExit(0 if all(r['passed'] for r in results) else 1)
diff --git a/scripts/perf/nr-r0-normal.py b/scripts/perf/nr-r0-normal.py
new file mode 100644
index 00000000..c7778283
--- /dev/null
+++ b/scripts/perf/nr-r0-normal.py
@@ -0,0 +1,110 @@
+"""Matched ordinary playback A/final B/B-direct; no competitor or stress fixture."""
+from pathlib import Path
+import contextlib, csv, importlib.util, json, re, statistics, sys
+
+ROOT = Path(__file__).resolve().parents[2]
+BASE = Path('E:/项目/Veyra')
+TASK = 'perf-nr-20261004'
+spec = importlib.util.spec_from_file_location('matrix', ROOT/'scripts/perf/nr-matrix.py')
+matrix = importlib.util.module_from_spec(spec)
+spec.loader.exec_module(matrix)
+variant, label = sys.argv[1:3]
+assert label.replace('-', '').isalnum()
+matrix.assert_gpu_tests_idle()
+folder = BASE/'logs'/TASK/(label+'-summary')
+folder.mkdir(exist_ok=False)
+artifacts = {}
+for name in ('A', variant):
+ app = matrix.stage(name, label)
+ payload = {p.relative_to(app).as_posix(): matrix.digest(p) for p in app.rglob('*')
+ if p.is_file() and p.suffix.lower() in ('.exe', '.dll', '.qml')}
+ artifacts[name] = {'stage': str(app), 'payloadSha256': payload}
+assert artifacts['A']['payloadSha256']['veyra_qml_ui.exe'] == 'b7081f0e6045bc791105bc80de364247e169e3522891ef50cf9f62bbbfc10eb4'
+for artifact in artifacts.values():
+ assert artifact['payloadSha256']['runtime/experimental/nvngx_dlssnr.dll'] == 'f95feb54137ea11979f9b4ec4f00afd84b5c98a5624d3388fbf6a87714a39fcc'
+identity = {'artifacts': artifacts, 'sourceSha256': matrix.digest(matrix.SOURCES['M1']),
+ 'baselineProductCommit': '8cdc612120cbf23ba116a33c3cb0a53e2043f718',
+ 'finalProductCommit': 'e8f0bd1082293c88a3ca1db851667162e4cef7a9',
+ 'competition': False, 'gpuProcessPriority': 'normal', 'secondsPerRun': 50,
+ 'measurement': 'Merged GPU interval and last NR rolling observations; actual successful software Present, no scanout.'}
+(folder/'artifacts.json').write_text(json.dumps(identity, ensure_ascii=False, indent=2), encoding='utf-8')
+keys = ('gpuNrP95Ms', 'gpuSrP95Ms', 'gpuFlowP95Ms', 'gpuResidualP95Ms',
+ 'gpuFgBatchP95Ms', 'enhancementProcessingMs', 'gpuReadyP95Ms')
+results = []
+for setting in ('S1', 'S2-720', 'S3', 'S4', 'S5-existing'):
+ orders = (('A', 'B'), ('B', 'A'), ('A', 'B'))
+ if setting == 'S4':
+ orders = (('A', 'B', 'B-direct'), ('B-direct', 'B', 'A'), ('B', 'A', 'B-direct'))
+ for repeat, order in enumerate(orders, 1):
+ for mode in order:
+ actual_variant = 'A' if mode == 'A' else variant
+ name = f'{label}-{setting}-{mode}-r{repeat}'
+ env = {'VEYRA_TEST_GRAPH_DIRECT': '1'} if mode == 'B-direct' else {}
+ print('R0_NORMAL_START', name, flush=True)
+ with (folder/(name+'-driver.log')).open('x', encoding='utf-8') as stream:
+ with contextlib.redirect_stdout(stream):
+ matrix.run(actual_variant, 'M1', setting, name, 50, gpuPriority=2,
+ testEnv=env, stageLabel=label)
+ run_folder = BASE/'logs'/TASK/name
+ receipt = json.loads((run_folder/'result.json').read_text(encoding='utf-8'))
+ assert receipt['passed'] and receipt['gpuPriority']['applied']
+ assert receipt['exeSha256'] == artifacts[actual_variant]['payloadSha256']['veyra_qml_ui.exe']
+ log = (run_folder/'player.log').read_text(encoding='utf-8', errors='replace')
+ compute = 'requested=COMPUTE createHr=0x0' in log
+ assert compute == (mode == 'B' and setting == 'S4'), (name, 'wrong producer queue')
+ ui, submitted = [], []
+ for line in log.splitlines():
+ if '[submit]' in line:
+ row = {k: int(v) for k, v in re.findall(r'(\w+)=(-?\d+)', line)}
+ if 100000000 <= row.get('pts100ns', -1) <= 480000000:
+ submitted.append(row)
+ if 'NR_PERF_SAMPLE ' in line:
+ row = json.loads(line.split('NR_PERF_SAMPLE ', 1)[1])
+ if row['ready'] and 10 <= row['position'] <= 48:
+ ui.append(row)
+ intervals = sorted((b['host100ns']-a['host100ns'])/10000 for a, b in zip(submitted, submitted[1:]))
+ assert len(intervals) > 100 and len(ui) >= 10
+ pct = lambda fraction: intervals[min(len(intervals)-1, int(len(intervals)*fraction))]
+ meters = json.loads((run_folder/'meters.json').read_text(encoding='utf-8'))
+ skips = [int(v) for v in re.findall(r'previewSkipped=(\d+)', log)]
+ expired = [int(v) for v in re.findall(r'expiredGenerated=(\d+)', log)]
+ row = {'name': name, 'mode': mode, 'setting': setting, 'repeat': repeat,
+ 'receipt': str(run_folder/'result.json'), 'actualCompute': compute,
+ 'metrics': {k: receipt['summary'][k]['medianOfRollingObservations'] for k in keys},
+ 'presentIntervalsMs': {'p50': pct(.5), 'p95': pct(.95), 'p99': pct(.99), 'max': max(intervals), 'count': len(intervals)},
+ 'maxLoggedPreviewSkipped': max(skips, default=0), 'maxLoggedExpiredGenerated': max(expired, default=0),
+ 'uiActiveValues': sorted(set(s['active'] for s in ui)),
+ 'maxUiTimerIntervalMs': max(s['uiTimerMaxMs'] for s in ui),
+ 'maxTotalGpuMemoryMiB': max(float(s['gpu'].get('memoryMiB', 0)) for s in meters),
+ 'medianProcessCpuOneCoreScale': statistics.median(s['cpuPercentOneCoreScale'] for s in meters if 10 <= s['elapsed'] <= 48),
+ 'stallLines': [line for line in log.splitlines() if '[engine-stall]' in line]}
+ results.append(row)
+ (folder/'completed.json').write_text(json.dumps(results, ensure_ascii=False, indent=2), encoding='utf-8')
+ print('R0_NORMAL_RESULT', name, json.dumps({k: row[k] for k in ('metrics', 'presentIntervalsMs', 'maxLoggedPreviewSkipped', 'maxLoggedExpiredGenerated')}), flush=True)
+
+summary = {}
+for setting in ('S1', 'S2-720', 'S3', 'S4', 'S5-existing'):
+ summary[setting] = {}
+ for mode in ('A', 'B', 'B-direct'):
+ rows = [r for r in results if r['setting'] == setting and r['mode'] == mode]
+ if not rows:
+ continue
+ values = {k: [r['metrics'][k] for r in rows] for k in keys}
+ values.update({f'present{p}Ms': [r['presentIntervalsMs'][p] for r in rows] for p in ('p95', 'p99', 'max')})
+ values.update({k: [r[k] for r in rows] for k in ('maxLoggedPreviewSkipped', 'maxLoggedExpiredGenerated', 'maxUiTimerIntervalMs', 'maxTotalGpuMemoryMiB', 'medianProcessCpuOneCoreScale')})
+ summary[setting][mode] = {k: {'median': statistics.median(v), 'min': min(v), 'max': max(v), 'runs': v} for k, v in values.items()}
+for artifact in artifacts.values():
+ app = Path(artifact['stage'])
+ assert all(matrix.digest(app/name) == sha for name, sha in artifact['payloadSha256'].items())
+matrix.assert_gpu_tests_idle()
+final = {'runs': results, 'summary': summary, 'payloadUnchanged': True, 'competition': False}
+(folder/'comparison.json').write_text(json.dumps(final, ensure_ascii=False, indent=2), encoding='utf-8')
+with (folder/'per-run.csv').open('x', encoding='utf-8-sig', newline='') as stream:
+ fields = ['name', 'setting', 'mode', 'repeat', *keys, 'presentP99Ms', 'presentMaxMs', 'skipped', 'expired', 'receipt']
+ writer = csv.DictWriter(stream, fieldnames=fields)
+ writer.writeheader()
+ for r in results:
+ writer.writerow({'name': r['name'], 'setting': r['setting'], 'mode': r['mode'], 'repeat': r['repeat'], **r['metrics'],
+ 'presentP99Ms': r['presentIntervalsMs']['p99'], 'presentMaxMs': r['presentIntervalsMs']['max'],
+ 'skipped': r['maxLoggedPreviewSkipped'], 'expired': r['maxLoggedExpiredGenerated'], 'receipt': r['receipt']})
+print('R0_NORMAL_COMPLETE', len(results), flush=True)
diff --git a/scripts/perf/nr-r0-obs.py b/scripts/perf/nr-r0-obs.py
new file mode 100644
index 00000000..4af45ff5
--- /dev/null
+++ b/scripts/perf/nr-r0-obs.py
@@ -0,0 +1,248 @@
+"""Actual OBS game-capture regression in a fresh portable instance.
+
+Only the unique, owned Veyra title is selected. No display/mic/system audio,
+network stream, user OBS configuration, or parallel timing test is involved.
+API definitions: obsproject/obs-websocket docs/generated/protocol.md (RPC 1).
+Portable/first-run keys: obsproject/obs-studio 32.1.2 frontend/OBSApp.cpp and
+frontend/widgets/OBSBasic.cpp. This script uses the official API, not UI input.
+"""
+from pathlib import Path
+import base64, ctypes, hashlib, importlib.util, json, os, secrets, shutil, socket, statistics, struct, subprocess, sys, time
+import psutil
+from PIL import Image, ImageChops, ImageStat
+
+ROOT = Path(__file__).resolve().parents[2]
+BASE = Path('E:/项目/Veyra')
+TASK = 'perf-nr-20261004'
+spec = importlib.util.spec_from_file_location('matrix', ROOT/'scripts/perf/nr-matrix.py')
+matrix = importlib.util.module_from_spec(spec)
+spec.loader.exec_module(matrix)
+
+class ObsRpc:
+ def __init__(self, port, password):
+ self.socket = socket.create_connection(('127.0.0.1', port), timeout=10)
+ self.buffer = b''
+ key = base64.b64encode(secrets.token_bytes(16)).decode()
+ self.socket.sendall((f'GET / HTTP/1.1\r\nHost: 127.0.0.1:{port}\r\nUpgrade: websocket\r\n'
+ f'Connection: Upgrade\r\nSec-WebSocket-Key: {key}\r\nSec-WebSocket-Version: 13\r\n\r\n').encode())
+ while b'\r\n\r\n' not in self.buffer:
+ self.buffer += self.socket.recv(4096)
+ headers, self.buffer = self.buffer.split(b'\r\n\r\n', 1)
+ assert b' 101 ' in headers.split(b'\r\n')[0]
+ expected = base64.b64encode(hashlib.sha1((key+'258EAFA5-E914-47DA-95CA-C5AB0DC85B11').encode()).digest())
+ assert expected.lower() in headers.lower()
+ hello = self.receive()
+ assert hello['op'] == 0
+ auth = hello['d']['authentication']
+ secret = base64.b64encode(hashlib.sha256((password+auth['salt']).encode()).digest()).decode()
+ response = base64.b64encode(hashlib.sha256((secret+auth['challenge']).encode()).digest()).decode()
+ self.send({'op':1, 'd':{'rpcVersion':1, 'authentication':response, 'eventSubscriptions':0}})
+ assert self.receive()['op'] == 2
+ self.counter = 0
+
+ def take(self, count):
+ while len(self.buffer) < count:
+ data = self.socket.recv(max(4096, count-len(self.buffer)))
+ if not data:
+ raise EOFError('OBS websocket closed')
+ self.buffer += data
+ result, self.buffer = self.buffer[:count], self.buffer[count:]
+ return result
+
+ def frame(self, data, opcode=1):
+ mask = secrets.token_bytes(4)
+ length = len(data)
+ header = bytes([0x80|opcode, 0x80|length]) if length < 126 else (bytes([0x80|opcode, 0x80|126])+struct.pack('!H', length) if length < 65536 else bytes([0x80|opcode, 0x80|127])+struct.pack('!Q', length))
+ self.socket.sendall(header+mask+bytes(v ^ mask[i%4] for i,v in enumerate(data)))
+
+ def send(self, data):
+ self.frame(json.dumps(data).encode())
+
+ def receive(self):
+ chunks = []
+ while True:
+ a,b = self.take(2)
+ length = b & 127
+ if length == 126: length = struct.unpack('!H', self.take(2))[0]
+ if length == 127: length = struct.unpack('!Q', self.take(8))[0]
+ assert length < 2000000
+ mask = self.take(4) if b & 128 else None
+ data = self.take(length)
+ if mask: data = bytes(v ^ mask[i%4] for i,v in enumerate(data))
+ if a & 15 == 8: raise EOFError('OBS websocket close frame')
+ if a & 15 == 9: self.frame(data, 10); continue
+ if a & 15 == 10: continue
+ assert a & 15 in (0,1)
+ chunks.append(data)
+ if a & 128: return json.loads(b''.join(chunks))
+
+ def call(self, kind, data=None):
+ self.counter += 1
+ request_id = str(self.counter)
+ self.send({'op':6, 'd':{'requestId':request_id, 'requestType':kind, 'requestData':data or {}}})
+ while True:
+ response = self.receive()
+ if response['op'] == 7 and response['d']['requestId'] == request_id:
+ result = response['d']
+ assert result['requestStatus']['result'], (kind, result['requestStatus'])
+ return result.get('responseData', {})
+
+def close_owned(process, expected):
+ if process is None or process.poll() is not None: return
+ assert Path(psutil.Process(process.pid).exe()).resolve() == expected.resolve()
+ from ctypes import wintypes
+ user = ctypes.WinDLL('user32', use_last_error=True)
+ callback_type = ctypes.WINFUNCTYPE(wintypes.BOOL, wintypes.HWND, wintypes.LPARAM)
+ user.GetWindowThreadProcessId.argtypes = [wintypes.HWND, ctypes.POINTER(wintypes.DWORD)]
+ user.PostMessageW.argtypes = [wintypes.HWND, wintypes.UINT, wintypes.WPARAM, wintypes.LPARAM]
+ def close(hwnd, unused):
+ pid = wintypes.DWORD()
+ user.GetWindowThreadProcessId(hwnd, ctypes.byref(pid))
+ if pid.value == process.pid: user.PostMessageW(hwnd, 0x10, 0, 0)
+ return True
+ callback = callback_type(close)
+ user.EnumWindows(callback, 0)
+ try: process.wait(timeout=10)
+ except subprocess.TimeoutExpired: process.terminate(); process.wait(timeout=8)
+
+def config_manifest():
+ folder = Path(os.environ['APPDATA'])/'obs-studio'
+ return {p.relative_to(folder).as_posix():matrix.digest(p) for p in folder.rglob('*')
+ if p.is_file() and p.suffix.lower() in ('.ini','.json')}
+
+def run():
+ variant, label = sys.argv[1:3]
+ assert label.replace('-', '').isalnum()
+ matrix.assert_gpu_tests_idle()
+ assert not any((p.info['name'] or '').lower() == 'obs64.exe' for p in psutil.process_iter(['name'])), 'Existing OBS process; do not disturb it'
+ logs, tmp, test = (BASE/name/TASK/label for name in ('logs','tmp','tests'))
+ for folder in (logs,tmp,test): folder.mkdir(exist_ok=False)
+ installed = Path('E:/App/obs-studio')
+ portable = test/'obs-portable'
+ portable.mkdir()
+ # Hardlink only read-only installation payload. All configuration is fresh.
+ for folder in ('bin','data','obs-plugins'):
+ shutil.copytree(installed/folder, portable/folder, copy_function=os.link)
+ (portable/'portable_mode.txt').write_text('', encoding='utf-8')
+ config = portable/'config/obs-studio'
+ config.mkdir(parents=True)
+ (config/'global.ini').write_text('[General]\nEnableAutoUpdates=false\nInfoIncrement=999999\n[Video]\nRenderer=Direct3D 11\n', encoding='utf-8')
+ (config/'user.ini').write_text('[General]\nFirstRun=true\n[Basic]\nProfile=VeyraR0\nProfileDir=VeyraR0\n[BasicWindow]\nPreviewEnabled=false\nSysTrayEnabled=true\n', encoding='utf-8')
+ profile = config/'basic/profiles/VeyraR0'
+ profile.mkdir(parents=True)
+ (profile/'basic.ini').write_text('[General]\nName=VeyraR0\n[Video]\nBaseCX=1280\nBaseCY=800\nOutputCX=1280\nOutputCY=800\nFPSType=0\nFPSCommon=30\n[Audio]\nSampleRate=48000\nChannelSetup=Stereo\n[Output]\nMode=Simple\n[SimpleOutput]\nStreamEncoder=x264\nPreset=ultrafast\nVBitrate=2500\nRecQuality=Stream\nRecFormat2=mkv\nFilePath='+str(test/'recordings').replace('\\','/')+'\n', encoding='utf-8')
+ ws_config = config/'plugin_config/obs-websocket/config.json'
+ ws_config.parent.mkdir(parents=True)
+ with socket.socket() as reservation:
+ reservation.bind(('127.0.0.1',0)); port = reservation.getsockname()[1]
+ password = secrets.token_urlsafe(32)
+ settings = {'first_load':False,'server_enabled':True,'server_port':port,'alerts_enabled':False,'auth_required':True,'server_password':password}
+ ws_config.write_text(json.dumps(settings), encoding='utf-8')
+ app = test/'veyra-app'
+ shutil.copytree(BASE/'test-packages'/TASK/'Veyra-2.0.3-perf-baseline-A-NVIDIA-win64-portable', app, copy_function=matrix.copy_dependency)
+ shutil.copy2(BASE/'build'/TASK/variant/'veyra_qml_ui.exe', app/'veyra_qml_ui.exe')
+ shutil.copytree(ROOT/'qml', app/'qml', dirs_exist_ok=True)
+ shutil.copy2(ROOT/'scripts/perf/nr-r0-obs.qml', app/'qml/Veyra/ObsProbe.qml')
+ actions = test/'actions.json'
+ main = app/'qml/Veyra/Main.qml'
+ source = main.read_text(encoding='utf-8'); pos = source.rfind('}')
+ main.write_text(source[:pos]+'\n Loader { source: "ObsProbe.qml"; onLoaded: item.commandFile="'+actions.as_uri()+'" }\n'+source[pos:], encoding='utf-8')
+ payload = {p.relative_to(app).as_posix():matrix.digest(p) for p in app.rglob('*') if p.is_file() and p.suffix.lower() in ('.exe','.dll','.qml')}
+ user_config_before = config_manifest()
+ identity = {'playerPayload':payload,'obsExeSha256':matrix.digest(portable/'bin/64bit/obs64.exe'),
+ 'installedObsExeSha256':matrix.digest(installed/'bin/64bit/obs64.exe'),'userConfigBefore':user_config_before,
+ 'sourceSha256':matrix.digest(matrix.SOURCES['M1']),'gpuCompetition':False,'recordingPurpose':'Game capture compatibility, not timing or pressure'}
+ (logs/'artifacts.json').write_text(json.dumps(identity,ensure_ascii=False,indent=2),encoding='utf-8')
+ env = {k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_','QT_','QSG_','OBS_'))}
+ env.update(TEMP=str(tmp),TMP=str(tmp))
+ obs, player, rpc = None,None,None
+ rows = []
+ try:
+ with (logs/'obs-console.log').open('xb') as console:
+ obs = subprocess.Popen([str(portable/'bin/64bit/obs64.exe'),'--portable','--disable-updater','--only-bundled-plugins','--disable-missing-files-check','--minimize-to-tray'], cwd=portable/'bin/64bit', env=env, stdout=console, stderr=subprocess.STDOUT)
+ deadline = time.monotonic()+35
+ while True:
+ assert obs.poll() is None, 'Owned OBS exited before API became available'
+ try: rpc = ObsRpc(port,password); break
+ except (OSError, EOFError):
+ if time.monotonic() > deadline: raise
+ time.sleep(.25)
+ assert any(c.laddr.port == port and c.status == psutil.CONN_LISTEN for c in psutil.Process(obs.pid).net_connections(kind='inet'))
+ identity['actualObsVersion'] = rpc.call('GetVersion')['obsVersion']
+ assert identity['actualObsVersion'] == '32.1.2'
+ # Remove fresh defaults before recording. Never capture personal audio.
+ for entry in rpc.call('GetInputList')['inputs']:
+ rpc.call('RemoveInput', {'inputName':entry['inputName']})
+ rpc.call('SetVideoSettings',{'baseWidth':1280,'baseHeight':800,'outputWidth':1280,'outputHeight':800,'fpsNumerator':30,'fpsDenominator':1})
+ (test/'recordings').mkdir()
+ rpc.call('SetRecordDirectory', {'recordDirectory':str(test/'recordings')})
+ rpc.call('CreateScene',{'sceneName':'VeyraR0'})
+ rpc.call('SetCurrentProgramScene',{'sceneName':'VeyraR0'})
+ for mode in ('gpu','compat'):
+ title = f'Veyra R0 OBS {label} {mode}'
+ command = {'sequence':0,'action':'start','title':title,'media':str(matrix.SOURCES['M1']).replace('\\','/')}
+ def action(value):
+ command.update(sequence=command['sequence']+1,action=value)
+ pending = actions.with_suffix('.new'); pending.write_text(json.dumps(command),encoding='utf-8'); pending.replace(actions)
+ action('start')
+ data = test/(mode+'-profile'); data.mkdir()
+ (data/'qml-preferences.v1.json').write_text(json.dumps({'overlayCompat':'off','prewarmEnhancement':False,'gpuPriority':'normal'}),encoding='utf-8')
+ player_env = {**env,'VEYRA_LOG_FILE':str(logs/(mode+'-player.log')),'QML_DISABLE_DISK_CACHE':'1','QML_XHR_ALLOW_FILE_READ':'1','QT_FORCE_STDERR_LOGGING':'1'}
+ args = [str(app/'veyra_qml_ui.exe'),'--data-dir',str(data),'--page','pro','--size','1280x800','--exit-after','170000']
+ if mode == 'compat': args.append('--obs-game-capture')
+ with (logs/(mode+'-console.log')).open('xb') as console:
+ player = subprocess.Popen(args,cwd=app,env=player_env,stdout=console,stderr=subprocess.STDOUT)
+ time.sleep(7)
+ assert player.poll() is None
+ input_name = 'VeyraOwned-'+mode
+ rpc.call('CreateInput',{'sceneName':'VeyraR0','inputName':input_name,'inputKind':'game_capture','inputSettings':{'capture_mode':'window','capture_cursor':False,'capture_overlays':True,'allow_transparency':False},'sceneItemEnabled':True})
+ items = rpc.call('GetInputPropertiesListPropertyItems',{'inputName':input_name,'propertyName':'window'})['propertyItems']
+ matches = [item for item in items if title in str(item['itemValue'])]
+ assert len(matches) == 1, ('Unique owned capture window not found', mode, matches)
+ rpc.call('SetInputSettings',{'inputName':input_name,'inputSettings':{'window':matches[0]['itemValue'],'priority':0},'overlay':True})
+ rpc.call('StartRecord')
+ shots = []
+ for stage in ('playing','pause','resume','resize','fullscreen','windowed'):
+ if stage != 'playing': action(stage)
+ time.sleep(4)
+ shot = test/(mode+'-'+stage+'.png')
+ rpc.call('SaveSourceScreenshot',{'sourceName':input_name,'imageFormat':'png','imageFilePath':str(shot),'imageWidth':1280,'imageHeight':800})
+ image = Image.open(shot).convert('RGB')
+ crop = image.crop((200,160,1080,600))
+ variation = ImageStat.Stat(crop).stddev
+ assert max(variation) > 12, ('Capture lacks real picture',mode,stage,variation)
+ shots.append({'stage':stage,'image':str(shot),'sha256':matrix.digest(shot),'centerStddev':variation})
+ stopped = rpc.call('StopRecord')
+ clip = Path(stopped['outputPath'])
+ assert clip.resolve().is_relative_to((test/'recordings').resolve()) and clip.stat().st_size > 10000
+ stats = rpc.call('GetStats')
+ rpc.call('RemoveInput',{'inputName':input_name})
+ action('quit'); player.wait(timeout=12)
+ text = (logs/(mode+'-player.log')).read_text(encoding='utf-8',errors='replace')
+ assert player.returncode == 0 and 'OBS_UI_PASS' in text
+ assert not any(value in text for value in ('OBS_UI_FAIL','[ERROR]','[FATAL]','ReferenceError:','TypeError:'))
+ row = {'mode':mode,'command':args,'recording':str(clip),'recordingSha256':matrix.digest(clip),'shots':shots,'obsStats':stats,'passed':True}
+ rows.append(row); (logs/'completed.json').write_text(json.dumps(rows,ensure_ascii=False,indent=2),encoding='utf-8')
+ print('R0_OBS_CAPTURE_PASS',mode,len(shots),flush=True)
+ player = None
+ assert all(matrix.digest(app/name)==sha for name,sha in payload.items())
+ (logs/'summary.json').write_text(json.dumps({'identity':identity,'runs':rows,'passed':True,'pressure':False},ensure_ascii=False,indent=2),encoding='utf-8')
+ finally:
+ if rpc:
+ try:
+ if rpc.call('GetRecordStatus')['outputActive']: rpc.call('StopRecord')
+ except (OSError,EOFError,AssertionError): pass
+ rpc.socket.close()
+ close_owned(player,app/'veyra_qml_ui.exe')
+ close_owned(obs,portable/'bin/64bit/obs64.exe')
+ settings.update(server_enabled=False,server_password='')
+ ws_config.write_text(json.dumps(settings),encoding='utf-8')
+ user_config_after = config_manifest()
+ unchanged = user_config_before == user_config_after
+ (logs/'cleanup.json').write_text(json.dumps({'userConfigUnchanged':unchanged,'ownedObsStopped':obs is None or obs.poll() is not None,
+ 'ownedPlayerStopped':player is None or player.poll() is not None,'ephemeralServerDisabled':True},indent=2),encoding='utf-8')
+ assert unchanged, 'User OBS config changed unexpectedly'
+ matrix.assert_gpu_tests_idle()
+ print('R0_OBS_COMPLETE',len(rows),flush=True)
+
+if __name__ == '__main__': run()
diff --git a/scripts/perf/nr-r0-obs.qml b/scripts/perf/nr-r0-obs.qml
new file mode 100644
index 00000000..5fc3ee36
--- /dev/null
+++ b/scripts/perf/nr-r0-obs.qml
@@ -0,0 +1,45 @@
+import QtQuick
+Item {
+ id: probe
+ property var appWindow: Window.window
+ property string commandFile: ""
+ property int sequence: -1
+ property bool configured: false
+ function require(ok, why) { if (!ok) { console.log("OBS_UI_FAIL", why); Qt.exit(3) } }
+ Timer {
+ interval: 500; running: true; repeat: true
+ onTriggered: {
+ if (!probe.commandFile) return
+ const request = new XMLHttpRequest()
+ request.open("GET", probe.commandFile, false); request.send()
+ const c = JSON.parse(request.responseText)
+ if (!probe.configured) {
+ probe.appWindow.title = c.title
+ veyra.muted = true; veyra.lowLatency = false
+ veyra.srEnabled = false; veyra.fgEnabled = false
+ veyra.colorEnabled = false; veyra.videoHdr = false
+ veyra.nrEnabled = true
+ const index = veyra.nrLayers[0].index
+ probe.require(veyra.setNrLayerParameter(index, "runtime", 0), "runtime")
+ probe.require(veyra.setNrLayerParameter(index, "sizePolicy", 1), "native NR")
+ probe.require(veyra.setNrLayerParameter(index, "temporal", 0), "temporal")
+ veyra.openPath(c.media)
+ probe.configured = true
+ }
+ probe.require(!veyra.failed, "engine failed")
+ if (probe.sequence !== c.sequence) {
+ probe.sequence = c.sequence
+ if (c.action === "pause" && !veyra.paused) veyra.togglePlayPause()
+ if (c.action === "resume" && veyra.paused) veyra.togglePlayPause()
+ if (c.action === "resize") { probe.appWindow.width = 1000; probe.appWindow.height = 700 }
+ if (c.action === "fullscreen" && !probe.appWindow.fullscreen) probe.appWindow.toggleFullscreen()
+ if (c.action === "windowed" && probe.appWindow.fullscreen) probe.appWindow.toggleFullscreen()
+ if (c.action === "quit") { console.log("OBS_UI_PASS"); Qt.quit() }
+ console.log("OBS_UI_ACTION", c.action, probe.sequence)
+ }
+ console.log("OBS_UI_SAMPLE", JSON.stringify({position:veyra.position, paused:veyra.paused,
+ nr:veyra.nrActive, failed:veyra.failed, fullscreen:probe.appWindow.fullscreen,
+ width:probe.appWindow.width, height:probe.appWindow.height}))
+ }
+ }
+}
diff --git a/scripts/perf/nr-r0-rtss.py b/scripts/perf/nr-r0-rtss.py
new file mode 100644
index 00000000..fadc0de6
--- /dev/null
+++ b/scripts/perf/nr-r0-rtss.py
@@ -0,0 +1,31 @@
+"""Reuse installed RTSS API/OSD harness for three ordinary cases, two profiles.
+No GPU competitor, VRAM pressure, high multiplier sweep or user profile left changed.
+"""
+from pathlib import Path
+import importlib.util,json,shutil,sys
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='perf-nr-20261004'
+spec=importlib.util.spec_from_file_location('matrix',ROOT/'scripts/perf/nr-matrix.py');matrix=importlib.util.module_from_spec(spec);spec.loader.exec_module(matrix)
+variant,label=sys.argv[1:3];matrix.assert_gpu_tests_idle();app=BASE/'tests'/TASK/(label+'-app')
+shutil.copytree(matrix.PACKAGE,app,copy_function=matrix.copy_dependency)
+shutil.copy2(BASE/'build'/TASK/variant/'veyra_qml_ui.exe',app/'veyra_qml_ui.exe');shutil.copytree(ROOT/'qml',app/'qml',dirs_exist_ok=True)
+fixture=(ROOT/'scripts/acceptance/rtss-restart-stress.qml').read_text(encoding='utf-8').replace('RTSS_STRESS_','RTSS_NORMAL_')
+(app/'qml/Veyra/RtssNormalProbe.qml').write_text(fixture,encoding='utf-8')
+library=ROOT/'scripts/acceptance/rtss-restart-real.py';code=library.read_text(encoding='utf-8')
+patches={
+ "TASK='rtss-restart-loop-20261004'":"TASK='perf-nr-20261004'",
+ "APP=BASE/'test-packages'/TASK/'Veyra-2.0.3-rtssfix-NVIDIA-win64-portable'":'APP=Path('+repr(str(app))+')',
+ 'expected_cases=1 if transport_only else 11':'expected_cases=3',
+ "media=BASE/'tests'/TASK/'rtss-stress-2k30.mp4'":"media=BASE/'tests/rtss-restart-loop-20261004/rtss-stress-2k30.mp4'",
+ "shutil.copy2(BASE/'build'/TASK/'veyra_qml_ui.exe',APP/'veyra_qml_ui.exe')":"shutil.copy2(BASE/'build'/TASK/"+repr(variant)+"/'veyra_qml_ui.exe',APP/'veyra_qml_ui.exe')",
+ "(ROOT/'scripts/acceptance/rtss-restart-stress.qml').as_uri()":"(APP/'qml/Veyra/RtssNormalProbe.qml').as_uri()",
+ "if transport_only:profiles=profiles[:1]":"profiles=profiles[:2]",
+ "if transport_only:loader=loader.replace('item.media=','item.cases=[item.cases[10]];item.media=',1)":"loader=loader.replace('item.media=','item.cases=[item.cases[0],item.cases[1],item.cases[10]];item.media=',1)"
+}
+for old,new in patches.items():assert code.count(old)==1,old;code=code.replace(old,new)
+code=code.replace('RTSS_STRESS_','RTSS_NORMAL_')
+assert (BASE/'tests/rtss-restart-loop-20261004/rtss-stress-2k30.mp4').is_file(),'Reuse existing ordinary media; do not generate load'
+identity={'library':str(library),'librarySha256':matrix.digest(library),'exeSha256':matrix.digest(app/'veyra_qml_ui.exe'),'rtssProfileCases':2,'ordinaryCases':['plain','nr-parameters','nr-resize-pause-seek'],'extraGpuLoad':False}
+sys.argv=[str(library),label]
+exec(compile(code,str(library),'exec'),{'__file__':str(library),'__name__':'__main__'})
+folder=BASE/'logs'/TASK/label
+(folder/'harness-identity.json').write_text(json.dumps(identity,ensure_ascii=False,indent=2),encoding='utf-8');matrix.assert_gpu_tests_idle();print('R0_RTSS_ORDINARY_COMPLETE',folder,flush=True)
diff --git a/scripts/perf/nr-r0-smoke.py b/scripts/perf/nr-r0-smoke.py
new file mode 100644
index 00000000..852ad383
--- /dev/null
+++ b/scripts/perf/nr-r0-smoke.py
@@ -0,0 +1,64 @@
+"""Strict existing eight-page smoke with a fresh, explicitly scoped QML stage."""
+from pathlib import Path
+import importlib.util, json, os, shutil, subprocess, sys
+
+ROOT = Path(__file__).resolve().parents[2]
+BASE = Path('E:/项目/Veyra')
+TASK = 'perf-nr-20261004'
+spec = importlib.util.spec_from_file_location('matrix', ROOT/'scripts/perf/nr-matrix.py')
+matrix = importlib.util.module_from_spec(spec)
+spec.loader.exec_module(matrix)
+variant, label = sys.argv[1:3]
+assert label.replace('-', '').isalnum()
+matrix.assert_gpu_tests_idle()
+app = BASE/'tests'/TASK/(label+'-app')
+assert not app.exists()
+shutil.copytree(BASE/'test-packages'/TASK/'Veyra-2.0.3-perf-baseline-A-NVIDIA-win64-portable', app,
+ copy_function=matrix.copy_dependency, ignore=shutil.ignore_patterns('*.exe', '*.log', '*.dmp'))
+build = BASE/'build'/TASK/variant
+for name in ('veyra_qml_ui', 'veyra_qml_data_tests', 'veyra_qml_easing_tests', 'veyra_qml_quick_tests'):
+ shutil.copy2(build/(name+'.exe'), app/(name+'.exe'))
+shutil.copytree(ROOT/'qml', app/'qml', dirs_exist_ok=True)
+shutil.copytree(ROOT/'tests/qml/quick', app/'qml-tests')
+qt = Path('C:/veyra-deps/qt-veyra/6.8.3/msvc2022_64')
+for dll in ('Qt6QuickTest.dll', 'Qt6Test.dll'):
+ shutil.copy2(qt/'bin'/dll, app/dll)
+shutil.copytree(qt/'qml/QtTest', app/'qml/QtTest', copy_function=matrix.copy_dependency)
+shutil.copy2(qt/'plugins/platforms/qoffscreen.dll', app/'platforms/qoffscreen.dll')
+fixtures = BASE/'tests'/TASK/(label+'-fixtures')
+fixtures.mkdir(exist_ok=False)
+os.link(matrix.SOURCES['M1'], fixtures/'test_av_1080p.mp4')
+logs, tmp = BASE/'logs'/TASK/label, BASE/'tmp'/TASK/label
+logs.mkdir(exist_ok=False)
+tmp.mkdir(exist_ok=False)
+payload = {p.relative_to(app).as_posix(): matrix.digest(p) for p in app.rglob('*')
+ if p.is_file() and p.suffix.lower() in ('.exe', '.dll', '.qml')}
+(logs/'artifacts.json').write_text(json.dumps(payload, ensure_ascii=False, indent=2), encoding='utf-8')
+env = {k: v for k, v in os.environ.items() if not k.upper().startswith(('VEYRA_', 'QT_QUICK_BACKEND', 'QSG_RHI_BACKEND'))}
+env.update(TEMP=str(tmp), TMP=str(tmp))
+command = ['powershell', '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File',
+ str(ROOT/'scripts/acceptance/qml-ui-smoke.ps1'), '-Root', str(ROOT), '-UiTarget', 'qml',
+ '-PlayerExe', str(app/'veyra_qml_ui.exe'), '-BuildDirectory', str(build),
+ '-StagingDirectory', str(app), '-OutputDirectory', str(logs), '-TempDirectory', str(tmp),
+ '-FixtureRoot', str(fixtures), '-ExitAfterMs', '3500']
+# The desktop's inherited PSModulePath belongs to its bundled PowerShell.
+# Explicitly import Windows PowerShell's own modules in this child only; do
+# not modify the read-only acceptance script or global environment.
+quote = lambda value: "'" + str(value).replace("'", "''") + "'"
+wrapper = tmp/'smoke-entry.ps1'
+wrapper.write_text(
+ "$ErrorActionPreference = 'Stop'\n"
+ "Import-Module ($PSHOME + '/Modules/Microsoft.PowerShell.Utility/Microsoft.PowerShell.Utility.psd1')\n"
+ "Import-Module ($PSHOME + '/Modules/Microsoft.PowerShell.Management/Microsoft.PowerShell.Management.psd1')\n"
+ + '$smokeArgs = @{\n' + '\n'.join(arg.lstrip('-')+' = '+quote(value) for arg, value in zip(command[6::2], command[7::2]))
+ + '\n}\n& ' + quote(command[5]) + ' @smokeArgs\nexit $LASTEXITCODE\n', encoding='utf-8-sig')
+command = command[:5] + [str(wrapper)]
+with (logs/'driver.log').open('xb') as stream:
+ rc = subprocess.run(command, cwd=ROOT, env=env, stdout=stream, stderr=subprocess.STDOUT, timeout=250).returncode
+assert all(matrix.digest(app/name) == sha for name, sha in payload.items())
+results = list(logs.glob('run-*/result.json'))
+assert len(results) == 1
+result = json.loads(results[0].read_text(encoding='utf-8-sig'))
+assert rc == 0 and result['passed'] and result['skipped'] == 0 and len(result['cases']) == 8, result
+matrix.assert_gpu_tests_idle()
+print('R0_QML_SMOKE_COMPLETE', rc, len(result['cases']), str(results[0]), flush=True)
diff --git a/scripts/perf/nr-r0-ui.py b/scripts/perf/nr-r0-ui.py
new file mode 100644
index 00000000..2b484920
--- /dev/null
+++ b/scripts/perf/nr-r0-ui.py
@@ -0,0 +1,40 @@
+"""Real Qt layout/fullscreen/subtitle/rate regression in both product render modes."""
+from pathlib import Path
+import importlib.util,json,os,shutil,subprocess,sys,time
+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='perf-nr-20261004'
+spec=importlib.util.spec_from_file_location('matrix',ROOT/'scripts/perf/nr-matrix.py');matrix=importlib.util.module_from_spec(spec);spec.loader.exec_module(matrix)
+variant,label=sys.argv[1:3];matrix.assert_gpu_tests_idle();app=BASE/'tests'/TASK/(label+'-app');shutil.copytree(matrix.PACKAGE,app,copy_function=matrix.copy_dependency)
+shutil.copy2(BASE/'build'/TASK/variant/'veyra_qml_ui.exe',app/'veyra_qml_ui.exe');shutil.copytree(ROOT/'qml',app/'qml',dirs_exist_ok=True)
+main=app/'qml/Veyra/Main.qml';original=main.read_text(encoding='utf-8');at=original.rfind('}');folder=BASE/'logs'/TASK/(label+'-summary');folder.mkdir(parents=True,exist_ok=False)
+results=[];exeHash=matrix.digest(app/'veyra_qml_ui.exe');source=BASE/'tests/playback-smoothness-20261004/fixtures/golden.mkv'
+for renderer in ('gpu','obs-compat'):
+ for mode in ('functional','layout'):
+ matrix.assert_gpu_tests_idle();name=f'{label}-{renderer}-{mode}';out=BASE/'logs'/TASK/name;profile=BASE/'tests'/TASK/name/'profile';tmp=BASE/'tmp'/TASK/name
+ for p in (out,profile,tmp):p.mkdir(parents=True,exist_ok=False)
+ (profile/'qml-preferences.v1.json').write_text(json.dumps({'overlayCompat':'off','gpuPriority':'normal','prewarmEnhancement':False}),encoding='utf-8')
+ fixture=(ROOT/'scripts/acceptance'/('playback-smoothness-'+mode+'.qml')).read_text(encoding='utf-8')
+ # The reusable fixture must stop after reporting a failure, even if Qt.quit
+ # is asynchronous. Its authored tests and assertions are otherwise unchanged.
+ probe=app/'qml/Veyra/R0UiProbe.qml';probe.write_text(fixture.replace('import Veyra\n',''),encoding='utf-8')
+ loader='\n Loader{source:"R0UiProbe.qml";onLoaded:{item.media='+json.dumps(str(source).replace('\\','/'))+';item.mode='+json.dumps(mode)+'}}\n'
+ main.write_text(original[:at]+loader+original[at:],encoding='utf-8')
+ payload={p.relative_to(app).as_posix():matrix.digest(p) for p in app.rglob('*') if p.is_file() and p.suffix.lower() in ('.exe','.dll','.qml')}
+ (out/'artifacts.json').write_text(json.dumps(payload,ensure_ascii=False,indent=2),encoding='utf-8')
+ env={k:v for k,v in os.environ.items() if not k.upper().startswith(('VEYRA_','QT_QUICK_BACKEND','QSG_RHI_BACKEND'))}
+ env.update(TEMP=str(tmp),TMP=str(tmp),VEYRA_LOG_FILE=str(out/'player.log'),QML_DISABLE_DISK_CACHE='1',QT_FORCE_STDERR_LOGGING='1')
+ args=['--obs-game-capture'] if renderer=='obs-compat' else []
+ command=[str(app/'veyra_qml_ui.exe'),'--data-dir',str(profile),'--page','pro','--size','1280x800','--exit-after','150000',*args];print('START',name,flush=True);start=time.monotonic()
+ with (out/'console.log').open('xb') as stream:
+ try:rc=subprocess.run(command,cwd=app,env=env,stdout=stream,stderr=subprocess.STDOUT,timeout=160).returncode
+ except subprocess.TimeoutExpired:rc=124
+ log=(out/'player.log').read_text(encoding='utf-8',errors='replace');marker='PLAYBACK_FUNCTION_PASS' if mode=='functional' else 'PLAYBACK_LAYOUT_FULLSCREEN_PASS'
+ errors=[s for s in log.splitlines() if any(x in s for x in ('[ERROR]','[FATAL]','ReferenceError:','TypeError:','FUNCTION_FAIL','LAYOUT_FAIL'))]
+ row={'name':name,'renderer':renderer,'mode':mode,'command':command,'exitCode':rc,'wallSeconds':time.monotonic()-start,'exeSha256':exeHash,'sourceSha256':matrix.digest(source),
+ 'markers':[s for s in log.splitlines() if 'PLAYBACK_' in s and 'PASS' in s],'errors':errors,'passed':rc==0 and marker in log and not errors,'extraGpuLoad':False,
+ 'actualObsCaptureTested':False,'obsCompatSelected':renderer=='obs-compat' and 'OBS game capture compatibility: software UI' in log}
+ assert renderer!='obs-compat' or row['obsCompatSelected']
+ assert all(matrix.digest(app/n)==sha for n,sha in payload.items());results.append(row);(out/'result.json').write_text(json.dumps(row,ensure_ascii=False,indent=2),encoding='utf-8')
+ (folder/'completed.json').write_text(json.dumps(results,ensure_ascii=False,indent=2),encoding='utf-8');print('RESULT',name,row['passed'],flush=True)
+ if not row['passed']:print('\n'.join(errors)[-4000:],log[-3000:],flush=True);raise SystemExit(1)
+main.write_text(original,encoding='utf-8');matrix.assert_gpu_tests_idle()
+(folder/'summary.json').write_text(json.dumps({'runs':results,'passed':True,'extraGpuLoad':False},ensure_ascii=False,indent=2),encoding='utf-8');print('R0_UI_COMPLETE',len(results),flush=True)
diff --git a/tests/qml/QuickSmokeTests.cpp b/tests/qml/QuickSmokeTests.cpp
index 9a433439..9a14ba7e 100644
--- a/tests/qml/QuickSmokeTests.cpp
+++ b/tests/qml/QuickSmokeTests.cpp
@@ -6,6 +6,7 @@
#include <QFileInfo>
#include <QQmlEngine>
#include <QQmlContext>
+#include <QQmlComponent>
#include <QtQml/qqml.h>
#include <QtQuickTest/quicktest.h>
@@ -15,6 +16,34 @@ public slots:
void qmlEngineAvailable(QQmlEngine* engine) {
engine->rootContext()->setContextProperty(QStringLiteral("exportTestOutputDirectory"),qEnvironmentVariable("VEYRA_EXPORT_TEST_ARTIFACTS"));
engine->addImportPath(QDir(QCoreApplication::applicationDirPath()).filePath(QStringLiteral("qml")));
+ // The registered inline NR card has the engine's creation context,
+ // not the fixture item's lexical context. Supply its explicit UI-only
+ // snapshot here. The separate real-player probes test the C++ bridge.
+ QQmlComponent snapshot(engine);
+ snapshot.setData(R"qml(import QtQml
+QtObject {
+ property var effectCapabilities: ({nr0:{available:true}})
+ property var nrRuntimeChoices: [{id:"0",label:"RTX 50 · Lecram"}]
+ property var nrLayers: [{index:1}]
+ property int nrMotionSource: 1
+ property string nrAutoStatus: ""
+ property var nodeTimings: ({})
+ property var preferences: ({exportStopsPlayback:false})
+ property real playbackRate: 1
+ property real duration: 100
+ property bool hasSource: true
+ property bool isCapture: false
+ signal settingsChanged()
+ signal chainChanged()
+ signal snapshotChanged()
+ function nrAutoSelectionReason(index) { return "Auto is unavailable in this four-layer UI fixture" }
+ function resetNrLayer(index) {}
+ function logUi(category, text) {}
+})qml", QUrl());
+ auto* model = snapshot.create(engine->rootContext());
+ if (!model) qFatal("Cannot create explicit component snapshot: %s", qPrintable(snapshot.errorString()));
+ model->setParent(engine);
+ engine->rootContext()->setContextProperty(QStringLiteral("veyra"), model);
// ProPage is private to the production shell's directory, not exported
// by Veyra/qmldir. Register it only here to test its real inline controls.
qmlRegisterType(QUrl::fromLocalFile(QDir(QCoreApplication::applicationDirPath()).filePath(
diff --git a/tests/qml/quick/tst_components.qml b/tests/qml/quick/tst_components.qml
index cf2f1912..c00ca5a8 100644
--- a/tests/qml/quick/tst_components.qml
+++ b/tests/qml/quick/tst_components.qml
@@ -71,7 +71,7 @@ Item {
property int lastIndex: -1
property string lastKey: ""
property var rows: [0,1,2,3].map(i => ({
- index: 2*i+1, enabled: true, sizePolicy: 0, intensity: 1,
+ index: 2*i+1, enabled: true, runtime: 0, sizePolicy: 0, intensity: 1,
tone: 1, structure: 1, skin: -1, style: 0, autoMask: false,
uiCorrection: false, total: 1, darken: 1, brighten: 1,
color: 1, luminance: 1, temporal: false
@@ -373,6 +373,10 @@ Item {
function pickOption(select,index) {
verify(select.width>20 && select.height>10)
+ const position=select.mapToItem(root,0,0)
+ console.log("SELECT_REAL_HIT",JSON.stringify({name:select.objectName,index:index,x:position.x,y:position.y,w:select.width,h:select.height,enabled:select.enabled,visible:select.visible,windowWidth:root.Window.window.width,windowHeight:root.Window.window.height}))
+ verify(waitForPolish(root.Window.window))
+ wait(550) // finish the real accordion's opening/clipping transition
mouseClick(select)
const popup=popupFor(select)
tryCompare(popup,"opened",true)
@@ -398,7 +402,10 @@ Item {
mouseClick(card,40,24)
tryCompare(card,"open",true)
const resolution=findChild(card,"nr-resolution")
- compare(resolution.options.map(o=>o.label).join(","),"480p,720p,900p,1080p · 默认,1440p,原生")
+ compare(resolution.options.slice(0,6).map(o=>o.label).join(","),"480p,720p,900p,1080p · 默认,1440p,原生")
+ compare(resolution.options.length,7)
+ compare(resolution.options[6].id,"6")
+ compare(resolution.options[6].disabled,true)
pickOption(resolution,optionIndices[i])
compare(fixture.rows[i].sizePolicy,policies[i])
const intensity=findChild(card,"nr-intensity")
diff --git a/tests/unit/EffectChainTests.cpp b/tests/unit/EffectChainTests.cpp
index 0ae6de08..891b6ff2 100644
--- a/tests/unit/EffectChainTests.cpp
+++ b/tests/unit/EffectChainTests.cpp
@@ -592,7 +592,7 @@ void testLegacyPlanDimensions() {
cases, source.width, source.height, sr, first, context, policy, target);
}
std::printf("legacy dimension parity: %u cases (CPU descriptions only)\n", cases);
- check(all && cases == 864, "production fixed plans match independent legacy formulas across 864 dimension/context combinations");
+ check(all && cases == 1008, "production fixed plans match independent legacy formulas across 1008 dimension/context combinations");
}
void testProductionFixedPlanDescription() {