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

revert(perf): restore paused presentation after OBS capture regression

Veyra Goal Agent5ede7f6a42ed
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0b36528d..a01ab3e0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1031,10 +1031,6 @@ add_executable(veyra_sr_reconstruction_tests tests/integration/SrReconstructionT
target_compile_features(veyra_nr_paused_residual_experiment PRIVATE cxx_std_20)
target_compile_options(veyra_nr_paused_residual_experiment PRIVATE /utf-8)
target_link_libraries(veyra_nr_paused_residual_experiment PRIVATE veyra_engine bcrypt)
- add_executable(veyra_paused_present_experiment tests/perf/PausedPresentExperiment.cpp)
- target_compile_features(veyra_paused_present_experiment PRIVATE cxx_std_20)
- target_compile_options(veyra_paused_present_experiment PRIVATE /utf-8)
- target_link_libraries(veyra_paused_present_experiment PRIVATE veyra_engine)
add_executable(veyra_nr_gpu_competition_load tests/perf/NrGpuCompetitionLoad.cpp)
target_compile_features(veyra_nr_gpu_competition_load PRIVATE cxx_std_20)
target_compile_options(veyra_nr_gpu_competition_load PRIVATE /utf-8)
diff --git a/apps/veyra-qml/main.cpp b/apps/veyra-qml/main.cpp
index 4f6462ff..dd1948e6 100644
--- a/apps/veyra-qml/main.cpp
+++ b/apps/veyra-qml/main.cpp
@@ -665,8 +665,6 @@ static int runApplication(int argc, char** argv, QString& restartProgram, QStrin
const QStringList args = QCoreApplication::arguments();
QString openPath;
QVariantMap testOptions;
- if(qEnvironmentVariableIsSet("VEYRA_TEST_DISABLE_PAUSED_UI_IDLE"))
- testOptions.insert(QStringLiteral("disablePausedUiIdle"),true);
QSize testSize;
// --exit-after: see the switch table. 0 means "run until closed".
int exitAfterMs = 0;
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index 2d29fb8d..907df565 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -8348,3 +8348,5 @@ R0-candidate eb8b1a2已存档,bundle da0440b9229a8bcbc4c6a918d1cdeac38b3372ae4
退出修复04a0fc3构建v1因Agent填错未知target veyra_export_queue_worker失败,未编译产品;v2改真实veyra_export_workflow_tests,18步成功。新UI EXE c512b8782eb86f70c584a6c1bb87c918af648c0b3aee77cf04a2b0967a628464;R0-exit-contracts-v1 repair/真实PresentSink三轮failed-open/reopen重复清理2/2通过,debugErrors=0;R0-close-fixed-v1七个实际Qt退出(FSR/XeSS/VFG/SF-v2尺寸层数/停止)全exit0、六次真实长创建后取消,无泄漏/交换链错误。原before A/B崩溃日志与dmp不删。
OBS正常功能R0发现阻塞:v1 API207未ready修正有界重试;v3软件兼容六场景通过/截图已看/用户OBS配置未变。GPU界面v2/v4均全屏黑图;基线A两轮通过且全屏原图有真实视频。paused-present-off、基线QML、退出修复前EXE均不能消除;B2d阶段失败、B2a核心阶段通过、B5c暂停空闲阶段resize失败。非压力/性能测试,所有阶段同M1/单NR/源码截图与录像/原用户配置不变。先存档本失败候选,再恢复5c旧呈现语义;NR残差复用独立保留,暂停0.011%旧数据暂不作为最终保留收益。详PERF_R0_ACCEPTANCE及E:/项目/Veyra/logs/perf-nr-20261004/R0-obs-*。
+
+R0-obs-candidate 92a181f/bundle708e4834c19078b50d33203ea0963255f3c1425fe9edae41413e93dba48d4f27已归档。最小恢复c593679暂停呈现生产部分:移除RetainedFrame/跳过Present/提前取view,回到resize后取view及50ms重复呈现;恢复ProPage旧动画并移除相关测试hook。退出取消/借用queue修复、限定3c、NR残差复用及Auto均保留。退役仅服务此候选的nr-present/PausedPresentExperiment和CMake target,完整源码可从c593679及既有before/candidate/accepted tags回放。此为待验证恢复候选,不提前把OBS标通过、不复用旧0.011%收益。
diff --git a/include/veyra/engine/VideoPresenter.h b/include/veyra/engine/VideoPresenter.h
index b9fde910..eb5b35b1 100644
--- a/include/veyra/engine/VideoPresenter.h
+++ b/include/veyra/engine/VideoPresenter.h
@@ -8,7 +8,6 @@
#include "veyra/engine/PresentationSettings.h"
#include <chrono>
#include <array>
-#include <optional>
namespace veyra::gfx { class D3D12DeviceContext; class CommandSlotRing; }
namespace veyra::pipeline { class EnhanceGraph; }
namespace veyra::sink { struct RgbaImage; }
@@ -20,7 +19,7 @@ public:
// source (file playback). Retained for diagnostics; XeLL low latency must
// stay enabled or the provider refuses generation (result -15).
bool open(gfx::D3D12DeviceContext&, HWND, pipeline::EnhanceGraph&, bool captureCompatible=false, bool mediaClockPaced=false);
- bool present(gfx::D3D12DeviceContext&,gfx::CommandSlotRing&,pipeline::EnhanceGraph&,unsigned slot,bool generated,bool referencesValid=true,int comparison=0,bool baseReference=false,float split=.5f,pipeline::FrameIdentity identity={},PreviewView view={},int64_t sourcePts100ns=-1,bool retainUnchanged=false);
+ bool present(gfx::D3D12DeviceContext&,gfx::CommandSlotRing&,pipeline::EnhanceGraph&,unsigned slot,bool generated,bool referencesValid=true,int comparison=0,bool baseReference=false,float split=.5f,pipeline::FrameIdentity identity={},PreviewView view={},int64_t sourcePts100ns=-1);
void close();
// Present-sink providers (XeSS) block inside Present while pacing
// their generated frames. A helper-thread Present was tried on
@@ -84,18 +83,6 @@ private:
Microsoft::WRL::ComPtr<ID3D12DescriptorHeap> rtvs_;
unsigned inc_=0;
unsigned lastBuffer_=0;bool hasPresented_=false;
- struct RetainedFrame {
- ID3D12Fence* producer=nullptr;
- uint64_t fence=0;
- unsigned slot=0,width=0,height=0;
- bool generated=false,referencesValid=false,baseReference=false,visible=false;
- int comparison=0;float split=.5f;
- PreviewView view{};
- pipeline::FrameIdentity identity{};
- HMONITOR monitor=nullptr;
- bool operator==(const RetainedFrame&)const=default;
- };
- std::optional<RetainedFrame> retainedFrame_;
HWND window_=nullptr;
std::chrono::steady_clock::time_point lastResize_{};
unsigned viewWidth_=0,viewHeight_=0;
diff --git a/qml/Veyra/ProPage.qml b/qml/Veyra/ProPage.qml
index 9314a492..8f4f5700 100644
--- a/qml/Veyra/ProPage.qml
+++ b/qml/Veyra/ProPage.qml
@@ -179,9 +179,7 @@ VPage {
property real shown: known ? Math.min(1, Math.max(0, fraction)) : 0
// Live data changes every second; animating it behind another page redrew the
// window continuously (see VDot.qml), so only while shown.
- // Paused telemetry still updates, but it does not need a 600 ms canvas
- // animation every second. Keep live playback and user edits responsive.
- Behavior on shown { enabled: orb.visible && (!veyra.paused || (typeof vyTest !== "undefined" && vyTest.disablePausedUiIdle === true)); NumberAnimation { duration: Theme.d(600); easing.bezierCurve: Theme.springSoft } }
+ Behavior on shown { enabled: orb.visible; NumberAnimation { duration: Theme.d(600); easing.bezierCurve: Theme.springSoft } }
onShownChanged: ring.requestPaint()
onToneChanged: ring.requestPaint()
Canvas {
diff --git a/scripts/perf/nr-present.py b/scripts/perf/nr-present.py
deleted file mode 100644
index e17ef955..00000000
--- a/scripts/perf/nr-present.py
+++ /dev/null
@@ -1,33 +0,0 @@
-"""Owned native backbuffer idle/invalidation experiment, enabled/off paired."""
-from pathlib import Path
-import importlib.util
-import json
-import os
-import shutil
-import subprocess
-import 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');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_paused_present_experiment.exe';shutil.copy2(BASE/'build'/TASK/variant/exe.name,exe);results=[];reference=None
-for mode in ('enabled','off'):
- for repeat in range(1,4):
- matrix.assert_gpu_tests_idle();name=f'{label}-{mode}-r{repeat}';out=BASE/'logs'/TASK/name;tmp=BASE/'tmp'/TASK/name
- out.mkdir(parents=True,exist_ok=False);tmp.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))
- if mode=='off':env['VEYRA_TEST_DISABLE_PAUSED_PRESENT_REUSE']='1'
- print('START',name,flush=True)
- with (out/'console.log').open('xb') as log:
- proc=subprocess.run([str(exe),str(matrix.SOURCES['M1']),str(out)],cwd=app,env=env,stdout=log,stderr=subprocess.STDOUT,timeout=280)
- text=(out/'console.log').read_text(encoding='utf-8',errors='replace');files={p.name:matrix.digest(p) for p in out.glob('*.rgba')}
- if reference is None:reference=files
- result={'mode':mode,'repeat':repeat,'exitCode':proc.returncode,'exeSha256':matrix.digest(exe),'imagesSha256':files,
- 'differentImages':sum(reference[k]!=v for k,v in files.items()),'passed':proc.returncode==0 and 'RESULT pass=1' in text and files==reference and len(files)==8}
- (out/'result.json').write_text(json.dumps(result,indent=2),encoding='utf-8');results.append(result);print('RESULT',name,json.dumps(result),flush=True)
- if not result['passed']:print(text[-6000:],flush=True);raise SystemExit(1)
-with (BASE/'logs'/TASK/(label+'-summary.json')).open('x',encoding='utf-8') as f:json.dump(results,f,indent=2)
diff --git a/src/engine/EngineController.cpp b/src/engine/EngineController.cpp
index df2eea55..7125ff74 100644
--- a/src/engine/EngineController.cpp
+++ b/src/engine/EngineController.cpp
@@ -1408,10 +1408,10 @@ void EngineController::run(HWND window,std::wstring path,PlayerOptions options,s
}
if(audioStarted)audioPipe.setPaused(true);wasPaused=true;
const bool referencesValid=hasOutput&&out.batch.count&&out.batch.frames[out.batch.count-1].lease&&out.batch.frames[out.batch.count-1].lease->referencesValid;
- if(hasOutput&&!presenter.present(ctx,ring,*graph,out.videoSlot,false,referencesValid,comparisonMode_,comparisonBase_,comparisonSplit_,out.batch.identity,previewView(),-1,true)){if(recoverXessPresentation())continue;status(L"画面呈现失败",true);break;}
+ if(hasOutput&&!presenter.present(ctx,ring,*graph,out.videoSlot,false,referencesValid,comparisonMode_,comparisonBase_,comparisonSplit_,out.batch.identity,previewView())){if(recoverXessPresentation())continue;status(L"画面呈现失败",true);break;}
if(hasOutput&&graph->resolveGeneration(out))completeReset(out.batch.identity);
- // Poll live view/size changes at 50 ms; unchanged flip
- // buffers are retained without commands or another Present.
+ // Preserve the established 50 ms paused presentation path;
+ // the idle-buffer candidate failed R0 OBS GPU capture.
std::this_thread::sleep_for(std::chrono::milliseconds(refreshPausedFrame_?1:50));continue;
}
if(wasPaused&&!paused_){holdFileAudio();audioRebuffering=false;if(audioStarted)audioPipe.setPaused(false);anchor=Clock::now();anchorMs=out.ptsMs;reset=true;pendingResetCause=pipeline::ResetReason::PauseResume;wasPaused=false;}
diff --git a/src/engine/VideoPresenter.cpp b/src/engine/VideoPresenter.cpp
index bd38b54f..55181ff4 100644
--- a/src/engine/VideoPresenter.cpp
+++ b/src/engine/VideoPresenter.cpp
@@ -96,7 +96,7 @@ bool VideoPresenter::open(gfx::D3D12DeviceContext& ctx,HWND window,pipeline::Enh
return true;
}
void VideoPresenter::refresh(ID3D12Device* device){for(unsigned i=0;i<3;++i){Microsoft::WRL::ComPtr<ID3D12Resource> bb;if(SUCCEEDED(sink_.swapChain()->GetBuffer(i,IID_PPV_ARGS(&bb))))device->CreateRenderTargetView(bb.Get(),nullptr,{rtvs_->GetCPUDescriptorHandleForHeapStart().ptr+size_t(i)*inc_});}}
-bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing& sharedRing,pipeline::EnhanceGraph& graph,unsigned slot,bool generated,bool referencesValid,int comparison,bool baseReference,float split,pipeline::FrameIdentity identity,PreviewView view,int64_t sourcePts100ns,bool retainUnchanged) {
+bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing& sharedRing,pipeline::EnhanceGraph& graph,unsigned slot,bool generated,bool referencesValid,int comparison,bool baseReference,float split,pipeline::FrameIdentity identity,PreviewView view,int64_t sourcePts100ns) {
auto& ring=presentationQueue_?presentationRing_:sharedRing;
auto* fence=presentationFence_?presentationFence_.Get():ctx.fence();
const auto presentStart=std::chrono::steady_clock::now();
@@ -125,18 +125,6 @@ bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing&
// stretch current buffers there instead of repeatedly draining the GPU
// and rebuilding provider resources at monitor/DPI boundaries.
const bool windowChanging=GetPropW(window_,L"Veyra.InteractiveMove")||GetPropW(window_,L"Veyra.DpiTransition");
- view=filmPixelAlignedView(window_,rc.right,rc.bottom,graph.workWidth(),graph.workHeight(),view);
- const RetainedFrame retained{graph.presentationReadyFenceObject(slot,generated),graph.presentationReadyFence(slot,generated),
- slot,unsigned(rc.right),unsigned(rc.bottom),generated,referencesValid,baseReference,IsWindowVisible(window_)!=FALSE,
- comparison,split,view,identity,MonitorFromWindow(window_,MONITOR_DEFAULTTONEAREST)};
- // Pausing keeps the last flip-model buffer visible. Re-submit only when
- // its producer fence, view, comparison, visibility, monitor or size changes.
- // Deferred resize must keep polling until the actual buffers match.
- if(retainUnchanged&&retained.producer&&retained.fence&&retainedFrame_&&*retainedFrame_==retained&&
- !windowChanging&&targetWidth==sink_.width()&&targetHeight==sink_.height()&&
- SUCCEEDED(ctx.device()->GetDeviceRemovedReason())&&
- !GetEnvironmentVariableW(L"VEYRA_TEST_DISABLE_PAUSED_PRESENT_REUSE",nullptr,0))return true;
- retainedFrame_.reset(); // A failed present never seeds an idle cache.
if(!windowChanging&&(targetWidth!=sink_.width()||targetHeight!=sink_.height())&&GetTickCount64()>=deferUntil&&now-lastResize_>=std::chrono::milliseconds(100)&&sink_.resizeDue()) {
resized=true;
if(!ring.drainQueue())return false;sink_.resize(targetWidth,targetHeight);
@@ -171,6 +159,7 @@ bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing&
// DXGI stretches the retained buffer while the native workspace unfolds.
// Compute contain in CURRENT client coordinates, then map back to buffer
// coordinates so that the onscreen image keeps its aspect throughout.
+ view=filmPixelAlignedView(window_,rc.right,rc.bottom,graph.workWidth(),graph.workHeight(),view);
const auto [renderW,renderH]=view.renderedSize(float(rc.right),float(rc.bottom),float(graph.workWidth()),float(graph.workHeight()));
D3D12_VIEWPORT viewport{0,0,float(sink_.bufferWidth()),float(sink_.bufferHeight()),0,1};
D3D12_RECT rect{0,0,LONG(sink_.bufferWidth()),LONG(sink_.bufferHeight())};list->RSSetViewports(1,&viewport);list->RSSetScissorRects(1,&rect);
@@ -294,7 +283,7 @@ bool VideoPresenter::present(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing&
ms(presentEnd-dxgiStart),slow,identity.sourceFrameId,identity.epoch,sink_.xess()?"XeSS":"DXGI",resized,
ms(resizeEnd-presentStart),ms(beginEnd-resizeEnd),ms(dxgiStart-beginEnd),timing.beforeMs,timing.callMs,timing.bufferMs,timing.afterMs,unsigned(timing.result)));
}
- xessFailed_=sink_.xessFailed();if(presented)retainedFrame_=retained;return presented;
+ xessFailed_=sink_.xessFailed();return presented;
}
bool VideoPresenter::readPresentedFrameForTest(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing& ring,sink::RgbaImage& image){
if(presentationQueue_&&!presentationRing_.drainQueue())return false;
@@ -303,7 +292,6 @@ bool VideoPresenter::readPresentedFrameForTest(gfx::D3D12DeviceContext& ctx,gfx:
return SUCCEEDED(sink_.swapChain()->GetBuffer(lastBuffer_,IID_PPV_ARGS(&buffer)))&&sink::readRgba8(ctx,ring,buffer.Get(),image);
}
void VideoPresenter::close(){
- retainedFrame_.reset();
xessInputId_=0;xessWork_={};xessWorkPosition_=0;
reflex_.close();reflexFrame_=0;
if(presentationRing_.initialized())presentationRing_.drainQueue();
diff --git a/tests/perf/PausedPresentExperiment.cpp b/tests/perf/PausedPresentExperiment.cpp
deleted file mode 100644
index 14298153..00000000
--- a/tests/perf/PausedPresentExperiment.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-#include "veyra/engine/VideoPresenter.h"
-#include "veyra/engine/GraphDescription.h"
-#include "veyra/engine/EffectChain.h"
-#include "veyra/pipeline/EnhanceGraph.h"
-#include "veyra/source/MediaFileSource.h"
-#include "veyra/sink/ImageExportSink.h"
-#include "veyra/gfx/D3D12DeviceContext.h"
-#include "veyra/gfx/CommandSlotRing.h"
-#include "veyra/RuntimePaths.h"
-#include "veyra/Log.h"
-#include <d3d12sdklayers.h>
-#include <filesystem>
-#include <iostream>
-#include <fstream>
-
-// Own window/backbuffer only, matching the QML video's WM_PAINT contract.
-// Uses the real graph/presenter and checks full pixels after each invalidation.
-namespace {
-LRESULT CALLBACK procedure(HWND window,UINT message,WPARAM wp,LPARAM lp){
- if(message==WM_PAINT){ValidateRect(window,nullptr);return 0;}
- return DefWindowProcW(window,message,wp,lp);
-}
-void pump(){MSG m{};while(PeekMessageW(&m,nullptr,0,0,PM_REMOVE)){TranslateMessage(&m);DispatchMessageW(&m);}}
-}
-int wmain(int argc,wchar_t** argv){
- using namespace veyra;if(argc!=3)return 2;SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2);
- const std::filesystem::path out=argv[2];std::filesystem::create_directories(out);Logger::instance().openFile((out/L"engine.log").wstring());
- WNDCLASSW wc{};wc.hInstance=GetModuleHandleW(nullptr);wc.lpfnWndProc=procedure;wc.lpszClassName=L"VeyraPausedPresentOwnedFixture";
- if(!RegisterClassW(&wc))return 2;
- HWND window=CreateWindowExW(WS_EX_NOACTIVATE,wc.lpszClassName,L"Veyra paused-present test",WS_POPUP,50,50,640,384,nullptr,nullptr,wc.hInstance,nullptr);
- if(!window)return 2;ShowWindow(window,SW_SHOWNOACTIVATE);pump();
- gfx::D3D12DeviceContext ctx;gfx::CommandSlotRing ring;Status status;gfx::DeviceContextDesc device;device.enableDebugLayer=true;
- if(!ctx.initialize(device,status)||!ring.initialize(ctx.device(),ctx.directQueue(),ctx.fence(),ctx.fenceEvent(),6,status))return 2;
- source::MediaFileSource media;source::SourceOpenDesc open;open.path=argv[1];open.preferHardwareDecode=false;if(!media.open(open))return 2;
- pipeline::FramePacket packet;const AVFrame* input=nullptr;if(media.read(packet,&input)!=source::SourceReadStatus::Frame)return 2;
- engine::EffectChain chain;chain.nodeCount=1;chain.nodes[0].type=engine::EffectType::NrEnhance;chain.nodes[0].enabled=true;
- chain.nodes[0].nr.sizePolicy=pipeline::NrSizePolicy::Native;engine::EnhancementSettings settings;engine::fromChain(chain,settings);
- engine::StageRequest request;request.width=media.info().width;request.height=media.info().height;request.nr=true;
- pipeline::EnhanceGraphDesc desc;engine::describeStages(request,settings,desc);desc.enableNvofStandalone=true;desc.enableFg=false;desc.runtimeAbsPath=runtime::localRuntimeDirectory().wstring();
- pipeline::EnhanceGraph graph(ctx,ring);engine::VideoPresenter presenter;
- if(!graph.initialize(desc)||!presenter.open(ctx,window,graph)||!graph.createViews())return 2;
- pipeline::EnhanceGraph::FrameOutputs output;bool pass=graph.process(input,0,true,output,1,&packet.colorInfo,nullptr,true)&&ring.waitIdle();
- engine::PreviewView view{};int comparison=0;float split=.5f;
- auto present=[&]{return presenter.present(ctx,ring,graph,output.videoSlot,false,true,comparison,false,split,output.batch.identity,view,-1,true);};
- auto snapshot=[&](const wchar_t* name){sink::RgbaImage image;if(!presenter.readPresentedFrameForTest(ctx,ring,image)){pass=false;return image;}
- std::ofstream f(out/(std::wstring(name)+L".rgba"),std::ios::binary);f.write(reinterpret_cast<const char*>(image.pixels.data()),std::streamsize(image.pixels.size()));return image;};
- pass=pass&&present();auto first=snapshot(L"initial");const auto initialCount=presenter.submittedCount();
- for(unsigned i=0;i<300&&pass;++i)pass=present();auto idle=snapshot(L"idle");
- const bool disabled=GetEnvironmentVariableW(L"VEYRA_TEST_DISABLE_PAUSED_PRESENT_REUSE",nullptr,0)>0;
- pass=pass&&first.pixels==idle.pixels&&presenter.submittedCount()==initialCount+(disabled?300:0);
- std::cout<<"IDLE pixelsEqual="<<(first.pixels==idle.pixels)<<" presents="<<presenter.submittedCount()<<" disabled="<<disabled<<std::endl;
- view.zoom=1.2f;auto count=presenter.submittedCount();pass=pass&&present()&&presenter.submittedCount()==count+1;auto zoom=snapshot(L"zoom");pass=pass&&zoom.pixels!=idle.pixels;
- comparison=2;count=presenter.submittedCount();pass=pass&&present()&&presenter.submittedCount()==count+1;auto compare=snapshot(L"comparison");pass=pass&&compare.pixels!=zoom.pixels;
- split=.25f;count=presenter.submittedCount();pass=pass&&present()&&presenter.submittedCount()==count+1;auto moved=snapshot(L"split");pass=pass&&moved.pixels!=compare.pixels;
- // Match the debounced resize deadline without touching any other window.
- Sleep(120);SetWindowPos(window,nullptr,50,50,768,432,SWP_NOACTIVATE|SWP_NOZORDER);pump();count=presenter.submittedCount();
- pass=pass&&present()&&presenter.submittedCount()==count+1;auto resized=snapshot(L"resized");pass=pass&&resized.width==768&&resized.height==432;
- settings.residual.total=0;settings.nrLayers[0].residual.total=0;pass=pass&&graph.applySettings(settings);
- pass=pass&&graph.process(input,0,true,output,1,&packet.colorInfo,nullptr,true)&&ring.waitIdle();count=presenter.submittedCount();
- pass=pass&&present()&&presenter.submittedCount()==count+1;auto edited=snapshot(L"producer-changed");pass=pass&&edited.pixels!=resized.pixels;
- count=presenter.submittedCount();ShowWindow(window,SW_HIDE);pump();pass=pass&&present()&&presenter.submittedCount()==count+1;
- ShowWindow(window,SW_SHOWNOACTIVATE);pump();count=presenter.submittedCount();pass=pass&&present()&&presenter.submittedCount()==count+1;
- auto restored=snapshot(L"restored");pass=pass&&restored.pixels==edited.pixels;
- std::cout<<"INVALIDATIONS pass="<<pass<<" finalPresents="<<presenter.submittedCount()<<" image="<<resized.width<<'x'<<resized.height<<std::endl;
- ring.drainQueue();output={};presenter.close();graph.shutdown();media.close();
- Microsoft::WRL::ComPtr<ID3D12InfoQueue> debug;unsigned errors=0;if(FAILED(ctx.device()->QueryInterface(IID_PPV_ARGS(&debug))))return 2;
- for(UINT64 i=0;i<debug->GetNumStoredMessages();++i){SIZE_T size=0;debug->GetMessage(i,nullptr,&size);std::vector<unsigned char> data(size);auto* m=reinterpret_cast<D3D12_MESSAGE*>(data.data());
- if(FAILED(debug->GetMessage(i,m,&size)))return 2;if(m->Severity<=D3D12_MESSAGE_SEVERITY_ERROR){++errors;std::cerr<<m->pDescription<<std::endl;}}
- const auto removed=ctx.device()->GetDeviceRemovedReason();DestroyWindow(window);UnregisterClassW(wc.lpszClassName,wc.hInstance);
- std::cout<<"RESULT pass="<<(pass&&errors==0&&SUCCEEDED(removed))<<" debugErrors="<<errors<<" deviceRemoved="<<unsigned(removed)<<std::endl;
- return pass&&errors==0&&SUCCEEDED(removed)?0:1;
-}