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(vfg): test one producer dependency per immutable input pair
Veyra Goal Agentff8fdf445734
diff --git a/AGENTS.md b/AGENTS.mdindex 411bf9ae..70cdaef6 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -1,5 +1,7 @@# Veyra 项目 Agent 执行规则+> **2026-10-07 VFG继续优化授权**:用户要求继续尝试VFG优化。按docs/VFG_NEXT_PLAN_2026-10-07.md从正式2.0.6后main 96a7c8de在E盘codex/vfg-next-20261007隔离实施VFG必要互操作/提交及定向测试、本地候选;覆盖对应旧冻结。先运行vfg-next-control.py,独立start/bundle保护34工作树、495脏文件和3691项原件,不改旧guard。其它补帧/NR/时钟/显示策略不动,DLL/模型原字节;不派Agent/压力竞争、不改用户配置/驱动,不merge/push/Release/关机。测试≤300秒、构建≤900秒、产物全E盘。+> **2026-10-07 2.0.6正式发布授权**:用户明确构建2.0.6并发布GitHub,替换满员4群为所附5群二维码,发布后交付群公告。按docs/RELEASE_2.0.6_PLAN_2026-10-07.md从已验bf6e651在E盘codex/release-2.0.6-20261007整合VFG/Blackmagic/AMD NR-FSR修复,允许版本/双语README/新二维码/构建定向验收/同源码双显卡包及本轮commit/tag/main合并/普通push/v2.0.6正式Release与5资产上传。覆盖历史no-merge/no-push/no-Release;不扩改已验算法或运行组件,不改用户配置/驱动/其它工作树,不派Agent/竞争压力,不关机,群公告只交用户不代发。先运行release-2.0.6-control.py,独立start/bundle保护33工作树、495脏文件与3678项原件;仅main允许按合并回执推进,旧guard/baseline不改。测试≤300秒、构建≤900秒、产物全E盘。保留赞助QR/Discord/Ko-fi、双QR各width220,AMD/Blackmagic实卡与NV显存增长边界如实说明。> **2026-10-07 AMD NR/FSR现场修复**:用户报告1080p文件与XSX1080p60开关AMD NR无画面变化,提供veyra-qml(37).log。按docs/AMD_NR_FSR_PLAN_2026-10-07.md从4294341在E盘codex/amd-nr-fsr-handoff-20261007隔离修复共享NR→FSR资源交接和必要定向测试/构建/本地候选;这些具体接点覆盖历史冻结。先运行amd-nr-fsr-control.py,独立start/bundle保护32个工作树、495个脏文件与3672项已发布/候选文件,不改旧guard。运行库/模型原字节、正常链路不回读;无子Agent/竞争压力、不改用户配置/驱动/其他工作树、无新main合并/push/Release/关机。每测试≤300秒、构建≤900秒,所有产物E盘。本机RTX共享交接验证不等于RX9070/HIP/XSX实卡验收。diff --git a/docs/VFG_NEXT_PLAN_2026-10-07.md b/docs/VFG_NEXT_PLAN_2026-10-07.mdnew file mode 100644index 00000000..24c28e2d--- /dev/null+++ b/docs/VFG_NEXT_PLAN_2026-10-07.md@@ -0,0 +1,11 @@+# VFG 继续优化(2026-10-07)++用户:“VFG的优化反响非常好,看看能不能继续尝试优化”。从正式2.0.6后的main 96a7c8de隔离到codex/vfg-next-20261007;工作树E:/项目/Veyra/worktrees/vfg-next-20261007。只改VFG backend及针对性测试/构建/诊断/本地候选。DLSS/XeSS/FSR、NR算法、显示策略、时钟和用户配置不变;不派Agent、不做压力/竞争负载、不merge/push/Release/关机。++1. 独立start.json与source-before.bundle保护34既有工作树、495脏文件及3691项发布原件/证据;每轮运行scripts/acceptance/vfg-next-control.py,不改旧guard或baseline。+2. 用原GTA6 4K30、原版单层1080NR/强度1/零运动/调控关、实际GPU普通、Auto同步/限帧关,复测Medium6、High3和Medium4。记录软件提交FPS、GPU各阶段、降档及错误,不把提交FPS当物理显示/端到端延迟。+3. 假说:同一输入对的每个插帧都重复producer signal/CUDA wait,导致D3D消费拷贝与下一张CUDA工作串行。尝试每对输入只同步一次;保留逐输出completion wait/独立槽/租约/有界worker/失败排空。capture revision、parity、reset、sub1都必须重建依赖。环境变量仅用于同EXE旧模式对照,不改变用户设置。+4. 必须与原2.0.6及同EXE旧模式相邻对照,8/10-bit全部质量/2X–8X像素逐位核对,重复输入地址更新、反向parity/reset、中途起始subframe、失败回退、退出/seek/切换和完整导出计数。实测无收益或画面变化则撤回产品改动并保留报告。+5. 只有证据支持才处理额外VFG专属瓶颈;禁止靠放宽过期门槛、丢更多帧、降低画质或放慢时钟伪造收益。所有产物E:/项目/Veyra下同名任务目录,测试每进程≤300秒、构建≤900秒。正常GPU串行;已有SDK/DLL/模型原字节保持且不进源码Git。++当前:开工保护完成,优化尚未实现,收益待测。NVIDIA显存增长及其它硬件长稳不由本轮短测视为解决。diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex b5792aa9..839045e0 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -1,4 +1,16 @@-# Veyra 工作记录+# WORKLOG++## 2026-10-07 VFG继续优化实验v1++- 首次构建目标veyra_settings_tests不存在,Ninja未编译;改为已存在的veyra_fg_settings_tests,candidate-v1-retry构建成功。日志logs/vfg-next-20261007/candidate-v1*.log/json保留失败,不掩盖。+- 正式2.0.6原EXE/GTA/1080原版NR/普通GPU/Auto同步20秒观察:Medium6=180fps、FG20.848ms;High3=69fps、FG22.627ms且调度降档。仅本轮基线,不沿用旧波动值计算收益。baseline-medium6、baseline-high3回执errors=[],实际GPU类2/队列优先级0。+- 每对输入一次producer依赖实验已实现,仍逐输出completion;重复/回退索引、新输入revision/parity/reset/倍率更新强制新依赖。同EXE测试开关VEYRA_TEST_VFG_PER_FRAME_PRODUCER恢复旧同步。+- baseline-native-720与candidate-native-720各913检查0失败;42组/168张8或10-bit、3质量×2X–8X输出逐位相同,pixels-v1.json。新增不排空CPU的中途索引/重复槽/输入更新测试,待下一构建验证;性能尚待同EXE对照。++## 2026-10-07 VFG继续优化开工++- 基线96a7c8de;隔离工作树E:/项目/Veyra/worktrees/vfg-next-20261007。独立archives/vfg-next-20261007/start.json SHA256 13b729312a19c06f41642d4451dd4f5d042a795937e934a3f70b715b9995091a,source-before.bundle;34其他工作树/495脏文件/3691原件保护。+- 正在验证同一输入对重复跨队列依赖是否造成多余GPU串行;尚无优化收益结论。正常GTA播放/像素与导出定向验收,不改变其它补帧/NR/配置/时钟。方案VFG_NEXT_PLAN_2026-10-07.md,产物E:/项目/Veyra/{logs,tests,build,tmp,verify,test-packages}/vfg-next-20261007。## 2026-10-07 2.0.6 正式发布完成diff --git a/scripts/acceptance/vfg-next-build.py b/scripts/acceptance/vfg-next-build.pynew file mode 100644index 00000000..7dbc2b72--- /dev/null+++ b/scripts/acceptance/vfg-next-build.py@@ -0,0 +1,29 @@+"""Build the isolated routing fix with the accepted 2.0.5 dependencies."""+from pathlib import Path+import hashlib,json,os,subprocess,sys,time+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='vfg-next-20261007'+label=sys.argv[1];assert label.replace('-','').isalnum()+BUILD=BASE/'build'/TASK;TMP=BASE/'tmp'/TASK/'build';LOG=BASE/'logs'/TASK/(label+'.log')+for p in (BUILD,TMP,LOG.parent):p.mkdir(parents=True,exist_ok=True)+guard=[sys.executable,'-B',str(ROOT/'scripts/acceptance/vfg-next-control.py')];subprocess.run(guard,check=True)+cache=BASE/'build/release-2.0.5-20261007/standard/CMakeCache.txt';settings=[]+for line in cache.read_text(encoding='utf8').splitlines():+ if ':' not in line or '=' not in line or line.startswith(('#','//')):continue+ keytype,value=line.split('=',1);key,kind=keytype.split(':',1)+ if kind in ('INTERNAL','STATIC') or key in ('VEYRA_DISPLAY_VERSION','VEYRA_AMD_NR_TEST_GRAPH_SOURCE'):continue+ if key.startswith('VEYRA_') or key in ('CMAKE_PREFIX_PATH','CMAKE_MAKE_PROGRAM','PROTOC','PKG_CONFIG_EXECUTABLE'):+ settings.append(f'set({key} [[{value}]] CACHE {kind} "Accepted dependencies" FORCE)')+settings.append('set(VEYRA_DISPLAY_VERSION [[2.0.6-vfg-next]] CACHE STRING "Local AMD NR/FSR repair" FORCE)')+(TMP/'dependencies.cmake').write_text('\n'.join(settings),encoding='utf8')+targets=sys.argv[2:] or ['veyra_qml_ui','veyra_amd_nr_graph_tests','veyra_lmxxf_nr_tests','veyra_effect_chain_tests']+assert all(t.replace('_','').isalnum() for t in targets)+cmd=TMP/'build.cmd';cmd.write_text('@echo off\nchcp 65001 >nul\ncall "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat" >nul 2>&1\nif errorlevel 1 exit /b 4\n"%TASK_CMAKE%" --preset x64-release -S "%TASK_ROOT%" -B "%TASK_BUILD%" -C "%TASK_TMP%\\dependencies.cmake"\nif errorlevel 1 exit /b 5\n"%TASK_CMAKE%" --build "%TASK_BUILD%" --parallel 6 --target '+' '.join(targets)+'\nexit /b %errorlevel%\n',encoding='ascii')+env=os.environ.copy();env.update(TEMP=str(TMP),TMP=str(TMP),VSLANG='1033',TASK_ROOT=str(ROOT),TASK_BUILD=str(BUILD),TASK_TMP=str(TMP),TASK_CMAKE='C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe')+source={str(p.relative_to(ROOT)).replace('\\','/'):hashlib.sha256(p.read_bytes()).hexdigest() for folder in ('src','include','shaders','qml','tests') for p in (ROOT/folder).rglob('*') if p.is_file()}+source['CMakeLists.txt']=hashlib.sha256((ROOT/'CMakeLists.txt').read_bytes()).hexdigest()+start=time.monotonic()+with LOG.open('x',encoding='utf8') as stream:+ try:rc=subprocess.run(['cmd.exe','/d','/c',str(cmd)],cwd=ROOT,env=env,stdout=stream,stderr=subprocess.STDOUT,timeout=890).returncode+ except subprocess.TimeoutExpired:rc=124+LOG.with_suffix('.json').write_text(json.dumps({'exit':rc,'seconds':time.monotonic()-start,'targets':targets,'sourceHead':subprocess.check_output(['git','rev-parse','HEAD'],cwd=ROOT,encoding='ascii').strip(),'sourceFiles':source,'dependencyCacheSha256':hashlib.sha256(cache.read_bytes()).hexdigest()},indent=2),encoding='utf8')+print('BUILD',rc,LOG);print('\n'.join(LOG.read_text(encoding='utf8',errors='replace').splitlines()[-14:]));subprocess.run(guard,check=True);raise SystemExit(rc)diff --git a/scripts/acceptance/vfg-next-control.py b/scripts/acceptance/vfg-next-control.pynew file mode 100644index 00000000..88840e31--- /dev/null+++ b/scripts/acceptance/vfg-next-control.py@@ -0,0 +1,27 @@+"""Independent VFG continuation guard; previous baselines are immutable."""+from pathlib import Path+import hashlib,json,subprocess+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='vfg-next-20261007'+START=BASE/'archives'/TASK/'start.json'+ALLOWED={'AGENTS.md','docs/WORKLOG.md','src/pipeline/VfgBackend.cpp','tests/integration/VfgGpuTests.cpp'}+def sha(p):+ with p.open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()+def git(*args,cwd=ROOT):return subprocess.check_output(['git',*args],cwd=cwd)+def others():+ out=[]+ for line in git('worktree','list','--porcelain').decode('utf8').splitlines():+ if not line.startswith('worktree '):continue+ p=Path(line[9:])+ if p.resolve()==ROOT.resolve():continue+ names=set(git('ls-files','-m','-o','--exclude-standard','-z',cwd=p).decode('utf8').split('\0'))-{''}+ out.append({'path':str(p),'head':git('rev-parse','HEAD',cwd=p).decode().strip(),'statusHex':git('status','--porcelain=v1','-z','--untracked-files=all',cwd=p).hex(),'changed':{n:sha(p/n) if (p/n).is_file() else None for n in sorted(names)}})+ return out+assert sha(START)=='13b729312a19c06f41642d4451dd4f5d042a795937e934a3f70b715b9995091a','Immutable baseline changed'+start=json.loads(START.read_text(encoding='utf8'))+changed=[n for n,d in start['files'].items() if not (ROOT/n).is_file() or sha(ROOT/n)!=d]+current=set(git('ls-files','-c','-o','--exclude-standard','-z').decode('utf8').split('\0'))-{''}+changed+=sorted(current-set(start['files']))+assert all(n in ALLOWED or n.startswith(('docs/VFG_NEXT_','scripts/acceptance/vfg-next-')) for n in changed),changed+assert others()==start['otherWorktrees'],'Another worktree changed'+for n,d in start['immutable'].items():assert sha(Path(n))==d,n+print('VFG continuation guard passed:',len(set(changed)),'scope files;',len(start['otherWorktrees']),'other worktrees;',len(start['immutable']),'immutable files')diff --git a/scripts/acceptance/vfg-next-exports.py b/scripts/acceptance/vfg-next-exports.pynew file mode 100644index 00000000..31f3a53e--- /dev/null+++ b/scripts/acceptance/vfg-next-exports.py@@ -0,0 +1,55 @@+"""Serial real graph/NVENC export checks, including frame counts and PTS."""+from pathlib import Path+import argparse,json,os,re,shutil,subprocess,psutil+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='vfg-next-20261007';APP=BASE/'tests'/TASK/'app'+p=argparse.ArgumentParser();p.add_argument('label');a=p.parse_args();assert a.label.replace('-','').isalnum()+subprocess.run(['python','-B',str(ROOT/'scripts/acceptance/vfg-next-control.py')],cwd=ROOT,check=True)+assert not any(x.info['name'].lower() in ('veyra.exe','veyra_qml_ui.exe','veyra_vfg_gpu_tests.exe','veyra_vfg_export_probe.exe') for x in psutil.process_iter(['name']))+out,logs,tmp=(BASE/k/TASK/a.label for k in ('tests','logs','tmp'))+for x in (out,logs,tmp):x.mkdir(parents=True,exist_ok=False)+probe=shutil.which('ffprobe');ffmpeg=shutil.which('ffmpeg');assert probe and ffmpeg+shutil.copy2(BASE/'build'/TASK/'veyra_vfg_export_probe.exe',APP/'veyra_vfg_export_probe.exe')+env={k:v for k,v in os.environ.items() if not k.startswith(('VEYRA_','QSG_','QT_QUICK_'))}+env.update(TEMP=str(tmp),TMP=str(tmp),CUDA_CACHE_PATH=str(tmp/'cuda-cache'),VEYRA_VFG_RUNTIME=str(APP/'runtime/nvidia-vfg'))+env['PATH']=os.pathsep.join((env['WINDIR']+'/System32',env['WINDIR'],env['WINDIR']+'/System32/Wbem'))+source=BASE/'tests/runtime-size-20261004/export-basic-v2/input.mp4';assert source.is_file();results=[]+def run(name,media,m,q,flags=(),expected='success'):+ file=out/(name+'.mp4');child=env.copy()+ if expected=='missing':child['VEYRA_VFG_RUNTIME']=str(tmp/'missing-runtime')+ log=logs/(name+'.log');cmd=[str(APP/'veyra_vfg_export_probe.exe'),str(media),str(file),str(m),str(q),*flags]+ with log.open('xb') as f:+ try:rc=subprocess.run(cmd,cwd=APP,env=child,stdout=f,stderr=subprocess.STDOUT,timeout=290).returncode+ except subprocess.TimeoutExpired:rc=124+ text=log.read_text(encoding='utf8',errors='replace');item={'case':name,'command':cmd,'exit':rc,'expected':expected}+ if expected!='success':+ assert rc==(1 if expected=='missing' else 0) and not file.exists(),text[-5000:]+ assert ('cancelled=1' if expected=='cancel' else 'ok=0') in text,text[-5000:]+ else:+ assert rc==0 and 'backend=NVIDIA-VFG' in text and 'SDK submission=graph owner' in text and 'nvenc' in text.lower(),text[-5000:]+ assert not re.search(r'\[ERROR\s*\]|\[FATAL\s*\]|device removed|not alive|substituting',text),text[-5000:]+ data=json.loads(subprocess.check_output([probe,'-v','error','-count_frames','-show_streams','-of','json',str(file)],timeout=30))+ v=next(x for x in data['streams'] if x['codec_type']=='video')+ assert v['codec_name']=='hevc' and int(v['nb_read_frames'])==8*m,data+ tick=int(v['time_base'].split('/')[0])/int(v['time_base'].split('/')[1])+ rate=lambda k:int(v[k].split('/')[0])/int(v[k].split('/')[1])+ assert abs(rate('r_frame_rate')-30*m)<.00001,data+ # MP4 uses integer time-base ticks: an eight-frame clip's rounded duration+ # changes avg_frame_rate slightly even with strictly CFR packet timestamps.+ assert abs(rate('avg_frame_rate')-30*m)<=30*m*tick/(8/30-tick)+1e-9,data+ assert abs(float(v['duration'])-8/30)<=tick+1e-9,data+ for audio in (x for x in data['streams'] if x['codec_type']=='audio'):assert abs(float(audio['duration'])-8/30)<.06,data+ packets=json.loads(subprocess.check_output([probe,'-v','error','-select_streams','v','-show_entries','packet=pts_time','-of','json',str(file)],timeout=30))['packets']+ pts=[float(x['pts_time']) for x in packets];assert len(pts)==8*m and all(b>a and abs(b-a-1/(30*m))<=2*tick+1e-9 for a,b in zip(pts,pts[1:])),pts+ if '--nr' in flags:assert 'nr=1' in text and (v['width'],v['height'])==(3840,2160),text[-5000:]+ item.update(frames=8*m,probe=data,pts=pts)+ results.append(item);(logs/'summary.json').write_text(json.dumps(results,ensure_ascii=False,indent=2),encoding='utf8');print('VFG EXPORT PASS',name,flush=True)+for quality in range(3):+ for multiplier in range(2,9):run(f'720p30-quality{quality}-vfg{multiplier}',source,multiplier,quality)+gta=BASE/'tests/vfg-optimization-20261007/export-v3-verified/gta-4k30-eight-frames.mp4'+assert gta.is_file()+run('gta-4k30-native-nr-vfg4',gta,4,1,('--nr',))+run('cancel-vfg8',source,8,1,('--cancel',),expected='cancel')+run('missing-runtime-vfg8',source,8,1,expected='missing')+print('VFG EXPORT SUITE PASS',len(results),logs,flush=True)++subprocess.run(['python','-B',str(ROOT/'scripts/acceptance/vfg-next-control.py')],cwd=ROOT,check=True)diff --git a/scripts/acceptance/vfg-next-lifecycle.py b/scripts/acceptance/vfg-next-lifecycle.pynew file mode 100644index 00000000..fd117afd--- /dev/null+++ b/scripts/acceptance/vfg-next-lifecycle.py@@ -0,0 +1,64 @@+"""Use the existing product GUI hot-switch/export checks in a private app/profile."""+from pathlib import Path+import argparse,json,os,re,shutil,subprocess,time,psutil+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='vfg-next-20261007';APP=BASE/'tests'/TASK/'app'+p=argparse.ArgumentParser();p.add_argument('label');modes=p.add_mutually_exclusive_group();modes.add_argument('--failure-only',action='store_true');modes.add_argument('--edge-from');a=p.parse_args();assert a.label.replace('-','').isalnum()+if a.edge_from:assert a.edge_from.replace('-','').isalnum()+subprocess.run(['python','-B',str(ROOT/'scripts/acceptance/vfg-next-control.py')],cwd=ROOT,check=True)+assert not any(x.info['name'].lower() in ('veyra.exe','veyra_qml_ui.exe','veyra_vfg_gpu_tests.exe','veyra_vfg_export_probe.exe') for x in psutil.process_iter(['name']))+out,logs,tmp=(BASE/k/TASK/a.label for k in ('tests','logs','tmp'))+for x in (out,logs,tmp):x.mkdir(parents=True,exist_ok=False)+profile=out/'profile'+if a.edge_from:+ prior=BASE/'tests'/TASK/a.edge_from+ receipt=json.loads((BASE/'logs'/TASK/a.edge_from/'summary.json').read_text(encoding='utf8'))+ assert all(any(x['phase']==phase and x['passed'] for x in receipt) for phase in ('run','restore'))+ shutil.copytree(prior/'profile',profile)+else:+ profile.mkdir();(profile/'qml-preferences.v1.json').write_text(json.dumps({'overlayCompat':'off','gpuPriority':'normal','obsGameCapture':False}),encoding='utf8')+outputs=out/'outputs';outputs.mkdir()+media=Path('E:/Ai/知识/小七姐/GTAVI_An_Extended_Look_4K_Native.mp4')+short=BASE/'tests/runtime-size-20261004/export-basic-v2/input.mp4';assert short.is_file()+shutil.copy2(BASE/'build'/TASK/'veyra_qml_ui.exe',APP/'veyra_qml_ui.exe')+env={k:v for k,v in os.environ.items() if not k.startswith(('VEYRA_','QSG_','QT_QUICK_'))}+env.update(TEMP=str(tmp),TMP=str(tmp),CUDA_CACHE_PATH=str(tmp/'cuda-cache'),QML_DISABLE_DISK_CACHE='1',QT_FORCE_STDERR_LOGGING='1')+env['PATH']=os.pathsep.join((env['WINDIR']+'/System32',env['WINDIR'],env['WINDIR']+'/System32/Wbem'))+package=BASE/'releases/release-2.0.6-20261007/packages/Veyra-2.0.6-NVIDIA-win64-portable'+original=(package/'qml/Veyra/Main.qml').read_bytes();source=original.decode('utf8');at=source.rfind('}');main=APP/'qml/Veyra/Main.qml';results=[]+try:+ for phase in (['failure'] if a.failure_only else ['missing','failure'] if a.edge_from else ['run','restore','missing','failure']):+ child=env.copy();data=profile+ child['VEYRA_LOG_FILE']=str(logs/(phase+'-engine.log'))+ if phase in ('missing','failure'):+ data=out/(phase+'-profile');shutil.copytree(profile,data)+ if phase=='missing':child['VEYRA_VFG_RUNTIME']=str(tmp/'missing-runtime')+ if phase=='failure':child['VEYRA_TEST_VFG_REJECT_RUN']='3'+ qml=ROOT/'scripts/acceptance'/('vfg-opt-failure.qml' if phase=='failure' else 'vfg-opt-ui.qml')+ settings='item.media='+json.dumps(str(media))+';'+ if phase!='failure':settings+='item.shortMedia='+json.dumps(str(short))+';item.evidence='+json.dumps(str(out))+';item.phase='+json.dumps(phase)+';'+ loader='\nLoader { source: '+json.dumps(qml.as_uri())+'; onLoaded: { '+settings+' } }\n'+ main.write_text(source[:at]+loader+source[at:],encoding='utf8')+ start=time.monotonic()+ with (logs/(phase+'.log')).open('xb') as f:+ try:rc=subprocess.run([str(APP/'veyra_qml_ui.exe'),'--page','pro','--size','1280x900','--export-out',str(outputs),'--data-dir',str(data),'--exit-after','240000'],cwd=APP,env=child,stdout=f,stderr=subprocess.STDOUT,timeout=270).returncode+ except subprocess.TimeoutExpired:rc=124+ text=(logs/(phase+'.log')).read_text(encoding='utf8',errors='replace')+ marker={'run':'VFG_UI_PASS','restore':'VFG_UI_RESTORE_PASS','missing':'VFG_UI_MISSING_PASS','failure':'VFG_FAILURE_PASS'}[phase]+ engine=(logs/(phase+'-engine.log')).read_text(encoding='utf8',errors='replace')+ results.append({'phase':phase,'exit':rc,'seconds':time.monotonic()-start,'marker':marker,'passed':rc==0 and marker in text and not re.search(r'VFG_UI_FAIL|VFG_FAILURE_FAIL',text)})+ (logs/'summary.json').write_text(json.dumps(results,ensure_ascii=False,indent=2),encoding='utf8')+ assert rc==0 and marker in text and not re.search(r'VFG_UI_FAIL|VFG_FAILURE_FAIL',text),text[-6000:]+ if phase=='failure':assert 'injected VFG Run rejection' in engine and re.search(r'runtime component=6 disabled;.*multiplier=1;',engine),engine[-6000:]+ if phase=='run':+ ids=re.findall(r'\[export-worker\] started jobId=\d+ pid=(\d+)',text);assert len(ids)==1,ids+ worker=APP/'logs'/('export-worker-'+ids[0]+'.log');worker_text=worker.read_text(encoding='utf8',errors='replace')+ assert 'backend=NVIDIA-VFG vfgQuality=2' in worker_text and 'SDK submission=graph owner' in worker_text,worker_text[-4000:]+ shutil.copy2(worker,logs/worker.name)+ print(results[-1],flush=True)+finally:main.write_bytes(original)+if not a.failure_only:+ files=list((prior/'outputs' if a.edge_from else outputs).glob('*.mp4'));assert len(files)==1,files+ probe=json.loads(subprocess.check_output([shutil.which('ffprobe'),'-v','error','-count_frames','-show_streams','-of','json',str(files[0])],timeout=30))+ video=next(x for x in probe['streams'] if x['codec_type']=='video');assert int(video['nb_read_frames'])==64 and video['r_frame_rate']=='240/1',probe+ (logs/'export-probe.json').write_text(json.dumps(probe,indent=2),encoding='utf8')+print('VFG LIFECYCLE PASS',logs,flush=True)diff --git a/scripts/acceptance/vfg-next-native.py b/scripts/acceptance/vfg-next-native.pynew file mode 100644index 00000000..1ccb0329--- /dev/null+++ b/scripts/acceptance/vfg-next-native.py@@ -0,0 +1,24 @@+"""Bounded serial VFG GPU interop/pixel tests; all outputs stay on E:."""+from pathlib import Path+import argparse,json,os,subprocess,time,psutil+ROOT=Path(__file__).resolve().parents[2];BASE=Path('E:/项目/Veyra');TASK='vfg-next-20261007'+p=argparse.ArgumentParser();p.add_argument('label');p.add_argument('--width',type=int,default=1280);p.add_argument('--height',type=int,default=720);p.add_argument('--async-submit',action='store_true');p.add_argument('--original',action='store_true');p.add_argument('--per-frame-producer',action='store_true');a=p.parse_args()+assert a.label.replace('-','').isalnum()+subprocess.run(['python','-B',str(ROOT/'scripts/acceptance/vfg-next-control.py')],cwd=ROOT,check=True)+assert not any(x.info['name'].lower() in ('veyra.exe','veyra_qml_ui.exe','veyra_vfg_gpu_tests.exe','veyra_vfg_export_probe.exe') for x in psutil.process_iter(['name']))+log=BASE/'logs'/TASK/(a.label+'.log');out=BASE/'tests'/TASK/a.label;tmp=BASE/'tmp'/TASK/a.label+for x in (out,tmp):x.mkdir(parents=True,exist_ok=False)+env={k:v for k,v in os.environ.items() if not k.startswith(('VEYRA_','QSG_','QT_QUICK_'))}+env.update(TEMP=str(tmp),TMP=str(tmp),CUDA_CACHE_PATH=str(tmp/'cuda-cache'))+env['PATH']=os.pathsep.join((env['WINDIR']+'/System32',env['WINDIR'],env['WINDIR']+'/System32/Wbem'))+exe=BASE/('build/release-2.0.6-20261007' if a.original else 'build/'+TASK)/'veyra_vfg_gpu_tests.exe'+if a.per_frame_producer:env['VEYRA_TEST_VFG_PER_FRAME_PRODUCER']='1'+cmd=[str(exe),str(BASE/'tests'/TASK/'app/runtime/nvidia-vfg'),str(a.width),str(a.height)]+if a.async_submit:cmd.append('async')+start=time.monotonic()+with log.open('x',encoding='utf8') as f:+ try:rc=subprocess.run(cmd,cwd=out,env=env,stdout=f,stderr=subprocess.STDOUT,timeout=290).returncode+ except subprocess.TimeoutExpired:rc=124+receipt={'command':cmd,'exit':rc,'seconds':time.monotonic()-start,'log':str(log)}+log.with_suffix('.json').write_text(json.dumps(receipt,ensure_ascii=False,indent=2),encoding='utf8')+print(receipt);print('\n'.join(log.read_text(encoding='utf8',errors='replace').splitlines()[-15:]));raise SystemExit(rc)diff --git a/scripts/acceptance/vfg-next-preview.py b/scripts/acceptance/vfg-next-preview.pynew file mode 100644index 00000000..15a3e425--- /dev/null+++ b/scripts/acceptance/vfg-next-preview.py@@ -0,0 +1,103 @@+"""Serial production VFG measurements; private profile/staging, normal playback only."""+from pathlib import Path+import argparse, ctypes, hashlib, json, os, re, shutil, statistics, subprocess, sys, time+from ctypes import wintypes+import psutil++ROOT=Path(__file__).resolve().parents[2]+BASE=Path('E:/项目/Veyra'); TASK='vfg-next-20261007'+PACKAGE=BASE/'releases/release-2.0.6-20261007/packages/Veyra-2.0.6-NVIDIA-win64-portable'+APP=BASE/'tests'/TASK/'app'+MEDIA=Path('E:/Ai/知识/小七姐/GTAVI_An_Extended_Look_4K_Native.mp4')+EXPECTED_EXE='acd49a23074b58ec9698d260d63b2d5a59a640627e09a9b83f0127ae47ebb936'++def sha(path):+ with Path(path).open('rb') as stream:return hashlib.file_digest(stream,'sha256').hexdigest()++def save(path,data):+ path.parent.mkdir(parents=True,exist_ok=True)+ path.write_text(json.dumps(data,ensure_ascii=False,indent=2),encoding='utf8')++def inherited_state():+ entries=[]+ for line in subprocess.check_output(['git','worktree','list','--porcelain'],cwd=ROOT,encoding='utf8').splitlines():+ if line.startswith('worktree '):+ path=Path(line[9:])+ if path.resolve()==ROOT.resolve():continue+ status=subprocess.check_output(['git','status','--porcelain=v1','-z','--untracked-files=all'],cwd=path)+ changes=[]+ names=subprocess.check_output(['git','ls-files','-m','-o','--exclude-standard','-z'],cwd=path).split(b'\0')+ for name in sorted(set(x for x in names if x)):+ file=path/os.fsdecode(name)+ changes.append({'path':os.fsdecode(name),'sha256':sha(file) if file.is_file() else None})+ entries.append({'path':str(path),'head':subprocess.check_output(['git','rev-parse','HEAD'],cwd=path,encoding='ascii').strip(),'statusHex':status.hex(),'changes':changes})+ return entries++def gpu():+ return subprocess.check_output(['nvidia-smi','--query-gpu=utilization.gpu,memory.used,clocks.current.graphics,power.draw','--format=csv,noheader,nounits'],encoding='utf8',timeout=8).strip()++def run(args):+ assert re.fullmatch(r'[a-z0-9-]+',args.label)+ for proc in psutil.process_iter(['pid','name']):+ assert proc.info['name'].lower() not in ('veyra.exe','veyra_qml_ui.exe'),f'Existing player PID {proc.pid}; no concurrent GPU runs'+ global EXPECTED_EXE+ selected=PACKAGE/'veyra_qml_ui.exe' if args.original else BASE/'build'/TASK/'veyra_qml_ui.exe'+ EXPECTED_EXE=sha(selected);shutil.copy2(selected,APP/'veyra_qml_ui.exe')+ assert sha(APP/'veyra_qml_ui.exe')==EXPECTED_EXE+ out=BASE/'logs'/TASK/args.label;profile=BASE/'tests'/TASK/args.label/'profile';tmp=BASE/'tmp'/TASK/args.label+ for path in (out,profile,tmp):path.mkdir(parents=True,exist_ok=False)+ save(profile/'qml-preferences.v1.json',{'overlayCompat':'off','gpuPriority':'normal','decode':'auto','reducedMotion':False,'obsGameCapture':False})+ config={'media':MEDIA.as_posix(),'multiplier':args.multiplier,'quality':args.quality,'nr':not args.no_nr,'strict':args.strict,'flow':args.flow,'display':0 if args.tearing else 2,'seconds':args.seconds}+ text=(ROOT/'qml/Veyra/Main.qml').read_text(encoding='utf8');at=text.rfind('}')+ loader='\nLoader { source: "VfgDiagnosis.qml"; onLoaded: item.config='+json.dumps(config,ensure_ascii=True)+' }\n'+ (APP/'qml/Veyra/Main.qml').write_text(text[:at]+loader+text[at:],encoding='utf8')+ env=os.environ.copy()+ for key in list(env):+ if key.upper().startswith(('VEYRA_','QT_','QSG_')):env.pop(key)+ env.update(TEMP=str(tmp),TMP=str(tmp),CUDA_CACHE_PATH=str(tmp/'cuda-cache'),QML_DISABLE_DISK_CACHE='1',QT_FORCE_STDERR_LOGGING='1',VEYRA_LOG_FILE=str(out/'player.log'))+ if not args.no_verbose:env['VEYRA_VERBOSE_FRAME_LOGS']='1'+ if args.cpu_profile:env['VEYRA_TEST_VFG_CPU_PROFILE']='1'+ if args.sync_submit:env['VEYRA_TEST_VFG_SYNC_SUBMIT']='1'+ if args.per_frame_producer:env['VEYRA_TEST_VFG_PER_FRAME_PRODUCER']='1'+ if args.no_reduced:env['VEYRA_TEST_FG_NO_REDUCED']='1'+ if args.software:env['QT_QUICK_BACKEND']='software'+ receipt={'config':config,'exeSha256':EXPECTED_EXE,'gpuBefore':gpu(),'noReduced':args.no_reduced,'softwareUi':args.software,'verboseFrameLogs':not args.no_verbose,'cpuProfile':args.cpu_profile,'syncSubmit':args.sync_submit,'perFrameProducer':args.per_frame_producer,'selectedBinary':str(selected)}+ started=time.monotonic();meters=[]+ with (out/'console.log').open('xb') as stream:+ proc=subprocess.Popen([str(APP/'veyra_qml_ui.exe'),'--data-dir',str(profile),'--page','pro','--size','1280x800','--exit-after','135000'],cwd=APP,env=env,stdout=stream,stderr=subprocess.STDOUT)+ receipt['pid']=proc.pid+ try:+ while proc.poll() is None and time.monotonic()-started<145:+ meters.append({'elapsed':time.monotonic()-started,'gpu':gpu()});time.sleep(1)+ if proc.poll() is None:proc.kill();proc.wait(timeout=10);rc=124+ else:rc=proc.returncode+ finally:+ if proc.poll() is None:proc.kill();proc.wait(timeout=10)+ text=(out/'player.log').read_text(encoding='utf8',errors='replace');rows=[]+ for line in text.splitlines():+ if 'VFG_DIAG_SAMPLE ' in line:+ row=json.loads(line.split('VFG_DIAG_SAMPLE ',1)[1])+ if row['ready'] and 5<=row['seconds']<=args.seconds+5:rows.append(row)+ stages={}+ for name in sorted({stage['label'] for row in rows for stage in row['stages'] if stage['measured']}):+ values=[stage['ms'] for row in rows for stage in row['stages'] if stage['label']==name and stage['measured']]+ stages[name]={'medianOneSecondMeansMs':statistics.median(values),'min':min(values),'max':max(values)}+ median=lambda key:statistics.median([r[key] for r in rows]) if rows else None+ receipt.update(exitCode=rc,wallSeconds=time.monotonic()-started,passed=rc==0 and 'VFG_DIAG_PASS' in text and 'VFG_DIAG_FAIL' not in text and len(rows)>=args.seconds-3,observations=len(rows),fps=median('fps'),totalMs=median('total'),budgetMs=median('budget'),gpuPercent=median('gpu'),status=sorted({r['status'] for r in rows}),detail=sorted({r['detail'] for r in rows}),stages=stages,errors=[line for line in text.splitlines() if any(x in line for x in ('[ERROR]','[FATAL]','TypeError:','ReferenceError:'))])+ receipt['normalSchedulingClass']=[line for line in text.splitlines() if 'priority' in line.lower()][:5]+ for name,data in [('result',receipt),('samples',rows),('meters',meters)]:save(out/(name+'.json'),data)+ print(json.dumps(receipt,ensure_ascii=False),flush=True)+ if not receipt['passed']:+ print('\n'.join(text.splitlines()[-20:]));raise SystemExit(1)++parser=argparse.ArgumentParser();parser.add_argument('mode',choices=['case']);parser.add_argument('label',nargs='?')+parser.add_argument('--multiplier',type=int,choices=range(2,9),default=2);parser.add_argument('--quality',type=int,choices=range(3),default=1)+parser.add_argument('--no-nr',action='store_true');parser.add_argument('--strict',action='store_true');parser.add_argument('--flow',action='store_true');parser.add_argument('--tearing',action='store_true');parser.add_argument('--no-reduced',action='store_true');parser.add_argument('--software',action='store_true');parser.add_argument('--no-verbose',action='store_true');parser.add_argument('--seconds',type=int,default=20)+parser.add_argument('--original',action='store_true');parser.add_argument('--cpu-profile',action='store_true')+parser.add_argument('--sync-submit',action='store_true');parser.add_argument('--per-frame-producer',action='store_true')+args=parser.parse_args()++subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/vfg-next-control.py')],check=True)+run(args)+shutil.copyfile(ROOT/'qml/Veyra/Main.qml',APP/'qml/Veyra/Main.qml')+subprocess.run([sys.executable,'-B',str(ROOT/'scripts/acceptance/vfg-next-control.py')],check=True)diff --git a/src/pipeline/VfgBackend.cpp b/src/pipeline/VfgBackend.cppindex 2f446727..ca818f36 100644--- a/src/pipeline/VfgBackend.cpp+++ b/src/pipeline/VfgBackend.cpp@@ -114,7 +114,12 @@ struct VfgBackend::Impl {uint64_t inputRevision=0,boundInputRevision=0;unsigned boundParity=2,boundMultiplier=0;bool boundReset=false;- struct Job {unsigned parity,sub,multiplier;bool reset;uint64_t revision,value;};+ struct Job {unsigned parity,sub,multiplier;bool reset;uint64_t revision,value,producerValue;};+ // Owner-thread state is separate from the worker's SDK input binding. A+ // monotonic subframe sequence reads one immutable pair and writes distinct+ // outputs; new/repeated sequences must first drain the previous consumers.+ Job submitted{};+ bool haveSubmitted=false,perFrameProducer=false;std::array<std::atomic<SubmissionState>,kOutputs> states{};std::atomic<bool> failed=false;std::mutex jobsMutex,profileMutex;@@ -196,10 +201,13 @@ struct VfgBackend::Impl {buffer.resource.Reset();}bool cudaJob(const Job& job){- const auto [parity,sub,multiplier,reset,revision,value]=job;+ const auto [parity,sub,multiplier,reset,revision,value,producerValue]=job;Current current(*this);if(!current.active)return false;- CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS wait{};wait.params.fence.value=value;- bool ok=cu(cpuCall(2,[&]{return cuWaitExternalSemaphoresAsyncFn(&inputSemaphore,&wait,1,stream);}),"cuWaitExternalSemaphoresAsync")&&!failed.load();+ bool ok=!failed.load();+ if(producerValue){+ CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS wait{};wait.params.fence.value=producerValue;+ ok=cu(cpuCall(2,[&]{return cuWaitExternalSemaphoresAsyncFn(&inputSemaphore,&wait,1,stream);}),"cuWaitExternalSemaphoresAsync")&&ok;+ }// NVIDIA MIT sample, commit 52011f89c1741d06b40ea312af1f20be8be9ec62,// VideoFrameGenerationEffectApp: both input images must be rebound for// each NEW pair, even when their pointers are unchanged. Rebinding for@@ -259,10 +267,18 @@ struct VfgBackend::Impl {}bool handoff(unsigned parity,unsigned sub,unsigned multiplier,bool reset){const unsigned slot=parity+2*(sub-1);+ const bool newDependency=perFrameProducer||!haveSubmitted||inputRevision!=submitted.revision||+ parity!=submitted.parity||reset!=submitted.reset||multiplier!=submitted.multiplier||sub<=submitted.sub;+ // The producer signal for a NEW pair follows capture and the preceding+ // pair's output copies on the direct queue. Later subframes use distinct+ // output buffers on the same serial CUDA stream, so waiting for each+ // preceding D3D copy would unnecessarily serialize the two queues.+ // Repeated/backward indices retain that dependency for safe slot reuse.if(!asynchronous){const uint64_t value=++signalValue;- if(!hr(cpuCall(1,[&]{return context->directQueue()->Signal(producer.Get(),value);}),"signal VFG producer"))return false;- const bool ok=cudaJob({parity,sub,multiplier,reset,inputRevision,value});+ if(newDependency&&!hr(cpuCall(1,[&]{return context->directQueue()->Signal(producer.Get(),value);}),"signal VFG producer"))return false;+ const Job job{parity,sub,multiplier,reset,inputRevision,value,newDependency?value:0};+ const bool ok=cudaJob(job);if(!ok){failed.store(true);Current current(*this);if(current.active&&stream)cu(cuStreamSynchronizeFn(stream),"rejected synchronous job drain");@@ -270,6 +286,7 @@ struct VfgBackend::Impl {}states[slot].store(ok?SubmissionState::Succeeded:SubmissionState::Failed);if(!hr(cpuCall(11,[&]{return context->directQueue()->Wait(completion.Get(),value);}),"queue wait VFG completion"))return false;+ if(ok){submitted=job;haveSubmitted=true;}logCpu();return ok;}std::lock_guard lock(jobsMutex);@@ -277,13 +294,15 @@ struct VfgBackend::Impl {log::error("vfg","bounded VFG submission rejected; no GPU wait queued");return false;}const uint64_t value=++signalValue;- if(!hr(cpuCall(1,[&]{return context->directQueue()->Signal(producer.Get(),value);}),"signal VFG producer"))return false;+ if(newDependency&&!hr(cpuCall(1,[&]{return context->directQueue()->Signal(producer.Get(),value);}),"signal VFG producer"))return false;// Allocate the queue entry before adding a GPU dependency. Even a host// allocation exception cannot leave a wait with no job to signal it.- jobs.push_back({parity,sub,multiplier,reset,inputRevision,value});+ const Job job{parity,sub,multiplier,reset,inputRevision,value,newDependency?value:0};+ jobs.push_back(job);if(!hr(cpuCall(11,[&]{return context->directQueue()->Wait(completion.Get(),value);}),"queue wait VFG completion")){jobs.pop_back();return false;}+ submitted=job;haveSubmitted=true;states[slot].store(SubmissionState::Pending);++outstanding;jobsChanged.notify_one();return true;}void stopWorker(){@@ -305,6 +324,7 @@ bool VfgBackend::initialize(gfx::D3D12DeviceContext& context,const std::wstring&}p.context=&context;p.width=width;p.height=height;p.format=format;p.maxMultiplier=multiplier;p.profileCpu=GetEnvironmentVariableW(L"VEYRA_TEST_VFG_CPU_PROFILE",nullptr,0)>0;+ p.perFrameProducer=GetEnvironmentVariableW(L"VEYRA_TEST_VFG_PER_FRAME_PRODUCER",nullptr,0)>0;wchar_t reject[16]{};const auto rejectLength=GetEnvironmentVariableW(L"VEYRA_TEST_VFG_REJECT_RUN",reject,16);if(rejectLength&&rejectLength<16)p.rejectRun=unsigned(std::clamp(_wtoi(reject),0,1000000));@@ -380,6 +400,7 @@ bool VfgBackend::initialize(gfx::D3D12DeviceContext& context,const std::wstring&!p.cv(p.loadEffect(p.effect),"NvVFX_Load")||!p.cv(p.setImage(p.effect,"DstImage0",p.outputs[0].image),"initial output")||!p.cv(p.setU32(p.effect,"FrameMultiplier",multiplier),"initial multiplier"))return false;p.boundMultiplier=multiplier;+ log::info("vfg",std::format("input dependency={}; completion remains per output",p.perFrameProducer?"per output (test control)":"per input pair"));p.asynchronous=asynchronousSubmission;if(p.asynchronous){try{p.worker=std::thread([&p]{p.work();});}diff --git a/tests/integration/VfgGpuTests.cpp b/tests/integration/VfgGpuTests.cppindex 04e30ff7..eb81887b 100644--- a/tests/integration/VfgGpuTests.cpp+++ b/tests/integration/VfgGpuTests.cpp@@ -160,6 +160,58 @@ int wmain(int argc,wchar_t** argv){}std::puts("");readback->Unmap(0,&written);}+ // Queue fresh contents and begin at index 2, then repeat/backtrack+ // without a CPU drain. A pair-only producer dependency must still+ // protect reused output slots and input-address refreshes.+ const auto refresh=[&](bool reverse){+ for(unsigned p=0;p<2;++p){+ auto* l=ring.acquireNext(slot,st);if(!l)return false;+ auto* texture=textures[reverse?1-p:p].Get();+ transition(l,texture,D3D12_RESOURCE_STATE_COMMON,D3D12_RESOURCE_STATE_COPY_SOURCE);+ if(!vfg.capture(l,texture,p))return false;+ transition(l,texture,D3D12_RESOURCE_STATE_COPY_SOURCE,D3D12_RESOURCE_STATE_COMMON);+ if(!ring.submitAndSignal(slot))return false;+ }return true;+ };+ const auto consume=[&](unsigned sub,unsigned readbackSlot){+ if(!vfg.generate(1,sub,4,false))return false;+ auto* l=ring.acquireNext(slot,st);if(!l)return false;+ transition(l,output.Get(),D3D12_RESOURCE_STATE_COMMON,D3D12_RESOURCE_STATE_COPY_DEST);+ if(!vfg.copyOutput(l,output.Get(),1+2*(sub-1)))return false;+ transition(l,output.Get(),D3D12_RESOURCE_STATE_COPY_DEST,D3D12_RESOURCE_STATE_COPY_SOURCE);+ D3D12_TEXTURE_COPY_LOCATION from{};from.pResource=output.Get();from.Type=D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;+ D3D12_TEXTURE_COPY_LOCATION to{};to.pResource=readback.Get();to.Type=D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;to.PlacedFootprint=fp;to.PlacedFootprint.Offset=readbackSlot*bytes;+ l->CopyTextureRegion(&to,0,0,0,&from,nullptr);+ transition(l,output.Get(),D3D12_RESOURCE_STATE_COPY_SOURCE,D3D12_RESOURCE_STATE_COMMON);+ return ring.submitAndSignal(slot);+ };+ check(refresh(false),"fresh pair before non-first subframe");+ const std::array<unsigned,5> sequence={2,3,2,1,2};+ for(unsigned i=0;i<sequence.size();++i)check(consume(sequence[i],i),"non-first/repeated/backward subframe queued");+ check(refresh(true),"input pair refreshed while earlier outputs pending");+ check(consume(3,5)&&consume(2,6),"refreshed input starts at index 3 and reuses output slot");+ check(ring.waitIdle(),"edge sequence GPU completion");+ range={0,size_t(bytes*7)};if(FAILED(readback->Map(0,&range,&pixels)))return 2;+ const auto equalPixels=[&](unsigned a,unsigned b){+ for(unsigned y=0;y<h;++y)+ if(std::memcmp(static_cast<uint8_t*>(pixels)+a*bytes+y*fp.Footprint.RowPitch,static_cast<uint8_t*>(pixels)+b*bytes+y*fp.Footprint.RowPitch,w*4))return false;+ return true;+ };+ check(equalPixels(0,2)&&equalPixels(0,4),"repeated index preserves every pixel despite queued slot reuse");+ check(!equalPixels(0,1)&&!equalPixels(0,3),"non-first group still produces distinct intermediate frames");+ std::array<double,7> centers{};+ for(unsigned i=0;i<centers.size();++i){double sum=0,weight=0;+ for(unsigned y=0;y<h;++y)for(unsigned x=0;x<w;++x){+ const auto* pixel=static_cast<uint8_t*>(pixels)+i*bytes+y*fp.Footprint.RowPitch+x*4;+ unsigned red=pixel[0];if(format!=DXGI_FORMAT_R8G8B8A8_UNORM){uint32_t packed=0;std::memcpy(&packed,pixel,4);red=(packed&1023)*255/1023;}+ const double v=red>40?red-16:0;sum+=v;weight+=v*x;+ }centers[i]=sum?weight/sum:-1;+ check(centers[i]>inputCentroid[0]-1&¢ers[i]<inputCentroid[1]+1,"edge sequence remains inside current A/B pair");+ }+ check(centers[3]<centers[0]&¢ers[0]<centers[1],"non-first input follows forward motion");+ check(centers[5]<centers[6],"mid-sequence refreshed input follows reversed motion");+ std::printf("VFG_EDGE format=%u quality=%u centers=",unsigned(format),quality);for(double center:centers)std::printf("%.3f,",center);std::puts("");+ readback->Unmap(0,&written);check(!vfg.generate(1,8,8,false)&&!vfg.generate(2,1,2,false)&&!vfg.generate(0,1,9,false),"invalid slot/multiplier rejected");vfg.shutdown();}