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

phase-1 work: P1.2 veyra_ngx core host init 0x1 success + adapter + reverse RAII verified

Veyra Goal Agentc5f59d421cb7
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 42f7cb00..acc36e34 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,6 +21,10 @@ option(VEYRA_ENABLE_D3D12_DEBUG "Enable D3D12 debug layer" ON)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(VeyraWarnings)
+# NVIDIA's static NGX core shim (nvsdk_ngx_s*.lib) is built against the
+# static CRT (MT/MTd); match it for the diagnostic tools that link it.
+set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+
# ---------------------------------------------------------------------------
# Targets grow phase by phase; only what actually compiles is declared.
# ---------------------------------------------------------------------------
@@ -47,6 +51,32 @@ if(VEYRA_ENABLE_D3D12_DEBUG)
target_compile_definitions(veyra_gfx PUBLIC VEYRA_D3D12_DEBUG=1)
endif()
+# ---------------------------------------------------------------------------
+# veyra_ngx: NGX core host + local experimental DLSSNR adapter.
+# Compiled only with the explicit experimental switch; missing SDK paths are
+# a configure-time failure, never a runtime surprise (Playbook 5.1/8.1).
+# ---------------------------------------------------------------------------
+if(VEYRA_ENABLE_EXPERIMENTAL_DLSSNR)
+ if(NOT VEYRA_DLSS_SDK_ROOT OR NOT EXISTS "${VEYRA_DLSS_SDK_ROOT}/include/nvsdk_ngx.h")
+ message(FATAL_ERROR "VEYRA_ENABLE_EXPERIMENTAL_DLSSNR requires VEYRA_DLSS_SDK_ROOT pointing at NVIDIA DLSS SDK 310.7 (include/nvsdk_ngx.h missing)")
+ endif()
+ add_library(veyra_ngx STATIC
+ src/ngx/NgxCoreHost.cpp
+ src/ngx/DlssNrRuntimeAdapter.cpp
+ )
+ veyra_apply_warnings(veyra_ngx)
+ target_compile_features(veyra_ngx PUBLIC cxx_std_20)
+ target_link_libraries(veyra_ngx PUBLIC veyra_base veyra_gfx)
+ target_include_directories(veyra_ngx PUBLIC
+ "${VEYRA_DLSS_SDK_ROOT}/include")
+ # NVIDIA ships the static core shim as MT-Release; the _dbg variants match
+ # the MDd debug runtime. Pick per configuration to avoid LNK2038.
+ target_link_libraries(veyra_ngx PRIVATE
+ "$<IF:$<CONFIG:Debug>,${VEYRA_DLSS_SDK_ROOT}/lib/Windows_x86_64/x64/nvsdk_ngx_s_dbg.lib,${VEYRA_DLSS_SDK_ROOT}/lib/Windows_x86_64/x64/nvsdk_ngx_s.lib>")
+ target_compile_definitions(veyra_ngx PUBLIC
+ VEYRA_EXPERIMENTAL_LOCAL_DLSSNR=1)
+endif()
+
add_executable(veyra_runtime_probe
tools/runtime_probe/main.cpp
)
@@ -55,3 +85,14 @@ target_compile_features(veyra_runtime_probe PRIVATE cxx_std_20)
target_compile_definitions(veyra_runtime_probe PRIVATE
UNICODE _UNICODE WIN32_LEAN_AND_MEAN NOMINMAX)
target_link_libraries(veyra_runtime_probe PRIVATE veyra_gfx)
+
+if(VEYRA_ENABLE_EXPERIMENTAL_DLSSNR)
+ add_executable(veyra_nr_harness
+ tools/nr_harness/main.cpp
+ )
+ veyra_apply_warnings(veyra_nr_harness)
+ target_compile_features(veyra_nr_harness PRIVATE cxx_std_20)
+ target_compile_definitions(veyra_nr_harness PRIVATE
+ UNICODE _UNICODE WIN32_LEAN_AND_MEAN NOMINMAX)
+ target_link_libraries(veyra_nr_harness PRIVATE veyra_gfx veyra_ngx)
+endif()
diff --git a/include/veyra/ngx/DlssNrParameters.h b/include/veyra/ngx/DlssNrParameters.h
new file mode 100644
index 00000000..9f110744
--- /dev/null
+++ b/include/veyra/ngx/DlssNrParameters.h
@@ -0,0 +1,68 @@
+#pragma once
+
+// Every Feature 18 parameter name, centralized (Playbook sections 8.5/8.6).
+// Types are encoded by the ParameterBlock setter used at the call site.
+
+namespace veyra::ngx::dlssnr {
+
+// --- Create parameters (uint32 via setU32 / int via setI32 / float via setF32)
+constexpr const char* kWidth = "DLSSNR.Width";
+constexpr const char* kHeight = "DLSSNR.Height";
+constexpr const char* kInputWidth = "DLSSNR.InputWidth";
+constexpr const char* kInputHeight = "DLSSNR.InputHeight";
+constexpr const char* kOutputWidth = "DLSSNR.OutputWidth";
+constexpr const char* kOutputHeight = "DLSSNR.OutputHeight";
+constexpr const char* kOutputDotWidth = "DLSSNR.Output.Width";
+constexpr const char* kOutputDotHeight = "DLSSNR.Output.Height";
+constexpr const char* kUpscaling = "DLSSNR.Upscaling";
+constexpr const char* kScale = "DLSSNR.Scale";
+constexpr const char* kScalingRatio = "DLSSNR.ScalingRatio";
+constexpr const char* kComputeScalingRatioCallback = "DLSSNRComputeScalingRatioCallback";
+constexpr const char* kHintRenderPreset = "DLSSNR.Hint.Render.Preset";
+constexpr const char* kStdWidth = "Width";
+constexpr const char* kStdHeight = "Height";
+constexpr const char* kPerfQualityValue = "PerfQualityValue";
+constexpr const char* kCreationNodeMask = "CreationNodeMask";
+constexpr const char* kVisibilityNodeMask = "VisibilityNodeMask";
+
+// --- Evaluate resource parameters (ID3D12Resource* via setD3D12Resource)
+constexpr const char* kColor = "DLSSNR.Color";
+constexpr const char* kOutput = "DLSSNR.Output";
+constexpr const char* kMVec = "DLSSNR.MVec";
+constexpr const char* kDepth = "DLSSNR.Depth";
+
+// --- Evaluate subrects (uint32 via setU32)
+constexpr const char* kColorSubrectBaseX = "DLSSNR.ColorSubrectBaseX";
+constexpr const char* kColorSubrectBaseY = "DLSSNR.ColorSubrectBaseY";
+constexpr const char* kColorSubrectWidth = "DLSSNR.ColorSubrectWidth";
+constexpr const char* kColorSubrectHeight = "DLSSNR.ColorSubrectHeight";
+constexpr const char* kOutputSubrectBaseX = "DLSSNR.OutputSubrectBaseX";
+constexpr const char* kOutputSubrectBaseY = "DLSSNR.OutputSubrectBaseY";
+constexpr const char* kOutputSubrectWidth = "DLSSNR.OutputSubrectWidth";
+constexpr const char* kOutputSubrectHeight = "DLSSNR.OutputSubrectHeight";
+constexpr const char* kMVecSubrectBaseX = "DLSSNR.MVecSubrectBaseX";
+constexpr const char* kMVecSubrectBaseY = "DLSSNR.MVecSubrectBaseY";
+constexpr const char* kMVecSubrectWidth = "DLSSNR.MVecSubrectWidth";
+constexpr const char* kMVecSubrectHeight = "DLSSNR.MVecSubrectHeight";
+constexpr const char* kDepthSubrectBaseX = "DLSSNR.DepthSubrectBaseX";
+constexpr const char* kDepthSubrectBaseY = "DLSSNR.DepthSubrectBaseY";
+constexpr const char* kDepthSubrectWidth = "DLSSNR.DepthSubrectWidth";
+constexpr const char* kDepthSubrectHeight = "DLSSNR.DepthSubrectHeight";
+
+// --- Evaluate controls
+constexpr const char* kMVecScaleX = "DLSSNR.MVecScaleX";
+constexpr const char* kMVecScaleY = "DLSSNR.MVecScaleY";
+constexpr const char* kDepthInverted = "DLSSNR.DepthInverted";
+constexpr const char* kIndicatorInvertX = "DLSS.Indicator.Invert.X.Axis";
+constexpr const char* kIndicatorInvertY = "DLSS.Indicator.Invert.Y.Axis";
+constexpr const char* kEnabled = "DLSSNR.Enabled";
+constexpr const char* kReset = "DLSSNR.Reset";
+constexpr const char* kStyle = "DLSSNR.Style";
+constexpr const char* kIntensity = "DLSSNR.Intensity";
+constexpr const char* kLocalToneStrength = "DLSSNR.LocalToneStrength";
+constexpr const char* kLocalStructureStrength = "DLSSNR.LocalStructureStrength";
+constexpr const char* kSkinStructureStrength = "DLSSNR.SkinStructureStrength";
+constexpr const char* kUseAutoMask = "DLSSNR.UseAutoMask";
+constexpr const char* kUICorrection = "DLSSNR.UICorrection";
+
+} // namespace veyra::ngx::dlssnr
diff --git a/include/veyra/ngx/DlssNrRuntimeAdapter.h b/include/veyra/ngx/DlssNrRuntimeAdapter.h
new file mode 100644
index 00000000..556d360e
--- /dev/null
+++ b/include/veyra/ngx/DlssNrRuntimeAdapter.h
@@ -0,0 +1,92 @@
+#pragma once
+
+#include <d3d12.h>
+#include <nvsdk_ngx.h>
+
+#include <cstdint>
+#include <string>
+
+#include "veyra/Result.h"
+
+namespace veyra::ngx {
+
+// Local-only experimental adapter for the signed DLSSNR snippet
+// (Playbook section 8). This is the ONLY translation unit in the project that
+// knows: Feature ID 18, the signed snippet application ID, the DLL export
+// signatures, the caller-name compatibility shim, and the local runtime path
+// convention. It is compiled only when VEYRA_ENABLE_EXPERIMENTAL_DLSSNR is ON
+// and is local experimental only.
+class DlssNrRuntimeAdapter {
+public:
+ using InitExtFn = NVSDK_NGX_Result(NVSDK_CONV*)(
+ unsigned long long,
+ const wchar_t*,
+ ID3D12Device*,
+ NVSDK_NGX_Version,
+ const NVSDK_NGX_Parameter*);
+ using CreateFeatureFn = NVSDK_NGX_Result(NVSDK_CONV*)(
+ ID3D12GraphicsCommandList*,
+ NVSDK_NGX_Feature,
+ NVSDK_NGX_Parameter*,
+ NVSDK_NGX_Handle**);
+ using EvaluateFeatureFn = NVSDK_NGX_Result(NVSDK_CONV*)(
+ ID3D12GraphicsCommandList*,
+ const NVSDK_NGX_Handle*,
+ const NVSDK_NGX_Parameter*,
+ PFN_NVSDK_NGX_ProgressCallback);
+ using ReleaseFeatureFn = NVSDK_NGX_Result(NVSDK_CONV*)(NVSDK_NGX_Handle*);
+ using ShutdownFn = NVSDK_NGX_Result(NVSDK_CONV*)(ID3D12Device*);
+
+ struct Exports {
+ InitExtFn initExt = nullptr;
+ CreateFeatureFn createFeature = nullptr;
+ EvaluateFeatureFn evaluateFeature = nullptr;
+ ReleaseFeatureFn releaseFeature = nullptr;
+ ShutdownFn shutdown1 = nullptr;
+ };
+
+ // Feature ID and signed-snippet application ID from the verified call
+ // contract; the App ID is NOT the Veyra NGX Project ID.
+ static constexpr NVSDK_NGX_Feature kFeatureId = static_cast<NVSDK_NGX_Feature>(18);
+ static constexpr unsigned long long kSignedSnippetAppId = 0x0876232Cull;
+
+ DlssNrRuntimeAdapter() = default;
+ ~DlssNrRuntimeAdapter();
+
+ DlssNrRuntimeAdapter(const DlssNrRuntimeAdapter&) = delete;
+ DlssNrRuntimeAdapter& operator=(const DlssNrRuntimeAdapter&) = delete;
+
+ // Canonicalizes `runtimeDir`, loads nvngx_dlssnr.dll from it with
+ // restricted search flags and resolves all five exports (fail-closed on
+ // any missing one). The caller must have verified the file identity
+ // beforehand (veyra_base FileIdentity).
+ bool load(const std::wstring& runtimeDir, Status& status);
+
+ // Caller-name compatibility shim on the snippet's GetModuleFileNameW IAT
+ // slot (Playbook 8.3). Exactly one adapter session may own the slot.
+ // P1.3 implements install/restore; load() alone never touches the IAT.
+ bool installCallerCompatibility(Status& status);
+ void restoreCallerCompatibility();
+ bool callerCompatibilityInstalled() const { return shimInstalled_; }
+
+ // Reverse-order teardown: restores the IAT shim if installed, then frees
+ // the snippet module. Safe to call after partial initialization.
+ void unload();
+
+ bool loaded() const { return module_ != nullptr; }
+ const Exports& exports() const { return exports_; }
+ HMODULE module() const { return module_; }
+ const std::wstring& dllPath() const { return dllPath_; }
+
+private:
+ HMODULE module_ = nullptr;
+ Exports exports_{};
+ std::wstring dllPath_;
+
+ // Shim state (owned by this adapter session only).
+ bool shimInstalled_ = false;
+ void** iatSlot_ = nullptr;
+ void* originalGetModuleFileNameW_ = nullptr;
+};
+
+} // namespace veyra::ngx
diff --git a/include/veyra/ngx/NgxCoreHost.h b/include/veyra/ngx/NgxCoreHost.h
new file mode 100644
index 00000000..bc6d2212
--- /dev/null
+++ b/include/veyra/ngx/NgxCoreHost.h
@@ -0,0 +1,52 @@
+#pragma once
+
+#include <d3d12.h>
+#include <nvsdk_ngx.h>
+
+#include <cstdint>
+#include <string>
+
+#include "veyra/Result.h"
+
+namespace veyra::ngx {
+
+// Process-level single NGX Core host (Playbook section 7.1). One D3D12 device
+// gets exactly one Init; SR/NR/FG are consumers and never call core
+// Init/Shutdown themselves. Parameter blocks are allocated/destroyed through
+// this host so reverse-order teardown is guaranteed.
+class NgxCoreHost {
+public:
+ NgxCoreHost() = default;
+ ~NgxCoreHost();
+
+ NgxCoreHost(const NgxCoreHost&) = delete;
+ NgxCoreHost& operator=(const NgxCoreHost&) = delete;
+
+ // `runtimeDir` is the absolute staged runtime directory used both as the
+ // feature search path (PathListInfo) and application data path. The
+ // project identity strings come from runtime_local/config/ngx-local.json.
+ bool initialize(ID3D12Device* device,
+ const std::wstring& runtimeDir,
+ const char* projectId,
+ const char* engineVersion,
+ Status& status);
+ void shutdown();
+
+ bool initialized() const { return initialized_; }
+ uint64_t initResult() const { return initResult_; }
+
+ // Parameter blocks are tracked; shutdown() destroys any still-live block
+ // before core Shutdown1 (defense in depth; consumers should destroy them
+ // themselves in reverse order first).
+ NVSDK_NGX_Parameter* allocateParameters(Status& status);
+ void destroyParameters(NVSDK_NGX_Parameter* parameters);
+
+private:
+ bool initialized_ = false;
+ ID3D12Device* device_ = nullptr; // non-owning; consumer owns the device
+ uint64_t initResult_ = 0;
+ NVSDK_NGX_Parameter* liveParameterBlocks_[64] = {};
+ uint32_t liveParameterBlockCount_ = 0;
+};
+
+} // namespace veyra::ngx
diff --git a/include/veyra/ngx/NgxParameters.h b/include/veyra/ngx/NgxParameters.h
new file mode 100644
index 00000000..f4bfc4c1
--- /dev/null
+++ b/include/veyra/ngx/NgxParameters.h
@@ -0,0 +1,32 @@
+#pragma once
+
+#include <d3d12.h>
+#include <nvsdk_ngx.h>
+
+#include <cstdint>
+
+namespace veyra::ngx {
+
+// Strongly-typed setter wrapper over NVSDK_NGX_Parameter (Playbook 4.5).
+// The C++ virtual Set overloads encode the exact wire type, which is how
+// parameter-name-correct-but-type-wrong bugs are prevented.
+class ParameterBlock {
+public:
+ explicit ParameterBlock(NVSDK_NGX_Parameter* parameters)
+ : parameters_(parameters)
+ {
+ }
+
+ NVSDK_NGX_Parameter* raw() const { return parameters_; }
+
+ void setU32(const char* name, uint32_t value) { parameters_->Set(name, static_cast<unsigned int>(value)); }
+ void setI32(const char* name, int32_t value) { parameters_->Set(name, static_cast<int>(value)); }
+ void setF32(const char* name, float value) { parameters_->Set(name, value); }
+ void setD3D12Resource(const char* name, ID3D12Resource* value) { parameters_->Set(name, value); }
+ void setVoid(const char* name, void* value) { parameters_->Set(name, value); }
+
+private:
+ NVSDK_NGX_Parameter* parameters_ = nullptr;
+};
+
+} // namespace veyra::ngx
diff --git a/loop/BACKLOG.md b/loop/BACKLOG.md
index b1930cc5..8fac96cb 100644
--- a/loop/BACKLOG.md
+++ b/loop/BACKLOG.md
@@ -20,7 +20,7 @@ Phase 0 gate:以 Playbook 第 16 节 Phase 0 为准。未完成 P0.9 禁止开
- [x] P1.0a(Reviewer P2 加固项,不降低任何门槛): 在接入 Evaluate 循环前把 ID3D12Fence 时间线计数器收敛为单一 owner(ring 从 device context 派生 fence 值或明确所有权注释),避免 Phase 1 起重复/非单调 fence 值。(2026-09-02:移除 context 冗余计数器,ring 为唯一 signaler,双 preset+device-info 回归通过。)
- [x] P1.1 先建立 phase1 gate 和确定性 RGBA8 测试帧/输出统计。(2026-09-02:phase1.ps1 fail-closed 建立并负向验证 exit 1;JSON 契约含输出统计/变体 hash/防陈旧字段;nr-default.json 就位;NGX SDK 310.7 已 staging。)
-- [ ] P1.2 封装 NGX Core、parameter block、DLSSNR runtime 和严格逆序 RAII。
+- [x] P1.2 封装 NGX Core、parameter block、DLSSNR runtime 和严格逆序 RAII。(2026-09-02:Init_with_ProjectID result=0x1 真实成功;exports 5/5;逆序释放干净;harness --load-only 双配置 PASS。)
- [ ] P1.3 实现受隔离、可关闭的 caller-name 兼容层;禁止 patch DLL。
- [ ] P1.4 严格按 Playbook 参数名与类型 Create Feature 18。
- [ ] P1.5 实现 Proxy→Feature18→Raw 的 D3D12 资源、barrier、subrect 与异步 4-slot 执行。
diff --git a/loop/JOURNAL.md b/loop/JOURNAL.md
index 0ad81299..43ff8605 100644
--- a/loop/JOURNAL.md
+++ b/loop/JOURNAL.md
@@ -329,6 +329,31 @@ Result:
---
+## Cycle 012 — P1.2 veyra_ngx:core host/参数封装/NR adapter
+
+### Before
+
+- Phase: 1
+- 唯一任务: 实现 veyra_ngx 静态库(按官方 310.7 头文件签名):NgxCoreHost(一进程一次 Init_with_ProjectID、参数块生命周期、Shutdown1,SEH 边界)、NgxParameters 强类型 Set 封装、DlssNrParameters 常量、DlssNrRuntimeAdapter(受限加载+5 exports 解析,Feature 18 常量/AppID 仅在此文件);CMake 增加 VEYRA_ENABLE_EXPERIMENTAL_DLSSNR 门(缺 SDK 路径即 FATAL_ERROR);harness stub --load-only 实测 core init→snippet load→exports→逆序释放。修正 NgxResult.cpp 的 Success=0x1(官方头)。
+- 可证伪假设: 若 core Init 或 snippet 加载在本机失败,--load-only 非零退出并带真实 result hex。
+- 预计修改文件: src/ngx/NgxCoreHost.{h,cpp}(h 在 include/veyra/ngx/)、include/veyra/ngx/{NgxParameters.h,DlssNrParameters.h,DlssNrRuntimeAdapter.h}、src/ngx/DlssNrRuntimeAdapter.cpp、src/base/NgxResult.cpp(修正)、tools/nr_harness/main.cpp(stub)、CMakeLists.txt、scripts/build.ps1(传 SDK 根/实验开关)。
+- 快速检查命令: `build.ps1 -Preset x64-debug` → 0;`veyra_nr_harness.exe --load-only --runtime-dir <abs>` → 0(core init success + exports 5/5 + 干净 shutdown)。
+- 预期新增证据: 真实 Init_with_ProjectID result(0x1=Success)、snippet exports、Shutdown result。
+
+### After
+
+- 实际修改: include/veyra/ngx/{NgxCoreHost.h,NgxParameters.h,DlssNrParameters.h,DlssNrRuntimeAdapter.h}、src/ngx/{NgxCoreHost.cpp,DlssNrRuntimeAdapter.cpp}、tools/nr_harness/main.cpp(--load-only)、CMakeLists(veyra_ngx 实验开关 + FATAL_ERROR + 按配置选 _dbg/_s 库 + 全工具静态 CRT)、scripts/build.ps1(自动传 SDK 根 + 实验开关)、src/base/NgxResult.cpp(按官方 310.7 头修正 Success=0x1 并补全 20 项 FAIL 表)、tools/runtime_probe/main.cpp 自测改用 0x1。
+- 实际命令与 exit code:
+ - `build.ps1 -Preset x64-debug -Clean` → 修复 3 轮(头文件需先 d3d12.h 再 nvsdk_ngx.h + 缺 <string>/<windows.h>;`Init_with_ProjectID` 大小写 D;NVIDIA 静态库是 MT 系 → 全工具 CMP0091 静态 CRT + 按配置选库)后 exit 0;x64-release exit 0。
+ - `veyra_nr_harness.exe --load-only --runtime-dir <abs>` Debug 与 Release 均 exit 0(PASS)。
+- 新证据/日志路径: harness 控制台——**Init_with_ProjectID result=0x1 (NVSDK_NGX_Result_Success)**(本工程首次真实 NGX Core 调用,使用自己的 projectId=8562ea46-…,SEH=0);snippet 受限加载 exports 5/5;逆序释放:snippet FreeLibrary → core Shutdown1 result=0x1 → device shutdown 全干净。
+- 失败 fingerprint: 无遗留(3 个编译期缺陷逐一修复,每个有新证据)。
+- 是否有进展,依据: 是——P1.2 验收成立:core/参数封装/adapter/逆序 RAII 全部经真实运行验证。
+- STATE/BACKLOG 更新: cycle.completed=12;BACKLOG P1.2 → DONE。
+- 下一唯一动作: P1.3 caller-name 兼容层:PE import 表解析 → GetModuleFileNameW IAT slot 单 owner → VirtualProtect+InterlockedExchangePointer 安装 shim → 六项边界测试(nSize==0/过小/恰好 10/正常/nullptr/非 caller)→ 恢复验证。
+
+---
+
复制下面模板开始每个新 cycle。必须先填 Before,再改代码;完成后填 After。
## Cycle NNN — 简短任务名
diff --git a/loop/STATE.json b/loop/STATE.json
index 23d7d87c..0ff2c976 100644
--- a/loop/STATE.json
+++ b/loop/STATE.json
@@ -76,14 +76,14 @@
}
],
"cycle": {
- "completed": 11,
+ "completed": 12,
"maximum": 80,
"sameFailureAttempts": 0,
"maximumSameFailureAttempts": 3,
"noProgressCycles": 0,
"maximumNoProgressCycles": 5
},
- "currentTask": "P1.2: implement veyra_ngx (NgxCoreHost single-init lifecycle, typed parameter wrapper, DlssNrParameters constants, DlssNrRuntimeAdapter with Feature 18 constants + restricted load + exports + caller-name compatibility layer skeleton) with strict reverse-order RAII.",
+ "currentTask": "P1.3: implement the isolated, removable caller-name compatibility layer (PE import walk -> GetModuleFileNameW IAT slot -> single-owner shim install/restore) with the six boundary tests from Playbook 8.3.",
"lastGate": {
"name": "phase0",
"status": "passed",
@@ -96,6 +96,6 @@
"lastGoodCommit": "1fb7afa5779a6c6a0a585d4ecf18a640260a2fcf",
"openP0P1Findings": [],
"blockers": [],
- "nextAction": "Implement P1.2 veyra_ngx core host + NR runtime adapter, then P1.3 caller shim, P1.4 Create, P1.5 loop, P1.6 300 frames, P1.7 resets.",
- "updatedAt": "2026-09-02T21:50:00+08:00"
+ "nextAction": "Implement P1.3 IAT caller shim + boundary tests, then P1.4 Feature 18 Create, P1.5 frame loop, P1.6 300 evaluates.",
+ "updatedAt": "2026-09-02T22:10:00+08:00"
}
diff --git a/scripts/build.ps1 b/scripts/build.ps1
index 1e0519f7..08aa48af 100644
--- a/scripts/build.ps1
+++ b/scripts/build.ps1
@@ -53,6 +53,17 @@ if ($Clean -and (Test-Path -LiteralPath $buildDir -PathType Container)) {
Remove-Item -LiteralPath $buildDir -Recurse -Force
}
+# Local experimental DLSSNR support: enable when the staged official SDK tree
+# exists; the CMake configure itself fail-closes on missing paths.
+$configureExtra = ""
+$sdkRoot = Join-Path $Root "third_party_local\nvidia\DLSS_SDK_310.7.0"
+if (Test-Path -LiteralPath (Join-Path $sdkRoot "include\nvsdk_ngx.h") -PathType Leaf) {
+ $configureExtra = ' -DVEYRA_ENABLE_EXPERIMENTAL_DLSSNR=ON -DVEYRA_DLSS_SDK_ROOT="{0}"' -f $sdkRoot
+}
+else {
+ $configureExtra = " -DVEYRA_ENABLE_EXPERIMENTAL_DLSSNR=OFF"
+}
+
# --- Configure + build inside one vcvars environment, from a temp batch file
$batchDir = Join-Path $Root "out\build"
New-Item -ItemType Directory -Force -Path $batchDir | Out-Null
@@ -63,7 +74,7 @@ $batchLines = @(
('call "{0}" >nul 2>&1' -f $vcvars),
('if errorlevel 1 exit /b 4' -f $null),
('cd /d "{0}"' -f $Root),
- ('"{0}" --preset {1}' -f $cmakeExe, $Preset),
+ ('"{0}" --preset {1}{2}' -f $cmakeExe, $Preset, $configureExtra),
'if errorlevel 1 exit /b 5',
('"{0}" --build --preset {1}' -f $cmakeExe, $Preset),
'if errorlevel 1 exit /b 6',
diff --git a/src/base/NgxResult.cpp b/src/base/NgxResult.cpp
index e490265c..fdb2d647 100644
--- a/src/base/NgxResult.cpp
+++ b/src/base/NgxResult.cpp
@@ -55,11 +55,36 @@ const KnownHResult* findKnownHResult(uint32_t hr)
return nullptr;
}
-// The single NGX result code whose numeric value is verified against the
-// public NVIDIA NGX SDK headers at this stage. The full named table lands in
-// Phase 1 together with the pinned DLSS SDK 310.7 headers; unknown values
-// intentionally print hex-only instead of a guessed name.
-constexpr uint64_t kNgxResultSuccess = 0x300000ull;
+struct KnownNgxResult {
+ uint64_t value;
+ const char* name;
+};
+
+// Complete table from the pinned official NVIDIA DLSS SDK 310.7.0 header
+// (nvsdk_ngx_defs.h); NVSDK_NGX_Result_Success is 0x1, failures are
+// 0xBAD00000 | n. Unknown values print hex-only, never a guessed name.
+const KnownNgxResult kKnownNgxResults[] = {
+ {0x1ull, "NVSDK_NGX_Result_Success"},
+ {0xBAD00000ull, "NVSDK_NGX_Result_Fail"},
+ {0xBAD00001ull, "NVSDK_NGX_Result_FAIL_FeatureNotSupported"},
+ {0xBAD00002ull, "NVSDK_NGX_Result_FAIL_PlatformError"},
+ {0xBAD00003ull, "NVSDK_NGX_Result_FAIL_FeatureAlreadyExists"},
+ {0xBAD00004ull, "NVSDK_NGX_Result_FAIL_FeatureNotFound"},
+ {0xBAD00005ull, "NVSDK_NGX_Result_FAIL_InvalidParameter"},
+ {0xBAD00006ull, "NVSDK_NGX_Result_FAIL_ScratchBufferTooSmall"},
+ {0xBAD00007ull, "NVSDK_NGX_Result_FAIL_NotInitialized"},
+ {0xBAD00008ull, "NVSDK_NGX_Result_FAIL_UnsupportedInputFormat"},
+ {0xBAD00009ull, "NVSDK_NGX_Result_FAIL_RWFlagMissing"},
+ {0xBAD0000Aull, "NVSDK_NGX_Result_FAIL_MissingInput"},
+ {0xBAD0000Bull, "NVSDK_NGX_Result_FAIL_UnableToInitializeFeature"},
+ {0xBAD0000Cull, "NVSDK_NGX_Result_FAIL_OutOfDate"},
+ {0xBAD0000Dull, "NVSDK_NGX_Result_FAIL_OutOfGPUMemory"},
+ {0xBAD0000Eull, "NVSDK_NGX_Result_FAIL_UnsupportedFormat"},
+ {0xBAD0000Full, "NVSDK_NGX_Result_FAIL_UnableToWriteToAppDataPath"},
+ {0xBAD00010ull, "NVSDK_NGX_Result_FAIL_UnsupportedParameter"},
+ {0xBAD00011ull, "NVSDK_NGX_Result_FAIL_Denied"},
+ {0xBAD00012ull, "NVSDK_NGX_Result_FAIL_NotImplemented"},
+};
} // namespace
@@ -75,8 +100,10 @@ std::string hresultString(long hr)
std::string ngxResultString(uint64_t result)
{
- if (result == kNgxResultSuccess) {
- return std::format("0x{:X} (NVSDK_NGX_Result_Success)", result);
+ for (const auto& entry : kKnownNgxResults) {
+ if (entry.value == result) {
+ return std::format("0x{:X} ({})", result, entry.name);
+ }
}
return std::format("0x{:X}", result);
}
diff --git a/src/ngx/DlssNrRuntimeAdapter.cpp b/src/ngx/DlssNrRuntimeAdapter.cpp
new file mode 100644
index 00000000..d538a61a
--- /dev/null
+++ b/src/ngx/DlssNrRuntimeAdapter.cpp
@@ -0,0 +1,112 @@
+#include "veyra/ngx/DlssNrRuntimeAdapter.h"
+
+#include <windows.h>
+
+#include <format>
+
+#include "veyra/Log.h"
+#include "veyra/NgxResult.h"
+
+namespace veyra::ngx {
+
+namespace {
+
+constexpr const char* kExportNames[] = {
+ "NVSDK_NGX_D3D12_Init_Ext",
+ "NVSDK_NGX_D3D12_CreateFeature",
+ "NVSDK_NGX_D3D12_EvaluateFeature",
+ "NVSDK_NGX_D3D12_ReleaseFeature",
+ "NVSDK_NGX_D3D12_Shutdown1",
+};
+
+} // namespace
+
+DlssNrRuntimeAdapter::~DlssNrRuntimeAdapter()
+{
+ unload();
+}
+
+bool DlssNrRuntimeAdapter::load(const std::wstring& runtimeDir, Status& status)
+{
+ if (module_ != nullptr) {
+ status = Status::InvalidArgument;
+ veyra::log::error("ngx", "nr-adapter: load called twice");
+ return false;
+ }
+
+ wchar_t resolved[MAX_PATH * 2]{};
+ if (GetFullPathNameW(runtimeDir.c_str(), static_cast<DWORD>(std::size(resolved)), resolved, nullptr) == 0) {
+ status = Status::InvalidArgument;
+ veyra::log::error("ngx", "nr-adapter: GetFullPathNameW failed");
+ return false;
+ }
+ dllPath_ = std::wstring(resolved) + L"\\nvngx_dlssnr.dll";
+
+ const DWORD attributes = GetFileAttributesW(dllPath_.c_str());
+ if (attributes == INVALID_FILE_ATTRIBUTES) {
+ status = Status::FileNotFound;
+ veyra::log::error("ngx", "nr-adapter: staged DLL missing");
+ return false;
+ }
+
+ module_ = LoadLibraryExW(dllPath_.c_str(), nullptr,
+ LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32);
+ if (module_ == nullptr) {
+ const DWORD lastError = GetLastError();
+ status = Status::LoadLibraryFailure;
+ veyra::log::error("ngx", std::format("nr-adapter: LoadLibraryExW failed lastError={}", lastError));
+ return false;
+ }
+ veyra::log::info("ngx", "nr-adapter: snippet loaded with restricted search flags (LOCAL EXPERIMENTAL ONLY)");
+
+ void* addresses[5] = {};
+ for (size_t i = 0; i < 5; ++i) {
+ addresses[i] = reinterpret_cast<void*>(GetProcAddress(module_, kExportNames[i]));
+ veyra::log::info("ngx", std::format("nr-adapter: export {} {} address=0x{:016X}",
+ kExportNames[i], addresses[i] != nullptr ? "present" : "MISSING",
+ reinterpret_cast<uintptr_t>(addresses[i])));
+ }
+ if (addresses[0] == nullptr || addresses[1] == nullptr || addresses[2] == nullptr ||
+ addresses[3] == nullptr || addresses[4] == nullptr) {
+ status = Status::MissingExport;
+ FreeLibrary(module_);
+ module_ = nullptr;
+ return false;
+ }
+
+ exports_.initExt = reinterpret_cast<InitExtFn>(addresses[0]);
+ exports_.createFeature = reinterpret_cast<CreateFeatureFn>(addresses[1]);
+ exports_.evaluateFeature = reinterpret_cast<EvaluateFeatureFn>(addresses[2]);
+ exports_.releaseFeature = reinterpret_cast<ReleaseFeatureFn>(addresses[3]);
+ exports_.shutdown1 = reinterpret_cast<ShutdownFn>(addresses[4]);
+ return true;
+}
+
+bool DlssNrRuntimeAdapter::installCallerCompatibility(Status& status)
+{
+ // Implemented in P1.3 together with its boundary test battery.
+ (void)status;
+ veyra::log::error("ngx", "nr-adapter: caller compatibility shim not implemented yet (P1.3)");
+ return false;
+}
+
+void DlssNrRuntimeAdapter::restoreCallerCompatibility()
+{
+ // Nothing to restore until P1.3 installs the shim.
+}
+
+void DlssNrRuntimeAdapter::unload()
+{
+ if (shimInstalled_) {
+ restoreCallerCompatibility();
+ }
+ if (module_ != nullptr) {
+ // Reverse order: IAT restored above, then free the snippet module.
+ FreeLibrary(module_);
+ module_ = nullptr;
+ veyra::log::info("ngx", "nr-adapter: snippet module freed");
+ }
+ exports_ = Exports{};
+}
+
+} // namespace veyra::ngx
diff --git a/src/ngx/NgxCoreHost.cpp b/src/ngx/NgxCoreHost.cpp
new file mode 100644
index 00000000..90cd02ff
--- /dev/null
+++ b/src/ngx/NgxCoreHost.cpp
@@ -0,0 +1,165 @@
+#include "veyra/ngx/NgxCoreHost.h"
+
+#include <windows.h>
+
+#include <format>
+
+#include "veyra/Log.h"
+#include "veyra/NgxResult.h"
+
+namespace veyra::ngx {
+
+namespace {
+
+// SEH boundary: no C++ objects with destructors may live in a __try scope,
+// so the external call sits in its own frame (Playbook section 7.2).
+__declspec(noinline) NVSDK_NGX_Result CallInitWithProjectId(
+ const char* projectId,
+ NVSDK_NGX_EngineType engineType,
+ const char* engineVersion,
+ const wchar_t* applicationDataPath,
+ ID3D12Device* device,
+ const NVSDK_NGX_FeatureCommonInfo* featureInfo,
+ NVSDK_NGX_Version sdkVersion,
+ uint32_t& sehCode)
+{
+ sehCode = 0;
+ NVSDK_NGX_Result result = NVSDK_NGX_Result_Fail;
+ __try {
+ result = NVSDK_NGX_D3D12_Init_with_ProjectID(projectId, engineType, engineVersion,
+ applicationDataPath, device, featureInfo, sdkVersion);
+ }
+ __except (EXCEPTION_EXECUTE_HANDLER) {
+ sehCode = static_cast<uint32_t>(GetExceptionCode());
+ result = NVSDK_NGX_Result_FAIL_PlatformError;
+ }
+ return result;
+}
+
+__declspec(noinline) NVSDK_NGX_Result CallShutdown1(ID3D12Device* device, uint32_t& sehCode)
+{
+ sehCode = 0;
+ NVSDK_NGX_Result result = NVSDK_NGX_Result_Fail;
+ __try {
+ result = NVSDK_NGX_D3D12_Shutdown1(device);
+ }
+ __except (EXCEPTION_EXECUTE_HANDLER) {
+ sehCode = static_cast<uint32_t>(GetExceptionCode());
+ result = NVSDK_NGX_Result_FAIL_PlatformError;
+ }
+ return result;
+}
+
+} // namespace
+
+NgxCoreHost::~NgxCoreHost()
+{
+ shutdown();
+}
+
+bool NgxCoreHost::initialize(ID3D12Device* device,
+ const std::wstring& runtimeDir,
+ const char* projectId,
+ const char* engineVersion,
+ Status& status)
+{
+ if (initialized_) {
+ status = Status::InvalidArgument;
+ veyra::log::error("ngx", "core-host: initialize called twice on one instance");
+ return false;
+ }
+ if (device == nullptr || runtimeDir.empty() || projectId == nullptr || engineVersion == nullptr) {
+ status = Status::InvalidArgument;
+ veyra::log::error("ngx", "core-host: invalid initialize arguments");
+ return false;
+ }
+
+ const wchar_t* featurePaths[] = { runtimeDir.c_str() };
+ NVSDK_NGX_FeatureCommonInfo common{};
+ common.PathListInfo.Path = const_cast<const wchar_t**>(featurePaths);
+ common.PathListInfo.Length = 1;
+
+ uint32_t sehCode = 0;
+ const NVSDK_NGX_Result result = CallInitWithProjectId(projectId, NVSDK_NGX_ENGINE_TYPE_CUSTOM,
+ engineVersion, runtimeDir.c_str(), device, &common, NVSDK_NGX_Version_API, sehCode);
+ initResult_ = static_cast<uint64_t>(result);
+
+ veyra::log::info("ngx", std::format("core-host: Init_with_ProjectID result={} seh={} runtimeDirLen={} projectId={}",
+ veyra::ngxResultString(initResult_), sehCode, runtimeDir.size(), projectId));
+
+ if (result != NVSDK_NGX_Result_Success) {
+ status = Status::DeviceFailure;
+ return false;
+ }
+ device_ = device;
+ initialized_ = true;
+ veyra::log::info("ngx", "core-host: initialized (single core session for this device)");
+ return true;
+}
+
+void NgxCoreHost::shutdown()
+{
+ if (!initialized_) {
+ return;
+ }
+
+ // Reverse order: live parameter blocks first, then core shutdown.
+ while (liveParameterBlockCount_ > 0) {
+ NVSDK_NGX_Parameter* block = liveParameterBlocks_[--liveParameterBlockCount_];
+ veyra::log::warn("ngx", "core-host: destroying leaked parameter block at shutdown");
+ NVSDK_NGX_D3D12_DestroyParameters(block);
+ }
+
+ uint32_t sehCode = 0;
+ const NVSDK_NGX_Result result = CallShutdown1(device_, sehCode);
+ veyra::log::info("ngx", std::format("core-host: Shutdown1 result={} seh={}",
+ veyra::ngxResultString(static_cast<uint64_t>(result)), sehCode));
+
+ device_ = nullptr;
+ initialized_ = false;
+}
+
+NVSDK_NGX_Parameter* NgxCoreHost::allocateParameters(Status& status)
+{
+ if (!initialized_) {
+ status = Status::InvalidArgument;
+ veyra::log::error("ngx", "core-host: allocateParameters before initialize");
+ return nullptr;
+ }
+ if (liveParameterBlockCount_ >= 64) {
+ status = Status::InvalidArgument;
+ veyra::log::error("ngx", "core-host: parameter block tracking table full");
+ return nullptr;
+ }
+ NVSDK_NGX_Parameter* parameters = nullptr;
+ const NVSDK_NGX_Result result = NVSDK_NGX_D3D12_AllocateParameters(&parameters);
+ if (result != NVSDK_NGX_Result_Success || parameters == nullptr) {
+ status = Status::DeviceFailure;
+ veyra::log::error("ngx", std::format("core-host: AllocateParameters result={}",
+ veyra::ngxResultString(static_cast<uint64_t>(result))));
+ return nullptr;
+ }
+ liveParameterBlocks_[liveParameterBlockCount_++] = parameters;
+ return parameters;
+}
+
+void NgxCoreHost::destroyParameters(NVSDK_NGX_Parameter* parameters)
+{
+ if (parameters == nullptr) {
+ return;
+ }
+ bool tracked = false;
+ for (uint32_t i = 0; i < liveParameterBlockCount_; ++i) {
+ if (liveParameterBlocks_[i] == parameters) {
+ liveParameterBlocks_[i] = liveParameterBlocks_[--liveParameterBlockCount_];
+ tracked = true;
+ break;
+ }
+ }
+ if (!tracked) {
+ veyra::log::warn("ngx", "core-host: destroyParameters for an untracked block");
+ }
+ NVSDK_NGX_D3D12_DestroyParameters(parameters);
+}
+
+} // namespace veyra::ngx
diff --git a/tools/nr_harness/main.cpp b/tools/nr_harness/main.cpp
new file mode 100644
index 00000000..00efb2ad
--- /dev/null
+++ b/tools/nr_harness/main.cpp
@@ -0,0 +1,195 @@
+// veyra_nr_harness - Phase 1 Feature 18 native harness.
+// Modes (added task by task per the backlog):
+// --load-only --runtime-dir <abs> core init + snippet load + exports + teardown
+// Full frame-loop mode (Proxy -> Feature 18 -> Raw, 300 evaluates, captures,
+// JSON summary) arrives with P1.4-P1.6.
+#include <windows.h>
+#include <d3d12.h>
+
+#include <cstdint>
+#include <format>
+#include <fstream>
+#include <string>
+
+#include "veyra/FileIdentity.h"
+#include "veyra/Log.h"
+#include "veyra/NgxResult.h"
+#include "veyra/Result.h"
+#include "veyra/gfx/D3D12DeviceContext.h"
+#include "veyra/ngx/DlssNrRuntimeAdapter.h"
+#include "veyra/ngx/NgxCoreHost.h"
+
+namespace {
+
+constexpr uint64_t kExpectedDllSize = 165840496ull;
+const char* kExpectedDllSha256 = "E16BCF15E16E13F527491CDF7845B2FE6521A738D8F7C9C721866A8496E1FC8E";
+const wchar_t* kExpectedDllFileVersion = L"310.8.0.0";
+
+std::string narrow(const std::wstring& text)
+{
+ if (text.empty()) {
+ return {};
+ }
+ const int length = WideCharToMultiByte(CP_UTF8, 0, text.c_str(), static_cast<int>(text.size()), nullptr, 0, nullptr, nullptr);
+ if (length <= 0) {
+ return {};
+ }
+ std::string converted(static_cast<size_t>(length), '\0');
+ WideCharToMultiByte(CP_UTF8, 0, text.c_str(), static_cast<int>(text.size()), converted.data(), length, nullptr, nullptr);
+ return converted;
+}
+
+// Minimal string scan for the tiny identity file written once by
+// stage-runtime.ps1 ({"...": "value"} triplets only); not a general parser.
+std::string scanJsonStringField(const std::string& text, const char* key)
+{
+ const std::string needle = std::string("\"") + key + "\"";
+ size_t position = text.find(needle);
+ if (position == std::string::npos) {
+ return {};
+ }
+ position = text.find(':', position + needle.size());
+ if (position == std::string::npos) {
+ return {};
+ }
+ position = text.find('"', position);
+ if (position == std::string::npos) {
+ return {};
+ }
+ const size_t start = position + 1;
+ const size_t end = text.find('"', start);
+ if (end == std::string::npos) {
+ return {};
+ }
+ return text.substr(start, end - start);
+}
+
+struct LocalIdentity {
+ std::string projectId;
+ std::string engineVersion;
+};
+
+bool loadLocalIdentity(const std::wstring& runtimeDir, LocalIdentity& identity)
+{
+ const std::wstring configPath = runtimeDir + L"\\..\\config\\ngx-local.json";
+ std::ifstream stream(configPath, std::ios::binary);
+ if (!stream.is_open()) {
+ veyra::log::error("harness", std::format("load-only: identity file missing path={}", narrow(configPath)));
+ return false;
+ }
+ std::string text((std::istreambuf_iterator<char>(stream)), std::istreambuf_iterator<char>());
+ identity.projectId = scanJsonStringField(text, "ngxProjectId");
+ identity.engineVersion = scanJsonStringField(text, "engineVersion");
+ if (identity.projectId.empty() || identity.engineVersion.empty()) {
+ veyra::log::error("harness", "load-only: identity file missing ngxProjectId/engineVersion");
+ return false;
+ }
+ veyra::log::info("harness", std::format("load-only: local identity projectId={} engineVersion={}",
+ identity.projectId, identity.engineVersion));
+ return true;
+}
+
+int runLoadOnly(const std::wstring& runtimeDir)
+{
+ // 1. Device context (debug layer follows the build configuration).
+#if defined(VEYRA_D3D12_DEBUG)
+ constexpr bool kDebugLayerByBuild = true;
+#else
+ constexpr bool kDebugLayerByBuild = false;
+#endif
+ veyra::gfx::D3D12DeviceContext context;
+ veyra::gfx::DeviceContextDesc contextDesc{};
+ contextDesc.enableDebugLayer = kDebugLayerByBuild;
+ contextDesc.commandSlotCount = 4;
+ veyra::Status status = veyra::Status::Ok;
+ if (!context.initialize(contextDesc, status)) {
+ veyra::log::error("harness", std::format("load-only: device context failed status={}", veyra::statusString(status)));
+ return 6;
+ }
+
+ // 2. Local NGX identity (this machine only; not a distribution identity).
+ LocalIdentity identity{};
+ if (!loadLocalIdentity(runtimeDir, identity)) {
+ context.shutdown();
+ return 7;
+ }
+
+ // 3. Staged snippet identity against the pinned contract.
+ const std::wstring dllPath = runtimeDir + L"\\nvngx_dlssnr.dll";
+ veyra::FileIdentity dllIdentity{};
+ veyra::IdentityError dllError = veyra::IdentityError::None;
+ if (!veyra::computeFileIdentity(dllPath, dllIdentity, dllError) ||
+ dllIdentity.sizeBytes != kExpectedDllSize ||
+ dllIdentity.sha256Upper != kExpectedDllSha256 ||
+ !dllIdentity.signatureValid ||
+ !dllIdentity.signerIsNvidia ||
+ dllIdentity.fileVersion != kExpectedDllFileVersion) {
+ veyra::log::error("harness", std::format("load-only: staged runtime identity mismatch error={}",
+ veyra::identityErrorString(dllError)));
+ context.shutdown();
+ return 3;
+ }
+ veyra::log::info("harness", "load-only: staged runtime identity matches the pinned contract");
+
+ // 4. NGX core init (single session for this device).
+ veyra::ngx::NgxCoreHost coreHost;
+ if (!coreHost.initialize(context.device(), runtimeDir, identity.projectId.c_str(), identity.engineVersion.c_str(), status)) {
+ veyra::log::error("harness", std::format("load-only: core init failed result={} status={}",
+ veyra::ngxResultString(coreHost.initResult()), veyra::statusString(status)));
+ context.shutdown();
+ return 8;
+ }
+
+ // 5. Snippet load + exports.
+ veyra::ngx::DlssNrRuntimeAdapter adapter;
+ if (!adapter.load(runtimeDir, status)) {
+ veyra::log::error("harness", std::format("load-only: adapter load failed status={}", veyra::statusString(status)));
+ coreHost.shutdown();
+ context.shutdown();
+ return 9;
+ }
+
+ // 6. Reverse-order teardown: snippet module -> core -> device.
+ adapter.unload();
+ coreHost.shutdown();
+ context.shutdown();
+ veyra::log::info("harness", "load-only: PASS");
+ return 0;
+}
+
+} // namespace
+
+int wmain(int argc, wchar_t** argv)
+{
+ std::wstring runtimeDir;
+ std::wstring logFile;
+ bool loadOnly = false;
+ for (int i = 1; i < argc; ++i) {
+ const std::wstring arg = argv[i];
+ if (arg == L"--load-only") {
+ loadOnly = true;
+ }
+ else if (arg == L"--runtime-dir" && i + 1 < argc) {
+ runtimeDir = argv[++i];
+ }
+ else if (arg == L"--log-file" && i + 1 < argc) {
+ logFile = argv[++i];
+ }
+ }
+
+ if (!logFile.empty()) {
+ (void)veyra::Logger::instance().openFile(logFile);
+ }
+
+ int exitCode = 0;
+ if (loadOnly && !runtimeDir.empty()) {
+ exitCode = runLoadOnly(runtimeDir);
+ }
+ else {
+ veyra::log::info("harness", "no mode selected; use --load-only --runtime-dir <abs> (frame loop arrives in P1.4-P1.6)");
+ exitCode = 1;
+ }
+
+ veyra::Logger::instance().closeFile();
+ return exitCode;
+}
diff --git a/tools/runtime_probe/main.cpp b/tools/runtime_probe/main.cpp
index edd88979..c708ac07 100644
--- a/tools/runtime_probe/main.cpp
+++ b/tools/runtime_probe/main.cpp
@@ -658,7 +658,7 @@ int runSelfTest(const std::wstring& runtimeDir)
const std::string hrOk = veyra::hresultString(0);
const std::string hrRemoved = veyra::hresultString(0x887A0005L);
const std::string hrUnknown = veyra::hresultString(0x8000FFFFL);
- const std::string ngxOk = veyra::ngxResultString(0x300000ull);
+ const std::string ngxOk = veyra::ngxResultString(0x1); // NVSDK_NGX_Result_Success per SDK 310.7 header
if (hrOk.find("S_OK") == std::string::npos ||
hrRemoved.find("DXGI_ERROR_DEVICE_REMOVED") == std::string::npos ||
hrUnknown.find("0x8000FFFF") == std::string::npos ||