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++
Validate effective AMD controls inside the runtime CRT
Veyra Goal Agentc0ead6f9602c
diff --git a/scripts/amd-nr/stage-044-runtime.py b/scripts/amd-nr/stage-044-runtime.pyindex d132c118..2f443bce 100644--- a/scripts/amd-nr/stage-044-runtime.py+++ b/scripts/amd-nr/stage-044-runtime.py@@ -58,9 +58,10 @@ modules=[]for name,mode in (('LmxxfNrRuntime.dll',0),('LmxxfNrRuntime-Original.dll',1)):dll=ctypes.WinDLL(str((a.out/name).resolve()),winmode=0x1100);modules.append(dll)dll.VeyraLmxxfModelMode.restype=ctypes.c_uint32+ dll.VeyraLmxxfControlsCompatible.restype=ctypes.c_uint32dll.VeyraLmxxfModelAssetsReady.argtypes=[ctypes.c_wchar_p]dll.VeyraLmxxfModelAssetsReady.restype=ctypes.c_uint32- if dll.VeyraLmxxfModelMode()!=mode or not dll.VeyraLmxxfModelAssetsReady(str((a.out/'assets').resolve())):+ if dll.VeyraLmxxfModelMode()!=mode or not dll.VeyraLmxxfControlsCompatible() or not dll.VeyraLmxxfModelAssetsReady(str((a.out/'assets').resolve())):raise SystemExit('Actual model selector/asset preflight failed')if mode==0 and dll.VeyraLmxxfModelAssetsReady(str(a.out/'missing-assets')):raise SystemExit('Missing Small assets wrongly accepted')diff --git a/scripts/amd-nr/veyra-runtime-model.cpp b/scripts/amd-nr/veyra-runtime-model.cppindex c13f1ffc..80cb692b 100644--- a/scripts/amd-nr/veyra-runtime-model.cpp+++ b/scripts/amd-nr/veyra-runtime-model.cpp@@ -1,6 +1,8 @@// SPDX-License-Identifier: GPL-3.0-only// Veyra adapter; the linked inference implementation is lmxxf 0.44 (MIT).#include <cstdint>+#include <cstdlib>+#include <string_view>#include "native_model_mode.h"#include "small_model_assets.h"// Reports the very selector used by the compiled network, rather than a label@@ -8,6 +10,16 @@extern "C" __declspec(dllexport) uint32_t VeyraLmxxfModelMode() {return dlss5_mode::Requested();}+// The host may use a different CRT. Inspect the same environment copy read by+// the network after LoadFlagsFileOnce, rather than the host's stale getenv().+extern "C" __declspec(dllexport) uint32_t VeyraLmxxfControlsCompatible() {+ for (const auto* key : {"DLSS5_CODEC_SRGB", "DLSS5_VIT_ADAPTIVE",+ "DLSS5_TEMPORAL_MODE", "DLSS5_FAST_HISTORY", "DLSS5_TEMPORAL_HISTORY_EXPERIMENT"}) {+ const auto* value=std::getenv(key);+ if(value&&*value&&std::string_view(value)!="0")return 0;+ }+ return 1;+}// Use the network's own structural preflight. Without this check upstream can// silently fall back to the original network when a Small weight is missing.extern "C" __declspec(dllexport) uint32_t VeyraLmxxfModelAssetsReady(const wchar_t* assets) {diff --git a/src/pipeline/LmxxfNrBackend.cpp b/src/pipeline/LmxxfNrBackend.cppindex ebf7e31f..870aab31 100644--- a/src/pipeline/LmxxfNrBackend.cpp+++ b/src/pipeline/LmxxfNrBackend.cpp@@ -27,7 +27,8 @@ bool LmxxfNrBackend::open(const std::filesystem::path& directory, ID3D12Device*if (!module_) { error_ = std::format("{} load failed win32={}", path.filename().string(), GetLastError()); log::error("amd-nr", error_); return false; }const auto modelMode = reinterpret_cast<uint32_t (*)()>(GetProcAddress(module_, "VeyraLmxxfModelMode"));const auto assetsReady = reinterpret_cast<uint32_t (*)(const wchar_t*)>(GetProcAddress(module_, "VeyraLmxxfModelAssetsReady"));- if (!modelMode || !assetsReady || modelMode() != (performance ? 0u : 1u)) {+ const auto controlsCompatible = reinterpret_cast<uint32_t (*)()>(GetProcAddress(module_, "VeyraLmxxfControlsCompatible"));+ if (!modelMode || !assetsReady || !controlsCompatible || modelMode() != (performance ? 0u : 1u)) {error_ = "AMD NR model module mismatch: install the complete Veyra lmxxf 0.44 runtime";log::error("amd-nr", error_); close(); return false;}@@ -66,13 +67,13 @@ bool LmxxfNrBackend::open(const std::filesystem::path& directory, ID3D12Device*error_="Veyra AMD NR requires linear input and Veyra-owned history: set DLSS5_CODEC_SRGB, DLSS5_VIT_ADAPTIVE, DLSS5_TEMPORAL_MODE, DLSS5_FAST_HISTORY and DLSS5_TEMPORAL_HISTORY_EXPERIMENT to 0";log::error("amd-nr",error_);close();return false;};- if(!compatibleEnvironment())return rejectEnvironment();+ if(!compatibleEnvironment()||!controlsCompatible())return rejectEnvironment();LmxxfNrCreateInfo info{}; info.struct_size = sizeof(info); info.device = device; info.queue = queue;info.assets_directory = assets.c_str(); // flags=0: a failed network is never passed off as NRif (!result(api_.Create(&info, &context_), "Create") || !context_) { close(); return false; }// Create reads the runtime's local config. Recheck after it, not only the// inherited environment, before unsupported internal history can run.- if(!compatibleEnvironment())return rejectEnvironment();+ if(!compatibleEnvironment()||!controlsCompatible())return rejectEnvironment();if (!result(api_.PrepareSession(context_), "PrepareSession")) { close(); return false; }queue_ = queue;static std::atomic<uint64_t> next{1}; session_ = next++;diff --git a/tests/unit/LmxxfNrFakeRuntime.cpp b/tests/unit/LmxxfNrFakeRuntime.cppindex a901b90a..4d51d4d4 100644--- a/tests/unit/LmxxfNrFakeRuntime.cpp+++ b/tests/unit/LmxxfNrFakeRuntime.cpp@@ -79,6 +79,10 @@ extern "C" __declspec(dllexport) uint32_t VeyraLmxxfModelMode(){return mode()=="wrong-model" ? 2 : VEYRA_TEST_MODEL_MODE;}extern "C" __declspec(dllexport) uint32_t VeyraTestLmxxfCreates(){return creates.load();}+extern "C" __declspec(dllexport) uint32_t VeyraLmxxfControlsCompatible(){+ const auto* temporal=std::getenv("DLSS5_TEMPORAL_MODE");+ return !temporal||!*temporal||std::string(temporal)=="0";+}extern "C" __declspec(dllexport) uint32_t VeyraLmxxfModelAssetsReady(const wchar_t*){return mode()!="missing-small";}