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: verify NR depth and motion parameter response

Veyra Goal Agent33d248e774ae
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bbb652ad..1aebd529 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -433,6 +433,11 @@ if(VEYRA_FFMPEG_ROOT AND EXISTS "${VEYRA_FFMPEG_ROOT}/include/libavformat/avform
target_link_libraries(veyra_repair_parameter_tests PRIVATE veyra_pipeline veyra_sinks veyra_nvof)
add_executable(veyra_repair_fg_tests tests/integration/RepairFgTests.cpp)
add_executable(veyra_motion_validation_tests tests/integration/MotionValidationTests.cpp)
+ add_executable(veyra_depth_response_tests tests/integration/DepthResponseTests.cpp)
+ target_compile_features(veyra_depth_response_tests PRIVATE cxx_std_20)
+ target_include_directories(veyra_depth_response_tests PRIVATE ${FFMPEG_INCLUDE_DIRS})
+ target_compile_definitions(veyra_depth_response_tests PRIVATE NOMINMAX WIN32_LEAN_AND_MEAN VEYRA_PROJECT_ROOT="${CMAKE_CURRENT_SOURCE_DIR}")
+ target_link_libraries(veyra_depth_response_tests PRIVATE veyra_engine)
add_executable(veyra_bidirectional_flow_tests tests/integration/BidirectionalFlowTests.cpp)
target_compile_features(veyra_bidirectional_flow_tests PRIVATE cxx_std_20)
target_link_libraries(veyra_bidirectional_flow_tests PRIVATE veyra_pipeline veyra_nvof)
diff --git a/docs/NR_DEPTH_RESPONSE_2026-09-08.md b/docs/NR_DEPTH_RESPONSE_2026-09-08.md
new file mode 100644
index 00000000..36539f74
--- /dev/null
+++ b/docs/NR_DEPTH_RESPONSE_2026-09-08.md
@@ -0,0 +1,58 @@
+# Controlled NR depth response
+
+Cycle75, basebfbfcbd. This experiment changes only a diagnostic target and build registration, not the player graph, default settings, dependencies or export integrity checks. Phase7/Goal remains in progress.
+
+## Result and decision
+
+On the pinned local Feature18 runtime, the tested depth variations produce **zero changed RGB channels in both raw NR RGBA8 output and final RGBA8 output**. This holds for a single256×256 frame and a12-frame moving sequence, with every frame compared. Changing NR intensity or temporal motion scale does produce large changes, and repeated baselines match exactly.
+
+Do not add a per-frame depth model to the default NR path based on these results. They provide no measured NR benefit and do not establish that all other configurations ignore depth. They do not test SR or FG depth behavior. Depth provider remains unavailable; no Large model, download or inference dependency was introduced.
+
+## Experiment
+
+`tests/integration/DepthResponseTests.cpp` assembles the actual shared EnhanceGraph using the existing diagnostic-only `nrParameterProbe` hook. Each case creates a fresh graph, with same generated RGB source, source metadata, motion, reset sequence, model and residual settings. NR enabled, SR/FG processing disabled. Static cases have1NR/0NVOF; temporal cases12NR/11NVOF/11NR-motion frames. Exactly1reset per case, so the moving test does not accidentally reset every frame.
+
+Modes:
+
+| Mode | Changed variable |
+|---|---|
+| 0 | Default .5 depth, establishes per-frame baseline |
+| 1 | Explicit replacement R32F texture filled .5 |
+| 2–3 | Replacement0 /1 |
+| 4 | Replacement horizontal gradient .01–.99 |
+| 5 | Replacement checker .1/.9 |
+| 6 | Gradient plus DepthInverted=0 instead of1 |
+| 7 | Positive control: NR intensity0, default depth |
+| 8 | Fresh repeated default baseline |
+| 9–10, temporal only | Separate motion controls: MV scales0 /-1, default depth |
+| 11–14, temporal only | Keep original depth resource pointer; after frame0 copy0 /1 /gradient /checker into that original texture |
+
+Replacement bindings are verified with parameter Get and exact pointer equality. Resident modes capture the original pointer and validate R32F256×256; after frame0 they change its contents with SRV→COPY_DEST→SRV transitions. This checks whether replacing an Evaluate-time resource pointer alone explains the negative result. It cannot rule out every private runtime behavior or a feature flag that would be required to activate depth.
+
+Raw NR readback restores graph resource states before the next frame. All readbacks and additional waits exist only in this diagnostic. RGB comparisons cover all frames; saved PNGs show the last frame. Alpha is excluded from changed-channel counts. No PSNR/perceptual quality claim is made.
+
+## Actual evidence
+
+Commands:
+
+```powershell
+powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/build.ps1 -Root "$PWD" -Preset x64-release
+out/build/x64-release/veyra_depth_response_tests.exe "<unique ignored output directory>"
+```
+
+Runner used Start-Process Hidden, retained Handle,275-second watchdog, WaitForExit/Refresh and explicit numeric exit code. Final build `logs/optimization-goal-20260908/build-cycle75-resident.log` exit0. Final run `logs/optimization-goal-20260908/depth-response-b8490565d1374d1c9a28a93ecc12b54d/`, exit0, log timestamps span39.416seconds. Every case debugErrors0, binding1, correct NR/NVOF/reset counts. Actual NR Create/Evaluate success0x1, SEH0 in `test.log`.
+
+| Control | Raw changed RGB channels / max8bit difference | Final changed channels / max |
+|---|---:|---:|
+| Static intensity0 |191,293 /58|191,278 /58|
+| Temporal intensity0 |2,306,633 /183|2,306,341 /183|
+| Temporal MV scale0 |2,062,640 /147|2,060,339 /147|
+| Temporal MV scale-1 |2,049,144 /164|2,047,395 /164|
+| All depth modes including resident updates |0 /0|0 /0|
+| Explicit .5 and repeated baseline |0 /0|0 /0|
+
+Mode6 changes depth pattern and inversion together; mode4 independently covers that pattern, but this is not a full inversion×texture factorial. Resident updates start after frame0 and establish no creation-time depth-contract proof. The source is constructed, not natural footage or ground-truth3D. Motion control responses prove that these controls change this NR sequence, not that arbitrary estimated vectors improve it.
+
+Initial build `build-cycle75.log` failed C1083 missing NGX include; using existing engine linkage and FFmpeg includes fixed the diagnostic target (`build-cycle75-fix.log`). Earlier successful runs191eb017… andfb2bd363… are retained; final run adds resident-content controls. No failures or prior variants were erased.
+
+Independent gate/review is recorded separately after execution. Remaining work includes SR/FG depth-specific evaluation, natural SR reconstruction and motion/FG quality comparisons, plus RTX Video SDK availability. Physical capture, long stability and distribution remain separate.
diff --git a/docs/REVIEW_NR_DEPTH_RESPONSE_2026-09-08.md b/docs/REVIEW_NR_DEPTH_RESPONSE_2026-09-08.md
new file mode 100644
index 00000000..a116e694
--- /dev/null
+++ b/docs/REVIEW_NR_DEPTH_RESPONSE_2026-09-08.md
@@ -0,0 +1,11 @@
+# Independent NR depth diagnostic review
+
+Fresh-context read-only reviewer `review_nr_depth_response`, scoped diff againstbfbfcbd. **PASS**, no introduced P0/P1/P2. Product paths/defaults/dependencies/export integrity unchanged. Full Goal remains open.
+
+- Independent preflight71 PASS, phase7 75 PASS: `logs/delivery/e67dc13783b24976a68fd1118c43a188/result.json`,41.694seconds.
+- Independently executed depth matrix exit0,40.440seconds: `logs/optimization-goal-20260908/review-depth-9678e01163c949b999231759f1fe6fc6/`.
+- All24 cases reproduced: depth variants zero raw/final RGB changes; explicit.5/repeated baseline exact; intensity0 and MV-scale controls change substantial output. Every temporal case NR12/NVOF11/motion11/reset1, binding1/debugErrors0.
+- Original-resource writes afterframe0, aligned R32F uploads, pointer binding, per-frame comparison, raw readback/state restoration and drain were audited. Zero depth response is observed, not hardcoded into the passing criterion. Reviewer viewed nonblack structured temporal output.
+- Tracked fingerprint before/after `ca90e967b7f2c588749b2eaf8dc516fed4b7eaad`; untracked new source/doc hashes also unchanged. Diagnostic executable SHA256 `0A0CA21053F6CDE55CB023A6AD3D71A24EEEE1C91BA6B91E2E57B894A4D8859A`.
+
+Limits: constructed256×256 inputs establish no natural/perceptual benefit or universal claim that depth is ignored. Creation-time/private feature behavior and SR/FG depth remain untested. This PASS does not cover full Goal, physical capture, long stability or distribution.
diff --git a/docs/WORKLOG.md b/docs/WORKLOG.md
index b14113dc..ab42ff43 100644
--- a/docs/WORKLOG.md
+++ b/docs/WORKLOG.md
@@ -1225,3 +1225,9 @@ Shared optional BOTH session and realGPU diagnostic; defaults unchanged. docs/BI
## Cycle74 independent final scopedPASS
review_bidirectional_candidate: initialP2diagnosticfootprintalignmentFAIL repaired; independent640x129all4casesPASS/debug0 (novel191->73,good1411unchanged). Initial1080/4KindependentmatrixPASS remainsvalid. Finalphase7aea3d88148bf4e6b9c793cd99f95f7fb75PASSexit0; docs/REVIEW_BIDIRECTIONAL_FLOW_2026-09-08.md. Reviewerfinalfingerprint2d3745d722cd9931e12d9ec6200d14d4d66f9924unchanged. Optionalsharedcapabilityonly; defaultforward, no graph/shader/exportintegrity/model changes. Retaincandidatependingnatural/changingframeNR/FGROI; fullGoalopen.
+
+## Cycle75 NR depth controlled response candidate
+Newdiagnostictarget only. docs/NR_DEPTH_RESPONSE_2026-09-08.md; finaldepth-response-b8490565d1374d1c9a28a93ecc12b54dexit0/39.416s/debug0. Default/replacement/residentdepth0,1,gradient,checker:rawNRandfinalRGBchanged0;singleframe andall12temporalframes. Intensity0positiveandMVscale0/-1changemillionsofRGBchannels; explicit.5/repeatbaselineexact;NR12/NVOF11/motion11/reset1. Resident originaltexturecontentsmutated afterframe0 toexclude simplepointercacheexplanation. No basisfordefaultNRdepthmodel; SR/FGdepth nottested. Frozen gate/review pending.
+
+## Cycle75 independent scopedPASS
+review_nr_depth_response nointroducedP0/P1/P2. Independentpreflight71/phase7e67dc13783b24976a68fd1118c43a18841.694s75PASS. Actualreview-depth-9678e01163c949b999231759f1fe6fc6exit0/40.440s:all24casesreproduce,depthzerochange/intensityandMVpositive,NR12NVOF11motion11reset1/debug0. Raw/residentcopy/pointer/per-frame comparisonreviewed; no universaldepthignoredclaim. docs/REVIEW_NR_DEPTH_RESPONSE_2026-09-08.md. Trackedfingerprintca90e967b7f2c588749b2eaf8dc516fed4b7eaadunchanged; exe0A0CA21053F6CDE55CB023A6AD3D71A24EEEE1C91BA6B91E2E57B894A4D8859A. Do notadddefaultNRdepthmodelwithoutnewbenefitevidence. SR/FGdepth/naturalreconstructionremainopen.
diff --git a/loop/EVIDENCE.md b/loop/EVIDENCE.md
index ea5bec9b..ce21ad59 100644
--- a/loop/EVIDENCE.md
+++ b/loop/EVIDENCE.md
@@ -528,3 +528,9 @@ Shared optional BOTH session and realGPU diagnostic; defaults unchanged. docs/BI
## Cycle74 independent final scopedPASS
review_bidirectional_candidate: initialP2diagnosticfootprintalignmentFAIL repaired; independent640x129all4casesPASS/debug0 (novel191->73,good1411unchanged). Initial1080/4KindependentmatrixPASS remainsvalid. Finalphase7aea3d88148bf4e6b9c793cd99f95f7fb75PASSexit0; docs/REVIEW_BIDIRECTIONAL_FLOW_2026-09-08.md. Reviewerfinalfingerprint2d3745d722cd9931e12d9ec6200d14d4d66f9924unchanged. Optionalsharedcapabilityonly; defaultforward, no graph/shader/exportintegrity/model changes. Retaincandidatependingnatural/changingframeNR/FGROI; fullGoalopen.
+
+## Cycle75 NR depth controlled response candidate
+Newdiagnostictarget only. docs/NR_DEPTH_RESPONSE_2026-09-08.md; finaldepth-response-b8490565d1374d1c9a28a93ecc12b54dexit0/39.416s/debug0. Default/replacement/residentdepth0,1,gradient,checker:rawNRandfinalRGBchanged0;singleframe andall12temporalframes. Intensity0positiveandMVscale0/-1changemillionsofRGBchannels; explicit.5/repeatbaselineexact;NR12/NVOF11/motion11/reset1. Resident originaltexturecontentsmutated afterframe0 toexclude simplepointercacheexplanation. No basisfordefaultNRdepthmodel; SR/FGdepth nottested. Frozen gate/review pending.
+
+## Cycle75 independent scopedPASS
+review_nr_depth_response nointroducedP0/P1/P2. Independentpreflight71/phase7e67dc13783b24976a68fd1118c43a18841.694s75PASS. Actualreview-depth-9678e01163c949b999231759f1fe6fc6exit0/40.440s:all24casesreproduce,depthzerochange/intensityandMVpositive,NR12NVOF11motion11reset1/debug0. Raw/residentcopy/pointer/per-frame comparisonreviewed; no universaldepthignoredclaim. docs/REVIEW_NR_DEPTH_RESPONSE_2026-09-08.md. Trackedfingerprintca90e967b7f2c588749b2eaf8dc516fed4b7eaadunchanged; exe0A0CA21053F6CDE55CB023A6AD3D71A24EEEE1C91BA6B91E2E57B894A4D8859A. Do notadddefaultNRdepthmodelwithoutnewbenefitevidence. SR/FGdepth/naturalreconstructionremainopen.
diff --git a/loop/JOURNAL.md b/loop/JOURNAL.md
index 7e911b02..21d2950a 100644
--- a/loop/JOURNAL.md
+++ b/loop/JOURNAL.md
@@ -1551,3 +1551,13 @@ Cycle74 reviewer FAIL P2diagnosticcopyalignment:accepted640x129hasgridheight33,c
## Cycle74 independent final scopedPASS
review_bidirectional_candidate: initialP2diagnosticfootprintalignmentFAIL repaired; independent640x129all4casesPASS/debug0 (novel191->73,good1411unchanged). Initial1080/4KindependentmatrixPASS remainsvalid. Finalphase7aea3d88148bf4e6b9c793cd99f95f7fb75PASSexit0; docs/REVIEW_BIDIRECTIONAL_FLOW_2026-09-08.md. Reviewerfinalfingerprint2d3745d722cd9931e12d9ec6200d14d4d66f9924unchanged. Optionalsharedcapabilityonly; defaultforward, no graph/shader/exportintegrity/model changes. Retaincandidatependingnatural/changingframeNR/FGROI; fullGoalopen.
+## Cycle75 - controlled NR depth response
+Previous Goal turn is progress:bfbfcbd optionalbidirectionalsharedsession actualROI independentlyverified; default unchanged. Clean tree/noSTOP. Isolated productgraph test compares default.5, explicit.5,zero,one,gradient,checker,inversion andpositiveNRparametercontrol over static and12frame movinginput. Same source/motion/settings pergroup; final+rawNR8bit outputs compared at everyframe, notjustlast. Bindingreadback pluspositivecontrol and repeatbaseline guard against inert test. No model/download/default/export changes. Eachprocess<=275seconds.
+Cycle75 initialmatrix191eb017efce45c99bd2653c71b870d8exit0:depthmodes1-6noRGBchanged, explicit.5/repeatedbaselineexact, intensity0positive. BuildinitialC1083missingNGXinclude corrected by linkingexistingengine/includes; preservedlog. Add explicitnrMotionFrames/resetassertions and separate temporalMVscale0/-1controls (defaultdepth), because addingguidancewithoutprovenresponse cannotjustify productcost.
+Cycle75 secondmatrixfb2bd363cd394cd9b91ab2c3fed5c3c9exit0:depthunchanged;temporalMVscale0/-1 DOESchangeNR (>2millionRGBchannels),so no inference thatmotionisinert. Strengthennegative-depthinference with modes11-14: mutate original graph depthtexturecontents afterfirstframe, preservingpointer andSRVstate; guardsagainstEvaluate-timepointercache explanation. No producthookchange.
+
+## Cycle75 NR depth controlled response candidate
+Newdiagnostictarget only. docs/NR_DEPTH_RESPONSE_2026-09-08.md; finaldepth-response-b8490565d1374d1c9a28a93ecc12b54dexit0/39.416s/debug0. Default/replacement/residentdepth0,1,gradient,checker:rawNRandfinalRGBchanged0;singleframe andall12temporalframes. Intensity0positiveandMVscale0/-1changemillionsofRGBchannels; explicit.5/repeatbaselineexact;NR12/NVOF11/motion11/reset1. Resident originaltexturecontentsmutated afterframe0 toexclude simplepointercacheexplanation. No basisfordefaultNRdepthmodel; SR/FGdepth nottested. Frozen gate/review pending.
+
+## Cycle75 independent scopedPASS
+review_nr_depth_response nointroducedP0/P1/P2. Independentpreflight71/phase7e67dc13783b24976a68fd1118c43a18841.694s75PASS. Actualreview-depth-9678e01163c949b999231759f1fe6fc6exit0/40.440s:all24casesreproduce,depthzerochange/intensityandMVpositive,NR12NVOF11motion11reset1/debug0. Raw/residentcopy/pointer/per-frame comparisonreviewed; no universaldepthignoredclaim. docs/REVIEW_NR_DEPTH_RESPONSE_2026-09-08.md. Trackedfingerprintca90e967b7f2c588749b2eaf8dc516fed4b7eaadunchanged; exe0A0CA21053F6CDE55CB023A6AD3D71A24EEEE1C91BA6B91E2E57B894A4D8859A. Do notadddefaultNRdepthmodelwithoutnewbenefitevidence. SR/FGdepth/naturalreconstructionremainopen.
diff --git a/loop/STATE.json b/loop/STATE.json
index 43a3438a..68478732 100644
--- a/loop/STATE.json
+++ b/loop/STATE.json
@@ -76,19 +76,19 @@
}
],
"cycle": {
- "completed": 74,
+ "completed": 75,
"maximum": 120,
"sameFailureAttempts": 0,
"maximumSameFailureAttempts": 3,
"noProgressCycles": 0,
"maximumNoProgressCycles": 5
},
- "currentTask": "Cycle74 optional bidirectional NVOF candidate and cost/occlusion evidence independently reviewed PASS; not default-integrated",
+ "currentTask": "Cycle75 NR depth response independently verified; no default NR depth-model investment justified by current evidence",
"lastGate": {
"name": "phase7",
"status": "passed",
"exitCode": 0,
- "evidence": "logs/delivery/aea3d88148bf4e6b9c793cd99f95f7fb/result.json;75checks"
+ "evidence": "logs/delivery/e67dc13783b24976a68fd1118c43a188/result.json;41.694s;75checks"
},
"lastFailureFingerprint": "",
"failureLedger": [
@@ -107,8 +107,8 @@
"Current USB2 1080p50 physical throughput passed; user perceived latency/audio/actual FG display cadence still need confirmation.",
"Public proprietary runtime distribution rights unresolved; local delivery only."
],
- "nextAction": "Controlled depth input-response experiment before investing in model; remaining changing-frame/natural NR/FG and SR reconstruction evidence, RTXVideo SDK dependency",
- "updatedAt": "2026-09-08T11:49:11.544171+00:00",
+ "nextAction": "SR/FG controlled depth response separately, then natural/known4K reconstruction and changing-frame motion quality; RTXVideo SDK dependency remains",
+ "updatedAt": "2026-09-08T12:04:59.733444+00:00",
"deliveryPlan": "docs/ACTIVE_DELIVERY_PLAN.md",
"captureAcceptance": "throughput_short_test_passed_user_latency_audio_pending",
"testInvocationLimitSeconds": 300,
@@ -131,7 +131,8 @@
"Cycles67-68 independent scoped PASS: temporal image6508c7cc PASS; optional R8d5f8d738/RGBAd9974360 reproduce expected-contract FAIL, no product integration.",
"Cycles69-70 independentPASS: motionshader/debug0; repairedresidual24constants; image29e690f3 andSR60A/B GBV0. Natural/FGquality still open.",
"Cycles71-73 independent scopedPASS: scene14/motionverticalcostboundary; NR600NVOF594; actualFG600source594generated6hold1200output independentlydecoded, docs/REVIEW_SCENE_BOUNDARIES_2026-09-08.md",
- "Cycle74 independent scopedPASS, docs/REVIEW_BIDIRECTIONAL_FLOW_2026-09-08.md:360/1080/4K controlledbidirectional plus640x129alignmentfix; no defaultintegration"
+ "Cycle74 independent scopedPASS, docs/REVIEW_BIDIRECTIONAL_FLOW_2026-09-08.md:360/1080/4K controlledbidirectional plus640x129alignmentfix; no defaultintegration",
+ "Cycle75 independent NRdepth24casesPASS:docs/REVIEW_NR_DEPTH_RESPONSE_2026-09-08.md; no depthresponse, strongMV/intensityresponse; no newmodels/defaults"
],
"reviewBaseCommit": "6f0ebaa687e3966d989bf138c86b6882380f20fb",
"localDelivery": "capture_fix_candidate_needs_review",
@@ -269,8 +270,8 @@
"testInvocationLimitSeconds": 300,
"productModified": true,
"consecutiveBlockedGoalTurns": 0,
- "previousGoalTurnClassification": "progress: motion corpus found all3authoredcuts missed; repaired moderate-luma scene reset and independently verified actual2Xboundaryholds",
- "currentGoalTurnClassification": "progress: actual sharedNVOFBOTH validated, constructedocclusion benefitandcost measured, diagnosticoddheightP2fixed andindependentlyreviewed",
+ "previousGoalTurnClassification": "progress: actual sharedNVOFBOTH validated, constructedocclusion benefitandcost measured, diagnosticoddheightP2fixed andindependentlyreviewed",
+ "currentGoalTurnClassification": "progress: controlledNRdepthnegative withresidenttextureupdate, MV/intensitypositive, actualRTXandindependentreview; avoidedunsupporteddefaultmodelcost",
"controlSynchronizationAuthorization": "2026-09-08 user: 确认,给你全部权限; applies to previously proposed exact two-hash synchronization",
"diagnosticFindings": [
"Q7 read-only dependency check: RTXVideoSDK not present in third_party_local; official1.1download redirects NVIDIA login. Localdepthfile vitl is Large, not permitted Small; no verified Small ONNX/provider. No dependency integrated or performance claimed."
diff --git a/tests/integration/DepthResponseTests.cpp b/tests/integration/DepthResponseTests.cpp
new file mode 100644
index 00000000..b4316b65
--- /dev/null
+++ b/tests/integration/DepthResponseTests.cpp
@@ -0,0 +1,85 @@
+#include "veyra/pipeline/EnhanceGraph.h"
+#include "veyra/gfx/D3D12DeviceContext.h"
+#include "veyra/gfx/CommandSlotRing.h"
+#include "veyra/sink/ImageExportSink.h"
+#include "veyra/ngx/NgxParameters.h"
+#include "veyra/ngx/DlssNrParameters.h"
+#include <d3d12sdklayers.h>
+#include <algorithm>
+#include <cstring>
+#include <filesystem>
+#include <iostream>
+extern "C" {
+#include <libavutil/frame.h>
+#include <libavutil/pixfmt.h>
+}
+using namespace veyra;
+int experiment(bool temporal,const std::filesystem::path& directory){
+ constexpr unsigned w=256,h=256;const unsigned count=temporal?12:1;
+ std::vector<sink::RgbaImage> finalBaseline,rawBaseline;bool positive=false;
+ for(unsigned mode=0;mode<(temporal?15u:9u);++mode){
+ gfx::D3D12DeviceContext ctx;gfx::CommandSlotRing ring;Status st;gfx::DeviceContextDesc dd;dd.enableDebugLayer=true;
+ if(!ctx.initialize(dd,st)||!ring.initialize(ctx.device(),ctx.directQueue(),ctx.fence(),ctx.fenceEvent(),4,st))return 2;
+ auto depth=pipeline::makeTexture(ctx.device(),w,h,DXGI_FORMAT_R32_FLOAT,false);
+ auto up=pipeline::makeUploadBuffer(ctx.device(),size_t(w)*h*4);void* ptr=nullptr;
+ if(!depth||!up||FAILED(up->Map(0,nullptr,&ptr)))return 2;
+ const unsigned pattern=mode>=11?mode-9:mode;
+ for(unsigned y=0;y<h;++y)for(unsigned x=0;x<w;++x){
+ float d=pattern==2?0:pattern==3?1:(pattern==4||pattern==6)?.01f+.98f*x/(w-1):pattern==5?(((x/32+y/32)%2)?.1f:.9f):.5f;
+ static_cast<float*>(ptr)[y*w+x]=d;
+ }
+ up->Unmap(0,nullptr);unsigned slot=0;auto* list=ring.acquireNext(slot,st);if(!list)return 2;
+ pipeline::StateTracker states;states.transition(list,depth.Get(),D3D12_RESOURCE_STATE_COPY_DEST);
+ D3D12_TEXTURE_COPY_LOCATION dst{},src{};dst.pResource=depth.Get();dst.Type=D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;src.pResource=up.Get();src.Type=D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;src.PlacedFootprint.Footprint={DXGI_FORMAT_R32_FLOAT,w,h,1,w*4};list->CopyTextureRegion(&dst,0,0,0,&src,nullptr);states.transition(list,depth.Get(),D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
+ if(!ring.submitAndSignal(slot)||!ring.drainQueue())return 2;
+ pipeline::EnhanceGraph graph(ctx,ring);pipeline::EnhanceGraphDesc gd;gd.sourceWidth=gd.workWidth=w;gd.sourceHeight=gd.workHeight=h;
+ gd.rgbInput=gd.enableNr=true;gd.stillImage=!temporal;gd.enableFg=false;gd.enableNvofStandalone=temporal;gd.runtimeAbsPath=(std::filesystem::path(VEYRA_PROJECT_ROOT)/"runtime_local/nvidia").wstring();
+ ID3D12Resource* raw=nullptr;ID3D12Resource* residentDepth=nullptr;bool binding=true;unsigned hookCalls=0;
+ gd.nrParameterProbe=[&](NVSDK_NGX_Parameter* p,ID3D12Resource*,ID3D12Resource* output,uint32_t,uint32_t){
+ raw=output;++hookCalls;ngx::ParameterBlock pb(p);
+ if(mode>=1&&mode<=6){pb.setD3D12Resource(ngx::dlssnr::kDepth,depth.Get());ID3D12Resource* got=nullptr;binding=binding&&p->Get(ngx::dlssnr::kDepth,&got)==NVSDK_NGX_Result_Success&&got==depth.Get();}
+ if(mode==6)pb.setI32(ngx::dlssnr::kDepthInverted,0);
+ if(mode==7)pb.setF32(ngx::dlssnr::kIntensity,0.f);
+ // Separate guidance-response control; depth stays at the default.
+ if(mode==9||mode==10){const float scale=mode==9?0.f:-1.f;pb.setF32(ngx::dlssnr::kMVecScaleX,scale);pb.setF32(ngx::dlssnr::kMVecScaleY,scale);}
+ if(mode>=11){ID3D12Resource* got=nullptr;binding=binding&&p->Get(ngx::dlssnr::kDepth,&got)==NVSDK_NGX_Result_Success&&got;
+ if(binding){auto d=got->GetDesc();binding=d.Format==DXGI_FORMAT_R32_FLOAT&&d.Width==w&&d.Height==h&&(!residentDepth||residentDepth==got);residentDepth=got;}}
+ };
+ if(!graph.initialize(gd)||!graph.createViews())return 2;
+ AVFrame* f=av_frame_alloc();if(!f)return 2;f->format=AV_PIX_FMT_RGBA;f->width=w;f->height=h;f->color_range=AVCOL_RANGE_JPEG;f->color_trc=AVCOL_TRC_IEC61966_2_1;f->colorspace=AVCOL_SPC_RGB;
+ if(av_frame_get_buffer(f,32)<0){av_frame_free(&f);return 2;}
+ bool ok=true;uint64_t rawChanged=0,finalChanged=0;unsigned rawMax=0,finalMax=0;
+ for(unsigned frame=0;frame<count&&ok;++frame){
+ if(mode>=11&&frame==1){
+ // Change the original resource's contents after the first frame.
+ // This rules out an Evaluate-time resource-pointer cache as the
+ // explanation for an inert replacement depth binding.
+ unsigned s=0;auto* l=ring.acquireNext(s,st);if(!l||!residentDepth){ok=false;break;}
+ D3D12_RESOURCE_BARRIER b{};b.Type=D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;b.Transition={residentDepth,D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES,D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE,D3D12_RESOURCE_STATE_COPY_DEST};l->ResourceBarrier(1,&b);
+ D3D12_TEXTURE_COPY_LOCATION a{},source{};a.pResource=residentDepth;a.Type=D3D12_TEXTURE_COPY_TYPE_SUBRESOURCE_INDEX;source.pResource=up.Get();source.Type=D3D12_TEXTURE_COPY_TYPE_PLACED_FOOTPRINT;source.PlacedFootprint.Footprint={DXGI_FORMAT_R32_FLOAT,w,h,1,w*4};l->CopyTextureRegion(&a,0,0,0,&source,nullptr);std::swap(b.Transition.StateBefore,b.Transition.StateAfter);l->ResourceBarrier(1,&b);
+ if(!ring.submitAndSignal(s)||!ring.drainQueue()){ok=false;break;}
+ }
+ for(unsigned y=0;y<h;++y)for(unsigned x=0;x<w;++x){auto* p=f->data[0]+size_t(y)*f->linesize[0]+x*4;unsigned q=x+frame*2;p[0]=(q*7+y*3)%256;p[1]=(q*3+y*11)%256;p[2]=(q*5+y*17)%256;p[3]=255;}
+ pipeline::EnhanceGraph::FrameOutputs out;sink::RgbaImage finalPixels,rawPixels;
+ ok=graph.process(f,frame*(1000.0/60),frame==0,out,frame+1)&&binding&&raw&&sink::readRgba8(ctx,ring,graph.videoFrameResource(out.videoSlot),finalPixels);
+ auto transitionRaw=[&](bool restore){unsigned s=0;auto* l=ring.acquireNext(s,st);if(!l)return false;D3D12_RESOURCE_BARRIER b{};b.Type=D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;b.Transition={raw,D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES,restore?D3D12_RESOURCE_STATE_COMMON:D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE,restore?D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE:D3D12_RESOURCE_STATE_COMMON};l->ResourceBarrier(1,&b);return ring.submitAndSignal(s);};
+ if(ok){ok=transitionRaw(false);if(ok){bool read=sink::readRgba8(ctx,ring,raw,rawPixels);ok=transitionRaw(true)&&read;}}
+ if(ok){
+ if(mode==0){finalBaseline.push_back(finalPixels);rawBaseline.push_back(rawPixels);}
+ else if(finalPixels.pixels.size()!=finalBaseline[frame].pixels.size()||rawPixels.pixels.size()!=rawBaseline[frame].pixels.size())ok=false;
+ else for(size_t i=0;i<finalPixels.pixels.size();++i){if(i%4==3)continue;unsigned d=unsigned(std::abs(int(finalPixels.pixels[i])-int(finalBaseline[frame].pixels[i])));finalChanged+=d!=0;finalMax=std::max(finalMax,d);unsigned r=unsigned(std::abs(int(rawPixels.pixels[i])-int(rawBaseline[frame].pixels[i])));rawChanged+=r!=0;rawMax=std::max(rawMax,r);}
+ if(ok&&frame+1==count)ok=sink::saveImage((directory/(std::string(temporal?"temporal":"still")+"-depth-"+std::to_string(mode)+".png")).wstring(),finalPixels);
+ }
+ }
+ av_frame_free(&f);auto metrics=graph.metrics();ok=ok&&metrics.nrEvaluateCount==count&&hookCalls==count&&metrics.nvofExecuteCount==(temporal?count-1:0)&&metrics.nrMotionFrames==(temporal?count-1:0)&&metrics.resetCount==1;
+ if(mode==1||mode==8)ok=ok&&rawChanged==0&&finalChanged==0; // explicit .5 and independent repeated baseline
+ if(mode==7){positive=rawChanged>100&&finalChanged>100;ok=ok&&positive;}
+ ok=ring.drainQueue()&&ok;graph.shutdown();depth.Reset();up.Reset();
+ pipeline::ComPtr<ID3D12InfoQueue> iq;unsigned errors=0;if(FAILED(ctx.device()->QueryInterface(IID_PPV_ARGS(&iq))))return 2;
+ for(UINT64 i=0;i<iq->GetNumStoredMessages();++i){SIZE_T n=0;if(FAILED(iq->GetMessage(i,nullptr,&n)))return 2;std::vector<uint8_t>b(n);auto* m=reinterpret_cast<D3D12_MESSAGE*>(b.data());if(FAILED(iq->GetMessage(i,m,&n)))return 2;if(m->Severity<=D3D12_MESSAGE_SEVERITY_ERROR){++errors;std::cerr<<m->pDescription<<std::endl;}}
+ std::cout<<"DEPTH_RESPONSE temporal="<<temporal<<" mode="<<mode<<" frames="<<count<<" nr="<<metrics.nrEvaluateCount<<" nvof="<<metrics.nvofExecuteCount<<" motionFrames="<<metrics.nrMotionFrames<<" resets="<<metrics.resetCount<<" rawChanged="<<rawChanged<<" rawMax="<<rawMax<<" finalChanged="<<finalChanged<<" finalMax="<<finalMax<<" binding="<<binding<<" debugErrors="<<errors<<" pass="<<(ok&&!errors)<<std::endl;
+ if(!ok||errors)return 1;
+ }
+ return positive?0:1;
+}
+int wmain(int argc,wchar_t** argv){if(argc!=2)return 2;CoInitializeEx(nullptr,COINIT_MULTITHREADED);std::filesystem::path dir=argv[1];std::filesystem::create_directories(dir);int r=experiment(false,dir);if(!r)r=experiment(true,dir);CoUninitialize();return r;}