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

perf: verify compute queue output in 540 frames, measure HIGH presenter candidate

Veyra Goal Agent0212db3f6c8c
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 96dba241..15dbef49 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1040,6 +1040,10 @@ add_executable(veyra_sr_reconstruction_tests tests/integration/SrReconstructionT
target_compile_features(veyra_nr_prewarm_experiment PRIVATE cxx_std_20)
target_compile_options(veyra_nr_prewarm_experiment PRIVATE /utf-8)
target_link_libraries(veyra_nr_prewarm_experiment PRIVATE veyra_engine)
+ add_executable(veyra_ngx_compute_queue_experiment tests/perf/NgxComputeQueueExperiment.cpp)
+ target_compile_features(veyra_ngx_compute_queue_experiment PRIVATE cxx_std_20)
+ target_compile_options(veyra_ngx_compute_queue_experiment PRIVATE /utf-8)
+ target_link_libraries(veyra_ngx_compute_queue_experiment PRIVATE veyra_engine)
target_compile_features(veyra_nr_recent_cache_experiment PRIVATE cxx_std_20)
target_compile_options(veyra_nr_recent_cache_experiment PRIVATE /utf-8)
target_link_libraries(veyra_nr_recent_cache_experiment PRIVATE veyra_engine bcrypt)
diff --git a/docs/PERF_3C_QUEUES_2026-10-04.md b/docs/PERF_3C_QUEUES_2026-10-04.md
new file mode 100644
index 00000000..5d4c57ec
--- /dev/null
+++ b/docs/PERF_3C_QUEUES_2026-10-04.md
@@ -0,0 +1,15 @@
+# 3c:compute兼容与呈现队列优先级实验
+
+前存档034c2d8 / checkpoint/perf-nr-3c-before-20261004。仅实验候选,默认仍DIRECT/普通队列;HIGH路径由测试环境开关控制,不作为已保留优化。CommandSlotRing按实际队列Type创建匹配allocator/list,限制DIRECT/COMPUTE。每次Close成功后才执行;不删除GPU依赖或等待。
+
+## NGX兼容性
+
+RTX5070/616.56、原版E16及Lecram F95 NR各direct/compute三轮、DLSS SR direct/compute三轮,共18进程540帧。NR使用现有实际snippet/Core契约;SR使用实际DlssSrBackend、线性RGBA16F输入/输出与depth/motion。所有Create/Evaluate/Release、Close、GPU完成和debug检查通过,设备移除0。完整输出逐帧SHA:fresh A-A噪声0、compute差异0,保存每轮首两帧/末帧原始像素。这是作者固定图案上的API/画面兼容证明,不是完整播放、NVOF并发或队列提速证明。
+
+命令:nr-build.py B2d build-compute-priority-v1 veyra_ngx_compute_queue_experiment veyra_qml_ui veyra_nr_gpu_competition_load(15步/exit0);v2增加逐帧SHA、选帧像素(2步/exit0);nr-compute.py B2d B3c-compute-v1(18/18)。原始frames.csv/像素/debug/命令/EXE/runtime身份/GPU环境:E:/项目/Veyra/logs/perf-nr-20261004/B3c-compute-v1-*和summary。
+
+官方接口接收ID3D12GraphicsCommandList,不因此推断所有命令类型通用,兼容性由本轮实际调用验证:[NVIDIA接口定义](https://github.com/NVIDIA/DLSS/blob/main/include/nvsdk_ngx.h)。跨队列仍必须使用正确资源状态与fence:[Microsoft资源依赖说明](https://learn.microsoft.com/en-us/windows/win32/direct3d12/using-resource-barriers-to-synchronize-resource-states-in-direct3d-12)。
+
+## HIGH呈现实测(进行中)
+
+独立FG DIRECT呈现队列,先CheckFeatureSupport再Create,读回GetDesc记录实际Priority。进程调度保持普通,两个NR+DLSS SR+DLSS2X/3X,另一个自有三NR满载进程;相同M1/尺寸/运行库/驱动,每档三轮Normal/HIGH交错,50秒稳态。记录新鲜原/生成帧成功Present间隔、GPU/掉帧、竞争进程实际完成率。nr-queue-priority.py B2d B3c-present-priority-v1正在执行;结果未完成前不判断收益,也不默认开启HIGH。后续完整compute路径根据实际兼容与尾部间隔再决定,R0仍待。
diff --git a/docs/PERF_EXECUTION_NR_2026-10-04.md b/docs/PERF_EXECUTION_NR_2026-10-04.md
index c496a4a9..210851ec 100644
--- a/docs/PERF_EXECUTION_NR_2026-10-04.md
+++ b/docs/PERF_EXECUTION_NR_2026-10-04.md
@@ -38,7 +38,7 @@
| 3b | NR自动内部尺寸 | pending | 取决于E1、真实预算/画质证据 |
| 1b | 内容帧率预算 | rejected-prerequisite | 1a画面不成立,完整求值仍按transport次数;实测成本构造预算反例,PERF_1B_CONTENT_BUDGET;无生产改动 |
| 1c | 重复节奏预测 | rejected | 三种节奏单像素瞬态反例均漏第49帧且后续未检测;PERF_1C_CADENCE_REJECTION;无产品代码需回退 |
-| 3c | 队列分工/呈现优先级 | pending | 先测HIGH呈现与compute list兼容性 |
+| 3c | 队列分工/呈现优先级 | in-progress | NR两运行库及SR共540帧compute/direct完整SHA0差异/debug0;HIGH独立呈现2X/3X竞争12组在跑;PERF_3C_QUEUES |
| 5b | 文件/导出跨帧并行 | pending | 保留源帧/PTS/flow依赖,不扩大实时延迟 |
| 4a | 多NR整链低分辨率调度 | pending | 保留每层残差参数;先测同尺寸与一致性 |
| 4b | 先粗后细组合 | pending | 核对现有逐层尺寸;不新增强制预设 |
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index 69ac08a2..a446ec93 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -1,5 +1,9 @@
# Veyra 工作记录
+## 2026-10-04 PERF 3c候选与compute兼容
+
+CommandSlotRing匹配实际DIRECT/COMPUTE Type、频率用实际queue,HIGH独立呈现仅测试ENV/驱动查询/读回。build-compute-priority-v1 15步、v2 2步exit0。nr-compute.py B2d B3c-compute-v1 两NR DLL+SR各direct/compute三轮,18/18共540帧完整SHA一致/A-A噪声0,debug0/device0,正确RGBA16F SR输入;只证明API与作者图案兼容,不计速度收益。nr-queue-priority.py B2d B3c-present-priority-v1开始实际2X/3X竞争Normal/HIGH交错12组,结果仍待。完整日志/CSV/选帧像素/身份位于同任务label;详PERF_3C_QUEUES。
+
## 2026-10-04 PERF 2c-SR拒绝扩大缓存
nr-feature-cache.py B3a B2c-sr-native-v1 sr及B2c-srnr-native-v1 srnr各六组/300全帧:fresh A-A噪声0,每次on21/50不同,三轮重复;debug0/device0,24hits。尽管SR107.819→0.146ms、SRNR408.532→0.160ms,拒绝生产SR复用;已有单NR范围保持。完整Reset传递、jitter0/NVOF禁temporalHints已核对,原因未证明,不推断SDKbug。比较JSON/rawSHA/八张像素与完整路径详PERF_2C_SR_CACHE_REJECTION。拒绝节点归档本提交。
diff --git a/scripts/perf/nr-compute.py b/scripts/perf/nr-compute.py
new file mode 100644
index 00000000..df8ff0e3
--- /dev/null
+++ b/scripts/perf/nr-compute.py
@@ -0,0 +1,43 @@
+"""Compatibility and complete pixel equality, never execute an invalid list."""
+from pathlib import Path
+import csv,importlib.util,json,os,re,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');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)
+exe=app/'veyra_ngx_compute_queue_experiment.exe';shutil.copy2(BASE/'build'/TASK/variant/exe.name,exe)
+results=[]
+for group,runtime in [('nr','Lecram'),('nr','original'),('sr','Lecram')]:
+ for repeat in range(1,4):
+ for mode in ('direct','compute'):
+ matrix.assert_gpu_tests_idle();name=f'{label}-{group}-{runtime}-{mode}-r{repeat}';out=BASE/'logs'/TASK/name;tmp=BASE/'tmp'/TASK/name
+ for p in (out,tmp):p.mkdir(parents=True,exist_ok=False)
+ directory=app/'runtime/experimental';directory=directory if runtime=='Lecram' else directory/'nr-original'
+ env=os.environ.copy()
+ for key in tuple(env):
+ if key.upper().startswith('VEYRA_'):env.pop(key)
+ env.update(TEMP=str(tmp),TMP=str(tmp));command=[str(exe),str(directory),str(out),mode,group]
+ print('START',name,flush=True);before=matrix.gpu_query();start=time.monotonic()
+ with (out/'console.log').open('xb') as f:
+ try:rc=subprocess.run(command,cwd=app,env=env,stdout=f,stderr=subprocess.STDOUT,timeout=90).returncode
+ except subprocess.TimeoutExpired:rc=124
+ text=(out/'console.log').read_text(encoding='utf-8',errors='replace');line=next((s for s in text.splitlines() if s.startswith('COMPUTE_RESULT ')),'')
+ metrics={k:float(v) for k,v in re.findall(r'(\w+)=(-?\d+(?:\.\d+)?)',line)}
+ rows=list(csv.DictReader((out/'frames.csv').open())) if (out/'frames.csv').exists() else []
+ result={'group':group,'runtime':runtime,'mode':mode,'repeat':repeat,'command':command,'exitCode':rc,'metrics':metrics,
+ 'hashes':[r['sha256'] for r in rows],'frameCount':len(rows),'exeSha256':matrix.digest(exe),
+ 'runtimeSha256':matrix.digest(directory/'nvngx_dlssnr.dll'),'beforeGpu':before,'afterGpu':matrix.gpu_query(),'wallSeconds':time.monotonic()-start,
+ 'compatible':rc==0 and metrics.get('compatible')==1 and metrics.get('debugErrors')==0 and len(rows)==30,
+ 'measurement':'Create/Close/Evaluate through actual adapters, debug errors and full raw output SHA, authored static pattern; no performance/scanout claim'}
+ (out/'result.json').write_text(json.dumps(result,ensure_ascii=False,indent=2),encoding='utf-8');results.append(result)
+ print('RESULT',name,result['compatible'],metrics,flush=True)
+ assert rc!=124 and metrics.get('deviceRemoved')==0,'Unexpected termination/device failure; preserve logs and stop'
+ if mode=='direct':assert result['compatible'],text[-6500:]
+comparisons=[]
+for group,runtime in [('nr','Lecram'),('nr','original'),('sr','Lecram')]:
+ rows=[r for r in results if r['group']==group and r['runtime']==runtime];ref=rows[0]['hashes']
+ comparisons.append({'group':group,'runtime':runtime,'freshNoise':sum(a!=b for r in rows if r['mode']=='direct' for a,b in zip(ref,r['hashes'])),
+ 'computeCompatible':all(r['compatible'] for r in rows),'computeDifferent':sum(a!=b for r in rows if r['mode']=='compute' for a,b in zip(ref,r['hashes']))})
+with (BASE/'logs'/TASK/(label+'-summary.json')).open('x',encoding='utf-8') as f:json.dump({'results':results,'comparisons':comparisons},f,ensure_ascii=False,indent=2)
+print('COMPUTE_COMPARISONS',comparisons,flush=True)
diff --git a/scripts/perf/nr-matrix.py b/scripts/perf/nr-matrix.py
index b8feb518..657f9e18 100644
--- a/scripts/perf/nr-matrix.py
+++ b/scripts/perf/nr-matrix.py
@@ -110,7 +110,7 @@ def stage(variant):
main.write_text(text, encoding='utf-8')
return path
-def run(variant, material, setting, label, seconds, gpuPriority=None, allowedGpuPids=()):
+def run(variant, material, setting, label, seconds, gpuPriority=None, allowedGpuPids=(),testEnv=None):
assert_gpu_tests_idle(allowedGpuPids)
subprocess.run([sys.executable, '-B', str(ROOT / 'scripts/perf/nr-control.py'), 'guard'], check=True)
app = stage(variant)
@@ -132,8 +132,12 @@ def run(variant, material, setting, label, seconds, gpuPriority=None, allowedGpu
env.update(TEMP=str(tmp), TMP=str(tmp), VEYRA_LOG_FILE=str(logs / 'player.log'),
QML_DISABLE_DISK_CACHE='1', QT_FORCE_STDERR_LOGGING='1', QML_XHR_ALLOW_FILE_READ='1',
VEYRA_VERBOSE_FRAME_LOGS='1')
+ if testEnv:
+ assert all(key.startswith('VEYRA_TEST_') for key in testEnv)
+ env.update(testEnv)
before = gpu_query()
receipt = {'variant': variant, 'material': material, 'setting': setting, 'config': config,
+ 'testEnv':testEnv or {},
'sourceSha256': digest(media), 'exeSha256': digest(app / 'veyra_qml_ui.exe'),
'runtimeSha256': digest(app / 'runtime/experimental/nvngx_dlssnr.dll'),
'beforeGpu': before, 'secondsRequested': seconds, 'measurement': 'GPU timestamps and CPU submission, not display scanout',
diff --git a/scripts/perf/nr-probe.qml b/scripts/perf/nr-probe.qml
index 4377fc48..3488a8d0 100644
--- a/scripts/perf/nr-probe.qml
+++ b/scripts/perf/nr-probe.qml
@@ -59,7 +59,7 @@ Item {
}
probe.expectFg = Boolean(probe.config.fg)
if (probe.expectFg) {
- veyra.fgBackendName = "dlss"; veyra.fgMultiplier = 2; veyra.fgEnabled = true
+ veyra.fgBackendName = "dlss"; veyra.fgMultiplier = probe.config.multiplier || 2; veyra.fgEnabled = true
}
console.log("NR_PERF_CONFIG", JSON.stringify({config:probe.config, layers:veyra.nrLayers,
sr:veyra.srEnabled, srQuality:veyra.videoSrQuality, srTarget:veyra.srTargetIndex,
diff --git a/scripts/perf/nr-queue-priority.py b/scripts/perf/nr-queue-priority.py
new file mode 100644
index 00000000..796bc552
--- /dev/null
+++ b/scripts/perf/nr-queue-priority.py
@@ -0,0 +1,54 @@
+"""Only owned NR competition; actual independent FG presentation queue HIGH."""
+from pathlib import Path
+import csv,importlib.util,json,os,re,shutil,subprocess,sys,time,statistics
+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+'-load-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_nr_gpu_competition_load.exe',app/'veyra_nr_gpu_competition_load.exe')
+matrix.stage(variant);results=[]
+for multiplier in (2,3):
+ setting='S4-'+str(multiplier);matrix.CONFIGS[setting]={**matrix.CONFIGS['S4'],'multiplier':multiplier}
+ for repeat,order in enumerate([('normal','high'),('high','normal'),('normal','high')],1):
+ for priority in order:
+ matrix.assert_gpu_tests_idle();name=f'{label}-{multiplier}X-{priority}-r{repeat}';out=BASE/'logs'/TASK/(name+'-load');tmp=BASE/'tmp'/TASK/(name+'-load')
+ for p in (out,tmp):p.mkdir(parents=True,exist_ok=False)
+ env=os.environ.copy()
+ for key in tuple(env):
+ if key.upper().startswith('VEYRA_'):env.pop(key)
+ env.update(TEMP=str(tmp),TMP=str(tmp));command=[str(app/'veyra_nr_gpu_competition_load.exe'),str(matrix.SOURCES['M1']),str(out),'100']
+ print('QUEUE_START',name,flush=True);started=time.monotonic()
+ with (out/'console.log').open('xb') as console:
+ load=subprocess.Popen(command,cwd=app,env=env,stdout=console,stderr=subprocess.STDOUT)
+ try:
+ while time.monotonic()-started<40 and load.poll() is None:
+ if 'LOAD_READY' in (out/'console.log').read_text(encoding='utf-8',errors='replace'):break
+ time.sleep(.25)
+ assert load.poll() is None and 'LOAD_READY' in (out/'console.log').read_text(encoding='utf-8',errors='replace')
+ matrix.run(variant,'M1',setting,name,50,allowedGpuPids=(load.pid,),testEnv={'VEYRA_TEST_PRESENT_QUEUE_PRIORITY':priority})
+ assert load.poll() is None,'load ended before target';(out/'stop').write_text('owned target complete',encoding='utf-8');rc=load.wait(timeout=20)
+ finally:
+ if load.poll() is None:load.kill();load.wait(timeout=8)
+ text=(out/'console.log').read_text(encoding='utf-8',errors='replace');assert rc==0 and 'LOAD_RESULT pass=1' in text,text[-4000:]
+ target=BASE/'logs'/TASK/name;receipt=json.loads((target/'result.json').read_text(encoding='utf-8'));log=(target/'player.log').read_text(encoding='utf-8',errors='replace')
+ actual=[int(x) for x in re.findall(r'actualType=0 actualPriority=(\d+)',log)];expected=100 if priority=='high' else 0
+ assert actual and all(x==expected for x in actual),'Requested queue priority not applied'
+ rows=[]
+ for line in log.splitlines():
+ if '[submit]' not in line:continue
+ fields=dict(re.findall(r'(\w+)=(-?\d+)',line));pts=int(fields.get('pts100ns','-1'))
+ if 100000000<=pts<=480000000:rows.append({k:int(v) for k,v in fields.items()})
+ intervals=[(b['host100ns']-a['host100ns'])/10000 for a,b in zip(rows,rows[1:])];assert len(intervals)>100
+ def pct(p):
+ v=sorted(intervals);return v[min(len(v)-1,int(len(v)*p))]
+ completed=list(csv.DictReader((out/'completed.csv').open()));ready=int(re.search(r'NR_PERF_READY (\d+)',log).group(1))/1000
+ fps=[float(r['completedFps']) for r in completed if ready+10<float(r['wallUtc'])<ready+45];assert len(fps)>15
+ result={'name':name,'multiplier':multiplier,'repeat':repeat,'priority':priority,'actualQueuePriorities':actual,
+ 'presentIntervalsMs':{'p50':pct(.5),'p95':pct(.95),'p99':pct(.99),'max':max(intervals),'count':len(intervals)},
+ 'loadCompletedFpsMedian':statistics.median(fps),'targetSummary':receipt['summary'],'targetExeSha256':receipt['exeSha256'],
+ 'loadExeSha256':matrix.digest(app/'veyra_nr_gpu_competition_load.exe'),'command':command,'passed':receipt['passed'],
+ 'measurement':'Actual successful software Present return intervals, two NR plus SR plus DLSS2X/3X, own three-NR competing load; no scanout'}
+ (out/'result.json').write_text(json.dumps(result,ensure_ascii=False,indent=2),encoding='utf-8');results.append(result)
+ print('QUEUE_RESULT',name,result['presentIntervalsMs'],result['loadCompletedFpsMedian'],flush=True)
+with (BASE/'logs'/TASK/(label+'-summary.json')).open('x',encoding='utf-8') as f:json.dump(results,f,ensure_ascii=False,indent=2)
diff --git a/src/engine/VideoPresenter.cpp b/src/engine/VideoPresenter.cpp
index 8d3ed4a3..745ca6d5 100644
--- a/src/engine/VideoPresenter.cpp
+++ b/src/engine/VideoPresenter.cpp
@@ -27,7 +27,17 @@ bool VideoPresenter::open(gfx::D3D12DeviceContext& ctx,HWND window,pipeline::Enh
Status st=Status::Ok;
if(graph.fgEnabled()&&!graph.xessEnabled()){
D3D12_COMMAND_QUEUE_DESC desc{};desc.Type=D3D12_COMMAND_LIST_TYPE_DIRECT;
+ wchar_t requestedPriority[16]{};
+ if(GetEnvironmentVariableW(L"VEYRA_TEST_PRESENT_QUEUE_PRIORITY",requestedPriority,16)&&std::wstring_view(requestedPriority)==L"high"){
+ D3D12_FEATURE_DATA_COMMAND_QUEUE_PRIORITY support{desc.Type,D3D12_COMMAND_QUEUE_PRIORITY_HIGH,FALSE};
+ const HRESULT queried=ctx.device()->CheckFeatureSupport(D3D12_FEATURE_COMMAND_QUEUE_PRIORITY,&support,sizeof(support));
+ if(SUCCEEDED(queried)&&support.PriorityForTypeIsSupported)desc.Priority=D3D12_COMMAND_QUEUE_PRIORITY_HIGH;
+ veyra::log::info("present-priority",std::format("requested=HIGH supported={} queryHr=0x{:X} selected={}",
+ support.PriorityForTypeIsSupported,unsigned(queried),desc.Priority));
+ }
HRESULT hr=ctx.device()->CreateCommandQueue(&desc,IID_PPV_ARGS(&presentationQueue_));
+ if(SUCCEEDED(hr))veyra::log::info("present-priority",std::format("actualType={} actualPriority={}",
+ unsigned(presentationQueue_->GetDesc().Type),presentationQueue_->GetDesc().Priority));
if(SUCCEEDED(hr))hr=ctx.device()->CreateFence(0,D3D12_FENCE_FLAG_NONE,IID_PPV_ARGS(&presentationFence_));
if(FAILED(hr)){veyra::log::error("present",std::format("application frame-generation presentation queue/fence hr=0x{:X}",unsigned(hr)));close();return false;}
presentationEvent_=CreateEventW(nullptr,FALSE,FALSE,nullptr);
diff --git a/src/gfx/CommandSlotRing.cpp b/src/gfx/CommandSlotRing.cpp
index ebdceaab..88c8410e 100644
--- a/src/gfx/CommandSlotRing.cpp
+++ b/src/gfx/CommandSlotRing.cpp
@@ -58,14 +58,18 @@ bool CommandSlotRing::initialize(ID3D12Device* device,
slotCount_, timestampHeapDesc.Count, frequency, veyra::hresultString(freqResult)));
slots_.resize(slotCount_);
+ const auto commandType=queue_->GetDesc().Type;
+ if(commandType!=D3D12_COMMAND_LIST_TYPE_DIRECT&&commandType!=D3D12_COMMAND_LIST_TYPE_COMPUTE){
+ status=Status::InvalidArgument;veyra::log::error("gfx","slot-ring: unsupported queue type");return false;
+ }
for (uint32_t i = 0; i < slotCount_; ++i) {
- HRESULT result = device_->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&slots_[i].allocator));
+ HRESULT result = device_->CreateCommandAllocator(commandType, IID_PPV_ARGS(&slots_[i].allocator));
if (FAILED(result)) {
status = Status::DeviceFailure;
veyra::log::error("gfx", std::format("slot-ring: CreateCommandAllocator slot={} failed hr={}", i, veyra::hresultString(result)));
return false;
}
- result = device_->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, slots_[i].allocator.Get(), nullptr, IID_PPV_ARGS(&slots_[i].list));
+ result = device_->CreateCommandList(0, commandType, slots_[i].allocator.Get(), nullptr, IID_PPV_ARGS(&slots_[i].list));
if (SUCCEEDED(result)) slots_[i].list->SetName(std::format(L"Veyra slot {}", i).c_str());
if (FAILED(result)) {
status = Status::DeviceFailure;
diff --git a/tests/perf/NgxComputeQueueExperiment.cpp b/tests/perf/NgxComputeQueueExperiment.cpp
new file mode 100644
index 00000000..68bc61e6
--- /dev/null
+++ b/tests/perf/NgxComputeQueueExperiment.cpp
@@ -0,0 +1,73 @@
+#include "NrExperimentalFixture.h"
+#include "veyra/ngx/DlssSrBackend.h"
+#include "veyra/FileIdentity.h"
+#include <d3d12sdklayers.h>
+#include <DirectXPackedVector.h>
+#include <iostream>
+
+// Compatibility first: an invalid recorded list is discarded before execution.
+// Author-created fixed pixels, actual product NR/SR adapter and NGX contracts.
+int wmain(int argc,wchar_t** argv){
+ using namespace nrperf;if(argc!=5)return 2;
+ const bool compute=std::wstring_view(argv[3])==L"compute";
+ const bool sr=std::wstring_view(argv[4])==L"sr";
+ if((!compute&&std::wstring_view(argv[3])!=L"direct")||(!sr&&std::wstring_view(argv[4])!=L"nr"))return 2;
+ const std::filesystem::path out=argv[2];std::filesystem::create_directories(out);
+ Logger::instance().openFile((out/L"engine.log").wstring());
+ Session session;if(!session.init(argv[1]))return 2;Status status;
+ ComPtr<ID3D12CommandQueue> queue;ComPtr<ID3D12Fence> fence;
+ D3D12_COMMAND_QUEUE_DESC qd{};qd.Type=compute?D3D12_COMMAND_LIST_TYPE_COMPUTE:D3D12_COMMAND_LIST_TYPE_DIRECT;
+ if(!hrOK(session.device.device()->CreateCommandQueue(&qd,IID_PPV_ARGS(&queue)),"Queue.Create")||
+ !hrOK(session.device.device()->CreateFence(0,D3D12_FENCE_FLAG_NONE,IID_PPV_ARGS(&fence)),"Fence.Create"))return 2;
+ HANDLE event=CreateEventW(nullptr,FALSE,FALSE,nullptr);if(!event)return 2;
+ gfx::CommandSlotRing ring;UINT64 frequency=0;
+ if(!ring.initialize(session.device.device(),queue.Get(),fence.Get(),event,4,status)||
+ !hrOK(queue->GetTimestampFrequency(&frequency),"Queue.Frequency"))return 2;
+ bool created=false,evaluated=false,validOutput=false;
+ std::ofstream frames(out/L"frames.csv");frames<<"frame,width,height,sha256\n";
+ {
+ Feature feature(session);feature.timestampFrequencyOverride=frequency;
+ ngx::DlssSrBackend srFeature;
+ if(sr){
+ uint32_t slot;auto* list=ring.acquireNext(slot,status);
+ if(list){ngx::DlssSrBackend::CreateDesc desc{1920,1080,2560,1440,1,false};
+ created=srFeature.create(session.core,list,feature.params,desc,status);
+ created=created?(ring.submitAndSignal(slot)&&ring.waitIdle()):(ring.discardRecording()&&false);}
+ }else created=feature.create(ring,1920,1080);
+ if(created&&feature.textures(ring,1920,1080,1920,1080)){
+ if(sr){
+ feature.color=pipeline::makeTexture(session.device.device(),1920,1080,DXGI_FORMAT_R16G16B16A16_FLOAT,true);
+ feature.output=pipeline::makeTexture(session.device.device(),2560,1440,DXGI_FORMAT_R16G16B16A16_FLOAT,true);
+ std::vector<uint8_t> pixels(size_t(1920)*1080*8);auto* half=reinterpret_cast<uint16_t*>(pixels.data());
+ for(unsigned y=0;y<1080;++y)for(unsigned x=0;x<1920;++x)for(unsigned c=0;c<4;++c)
+ half[(size_t(y)*1920+x)*4+c]=DirectX::PackedVector::XMConvertFloatToHalf(c==3?1.f:.15f+float((x*3+y*7+c*11)%251)/400.f);
+ if(!feature.color||!feature.output||!feature.upload(ring,feature.color.Get(),pixels))return 2;
+ }
+ evaluated=bool(feature.output);
+ for(unsigned frame=0;frame<30&&evaluated;++frame){
+ if(sr){uint32_t slot;auto* list=ring.acquireNext(slot,status);if(!list){evaluated=false;break;}
+ feature.states.transition(list,feature.output.Get(),D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
+ ngx::DlssSrBackend::EvalDesc desc{feature.color.Get(),feature.output.Get(),feature.depth.Get(),feature.motion.Get(),frame==0,0,0,0};
+ evaluated=srFeature.evaluate(list,feature.params,desc,status);
+ if(evaluated){feature.states.uavBarrier(list,feature.output.Get());feature.states.transition(list,feature.output.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+ evaluated=ring.submitAndSignal(slot)&&ring.waitIdle();}
+ else ring.discardRecording();
+ }else evaluated=feature.evaluate(ring,1920,1080,frame==0);
+ if(evaluated){const auto image=feature.read(ring);validOutput=image.size()==size_t(sr?2560:1920)*(sr?1440:1080)*(sr?8:4);
+ evaluated=validOutput;if(validOutput){frames<<frame<<','<<(sr?2560:1920)<<','<<(sr?1440:1080)<<','<<sha256Hex(image.data(),image.size())<<'\n';frames.flush();
+ if(frame<2||frame==29){std::ofstream file(out/(L"frame-"+std::to_wstring(frame)+(sr?L".rgba16f":L".rgba")),std::ios::binary);
+ file.write(reinterpret_cast<const char*>(image.data()),std::streamsize(image.size()));}}}
+ }
+ }
+ ring.drainQueue();if(sr&&!srFeature.release())evaluated=false;
+ }
+ ring.drainQueue();ComPtr<ID3D12InfoQueue> debug;unsigned errors=0;
+ if(!hrOK(session.device.device()->QueryInterface(IID_PPV_ARGS(&debug)),"Debug.Query"))return 2;
+ for(UINT64 i=0;i<debug->GetNumStoredMessages();++i){SIZE_T n=0;debug->GetMessage(i,nullptr,&n);
+ std::vector<unsigned char> bytes(n);auto* m=reinterpret_cast<D3D12_MESSAGE*>(bytes.data());
+ if(FAILED(debug->GetMessage(i,m,&n)))return 2;if(m->Severity<=D3D12_MESSAGE_SEVERITY_ERROR){++errors;std::cerr<<"DEBUG_ERROR "<<m->pDescription<<std::endl;}}
+ const auto removed=session.device.device()->GetDeviceRemovedReason();const bool compatible=created&&evaluated&&validOutput&&errors==0&&SUCCEEDED(removed);
+ std::cout<<"COMPUTE_RESULT created="<<created<<" evaluated="<<evaluated<<" compatible="<<compatible<<" debugErrors="<<errors
+ <<" deviceRemoved="<<unsigned(removed)<<" queueType="<<unsigned(qd.Type)<<" frequency="<<frequency<<std::endl;
+ debug.Reset();ring.shutdown();CloseHandle(event);return compatible?0:1;
+}
diff --git a/tests/perf/NrExperimentalFixture.h b/tests/perf/NrExperimentalFixture.h
index 33514551..a1ad9d80 100644
--- a/tests/perf/NrExperimentalFixture.h
+++ b/tests/perf/NrExperimentalFixture.h
@@ -67,6 +67,7 @@ struct Feature {
ComPtr<ID3D12QueryHeap> queries;
ComPtr<ID3D12Resource> queryReadback;
double lastGpuEvaluateMs=0;
+ uint64_t timestampFrequencyOverride=0; // Actual experimental queue frequency.
pipeline::StateTracker states;
uint32_t textureWidth=0,textureHeight=0;
explicit Feature(Session& s):session(s) {Status status;params=s.core.allocateParameters(status);}
@@ -156,7 +157,8 @@ struct Feature {
list->ResolveQueryData(queries.Get(),D3D12_QUERY_TYPE_TIMESTAMP,0,2,queryReadback.Get(),0);
states.uavBarrier(list,output.Get());states.transition(list,output.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
if(!ring.submitAndSignal(slot)||!ring.waitIdle())return false;
- UINT64 frequency=0;if(!hrOK(session.device.directQueue()->GetTimestampFrequency(&frequency),"Timer.Frequency")||!frequency)return false;
+ UINT64 frequency=timestampFrequencyOverride;
+ if(!frequency&&(!hrOK(session.device.directQueue()->GetTimestampFrequency(&frequency),"Timer.Frequency")||!frequency))return false;
void* data=nullptr;D3D12_RANGE range{0,16};if(!hrOK(queryReadback->Map(0,&range,&data),"Timer.Map"))return false;
UINT64 values[2]{};std::memcpy(values,data,16);D3D12_RANGE empty{};queryReadback->Unmap(0,&empty);
if(values[1]<values[0])return false;lastGpuEvaluateMs=double(values[1]-values[0])*1000.0/double(frequency);