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

Validate loaded AMD runtime configuration and refresh FSR reset contract

Veyra Goal Agent83aa06f0f5a5
diff --git a/src/pipeline/LmxxfNrBackend.cpp b/src/pipeline/LmxxfNrBackend.cpp
index b5d9fb3b..ebf7e31f 100644
--- a/src/pipeline/LmxxfNrBackend.cpp
+++ b/src/pipeline/LmxxfNrBackend.cpp
@@ -52,22 +52,28 @@ bool LmxxfNrBackend::open(const std::filesystem::path& directory, ID3D12Device*
// The add-on's sRGB input mode is incompatible with Veyra's linear FP16
// contract. Runtime flags ignore that file key, but a process environment
// override still reaches the upstream codec. Do not silently change it.
- const auto* srgb=std::getenv("DLSS5_CODEC_SRGB");
- const auto* adaptive=std::getenv("DLSS5_VIT_ADAPTIVE");
- const auto hiddenHistory=[] {
+ const auto compatibleEnvironment=[this] {
+ const auto* srgb=std::getenv("DLSS5_CODEC_SRGB");
+ const auto* adaptive=std::getenv("DLSS5_VIT_ADAPTIVE");
+ if((srgb&&std::string_view(srgb)=="1")||(!caps_.history_supported&&adaptive&&*adaptive&&std::string_view(adaptive)!="0"))return false;
for(const auto* key:{"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 true;
+ if(value&&*value&&std::string_view(value)!="0")return false;
}
- return false;
+ return true;
};
- if((srgb&&std::string_view(srgb)=="1") || (!caps_.history_supported&&adaptive&&std::string_view(adaptive)!="0"&&*adaptive) || hiddenHistory()){
+ const auto rejectEnvironment=[&] {
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();
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 NR
- if (!result(api_.Create(&info, &context_), "Create") || !context_ || !result(api_.PrepareSession(context_), "PrepareSession")) { close(); return false; }
+ if (!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 (!result(api_.PrepareSession(context_), "PrepareSession")) { close(); return false; }
queue_ = queue;
static std::atomic<uint64_t> next{1}; session_ = next++;
log::info("amd-nr", std::format("lmxxf 0.44 model={} ABI={} session={} maxInput={}x{}; module metadata admitted, HIP inference initializes on first frame", performance ? "Small" : "Original", api_.abi_version, session_, caps_.max_input_width, caps_.max_input_height));
diff --git a/tests/integration/LmxxfNrGraphTests.cpp b/tests/integration/LmxxfNrGraphTests.cpp
index ebcb1b2f..49649f60 100644
--- a/tests/integration/LmxxfNrGraphTests.cpp
+++ b/tests/integration/LmxxfNrGraphTests.cpp
@@ -67,7 +67,10 @@ void checkSrHandoff(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing& ring,unsi
worst=std::max(worst,error);if(f==0)first=error;last=error;
}
const auto nr=graph.metrics().nrEvaluateCount,sr=graph.metrics().srEvaluateCount;
- const uint64_t expectedSr=c.fsr?(c.flow?4:6):0;
+ // Since 108cbaab (2026-10-10), FSR reconstructs all source frames:
+ // first/reset frames use zero guidance instead of bypassing the effect.
+ // The original 10-07 fixture's four-dispatch expectation is obsolete.
+ const uint64_t expectedSr=c.fsr?6:0;
const bool pass=executed&&worst<=3&&nr==uint64_t(c.layers)*6&&sr==expectedSr;
ring.drainQueue();graph.shutdown();av_frame_free(&frame);++checks;failures+=!pass;
std::cout<<"AMD_NR_SR_MARKER case="<<c.name<<" output="<<gd.workWidth<<'x'<<gd.workHeight
diff --git a/tests/unit/LmxxfNrFakeRuntime.cpp b/tests/unit/LmxxfNrFakeRuntime.cpp
index 881f5c64..a901b90a 100644
--- a/tests/unit/LmxxfNrFakeRuntime.cpp
+++ b/tests/unit/LmxxfNrFakeRuntime.cpp
@@ -8,6 +8,7 @@
#include <cstring>
#include <cstdint>
#include <atomic>
+#include <cstdlib>
using Microsoft::WRL::ComPtr;
#ifndef VEYRA_TEST_MODEL_MODE
#define VEYRA_TEST_MODEL_MODE 0
@@ -24,7 +25,7 @@ struct Session {
};
std::string mode(){char b[64]{};GetEnvironmentVariableA("VEYRA_TEST_LMXXF_MODE",b,sizeof(b));return b;}
int caps(LmxxfNrCapabilities* p){p->abi_version=1;p->max_input_width=1920;p->max_input_height=1080;return 0;}
-int create(const LmxxfNrCreateInfo* p,void** out){if(p->flags||!p->device||!p->queue)return 2;auto* s=new Session;s->device=static_cast<ID3D12Device*>(p->device);s->queue=static_cast<ID3D12CommandQueue*>(p->queue);*out=s;++creates;return 0;}
+int create(const LmxxfNrCreateInfo* p,void** out){if(p->flags||!p->device||!p->queue)return 2;auto* s=new Session;s->device=static_cast<ID3D12Device*>(p->device);s->queue=static_cast<ID3D12CommandQueue*>(p->queue);*out=s;++creates;if(mode()=="hidden-config")_putenv_s("DLSS5_TEMPORAL_MODE","1");return 0;}
int destroy(void* p){delete static_cast<Session*>(p);return 0;}
int ok(void*){return 0;}
int prepare(void* p,const LmxxfNrFrameInfo* info,LmxxfNrJob* job){
diff --git a/tests/unit/LmxxfNrTests.cpp b/tests/unit/LmxxfNrTests.cpp
index 50d9ff37..31ec4b0c 100644
--- a/tests/unit/LmxxfNrTests.cpp
+++ b/tests/unit/LmxxfNrTests.cpp
@@ -28,6 +28,10 @@ int main(){
check(nr.open(directory,ctx.device(),ctx.directQueue(),0x1002,true)&&
original.open(directory,ctx.device(),ctx.directQueue(),0x1002,false),"Small and Original sessions coexist");
original.close();nr.close();
+ SetEnvironmentVariableW(L"VEYRA_TEST_LMXXF_MODE",L"hidden-config");
+ check(!nr.open(directory,ctx.device(),ctx.directQueue(),0x1002),"runtime config cannot enable hidden history after host preflight");
+ _putenv_s("DLSS5_TEMPORAL_MODE","");
+ SetEnvironmentVariableW(L"VEYRA_TEST_LMXXF_MODE",nullptr);
SetEnvironmentVariableW(L"VEYRA_TEST_LMXXF_MODE",L"bad-table");
check(!nr.open(directory,ctx.device(),ctx.directQueue(),0x1002),"incomplete ABI is rejected");
SetEnvironmentVariableW(L"VEYRA_TEST_LMXXF_MODE",nullptr);