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++
Integrate AMD NR 0.44 with isolated Small and Original models
Veyra Goal Agent09f364c0b326
diff --git a/CMakeLists.txt b/CMakeLists.txtindex 3d73abd9..8f95acb2 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -392,10 +392,18 @@ target_compile_features(veyra_lmxxf_fake_runtime PRIVATE cxx_std_20)target_compile_definitions(veyra_lmxxf_fake_runtime PRIVATE LMXXF_NR_RUNTIME_EXPORTS NOMINMAX WIN32_LEAN_AND_MEAN)target_link_libraries(veyra_lmxxf_fake_runtime PRIVATE d3d12 dxgi dxguid)set_target_properties(veyra_lmxxf_fake_runtime PROPERTIES OUTPUT_NAME LmxxfNrRuntime RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lmxxf-test-runtime")+add_library(veyra_lmxxf_fake_original_runtime SHARED tests/unit/LmxxfNrFakeRuntime.cpp)+target_compile_features(veyra_lmxxf_fake_original_runtime PRIVATE cxx_std_20)+target_compile_definitions(veyra_lmxxf_fake_original_runtime PRIVATE LMXXF_NR_RUNTIME_EXPORTS NOMINMAX WIN32_LEAN_AND_MEAN VEYRA_TEST_MODEL_MODE=1)+target_link_libraries(veyra_lmxxf_fake_original_runtime PRIVATE d3d12 dxgi dxguid)+set_target_properties(veyra_lmxxf_fake_original_runtime PROPERTIES OUTPUT_NAME LmxxfNrRuntime-Original RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lmxxf-test-runtime")add_executable(veyra_lmxxf_nr_tests tests/unit/LmxxfNrTests.cpp)target_compile_features(veyra_lmxxf_nr_tests PRIVATE cxx_std_20)target_link_libraries(veyra_lmxxf_nr_tests PRIVATE veyra_pipeline)-add_dependencies(veyra_lmxxf_nr_tests veyra_lmxxf_fake_runtime)+add_dependencies(veyra_lmxxf_nr_tests veyra_lmxxf_fake_runtime veyra_lmxxf_fake_original_runtime)+add_executable(veyra_lmxxf_runtime_metadata_tests tests/integration/LmxxfNrRuntimeMetadataTests.cpp)+target_compile_features(veyra_lmxxf_runtime_metadata_tests PRIVATE cxx_std_20)+target_link_libraries(veyra_lmxxf_runtime_metadata_tests PRIVATE veyra_pipeline)add_dependencies(veyra_pipeline veyra_shader_color_grade veyra_shader_color_detail_reduce veyra_shader_color_detail_blur veyra_shader_color_detail_apply)add_executable(veyra_pipeline_tests@@ -875,8 +883,8 @@ if(VEYRA_FFMPEG_ROOT AND EXISTS "${VEYRA_FFMPEG_ROOT}/include/libavformat/avform# on the actual test adapter. Production graph and hardware policy are unchanged.set(VEYRA_AMD_NR_TEST_GRAPH_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/src/pipeline/EnhanceGraph.cpp" CACHE FILEPATH "Graph snapshot for AMD identity regression only")file(READ "${VEYRA_AMD_NR_TEST_GRAPH_SOURCE}" _amd_nr_graph)- string(REPLACE "ring_.queue(),context_.adapter().vendorId) || !instance->amd->admits"- "ring_.queue(),0x1002 /* identity fixture only */) || !instance->amd->admits" _amd_nr_graph "${_amd_nr_graph}")+ string(REPLACE "ring_.queue(),context_.adapter().vendorId,instance->model.performance) || !instance->amd->admits"+ "ring_.queue(),0x1002 /* identity fixture only */,instance->model.performance) || !instance->amd->admits" _amd_nr_graph "${_amd_nr_graph}")file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/amd-nr-graph-test")file(WRITE "${CMAKE_BINARY_DIR}/amd-nr-graph-test/EnhanceGraph.cpp" "${_amd_nr_graph}")set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${VEYRA_AMD_NR_TEST_GRAPH_SOURCE}")@@ -886,7 +894,7 @@ if(VEYRA_FFMPEG_ROOT AND EXISTS "${VEYRA_FFMPEG_ROOT}/include/libavformat/avformtarget_compile_definitions(veyra_amd_nr_graph_tests PRIVATE $<TARGET_PROPERTY:veyra_pipeline,COMPILE_DEFINITIONS>)target_compile_options(veyra_amd_nr_graph_tests PRIVATE /utf-8 /WX-)target_link_libraries(veyra_amd_nr_graph_tests PRIVATE veyra_pipeline veyra_sinks)- add_dependencies(veyra_amd_nr_graph_tests veyra_lmxxf_fake_runtime)+ add_dependencies(veyra_amd_nr_graph_tests veyra_lmxxf_fake_runtime veyra_lmxxf_fake_original_runtime)target_compile_features(veyra_export_workflow_tests PRIVATE cxx_std_20)target_compile_options(veyra_export_workflow_tests PRIVATE /utf-8)target_link_libraries(veyra_export_workflow_tests PRIVATE veyra_engine)diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.mdindex 799e2846..3e07441e 100644--- a/THIRD_PARTY_NOTICES.md+++ b/THIRD_PARTY_NOTICES.md@@ -801,6 +801,20 @@ The user-approved, unmodified NVIDIA-signed 310.8.0.0 NR (SHA256 E16BCF15E16E13F## lmxxf AMD NR local integration (2026-10-03)+2026-10-18 local upgrade: fixed MIT source `4764e4f1a24f5234b8e29952dc41f493b2d77c90`+(0.44 F9 hotfix). User-provided archive SHA256+`cf812fe7909fbd53b38f54da8abd584698525f81f7ea71cab19ba14bab48e030`.+The public C ABI header is unchanged. `third_party/lmxxf/veyra-model-isolation.patch`+adapts `src/native_model_mode.h` and `src/native_hot_flags.h` to select Small or+Original per independently built module and disable add-on hotkeys/config polling.+Veyra's model-query/asset-preflight exports use upstream's actual selector and+Small asset validator. Inference/codec math and weights/kernels are unchanged.+Build/staging recipes, changed host files and limits are documented in+`third_party/lmxxf/VEYRA_ORIGIN.md` and `docs/AMD_NR_044_PLAN_2026-10-18.md`.+NVIDIA-derived weights and HIP modules remain external binary assets, not MIT+source. No AMD inference, quality or performance claim follows from host tests.+The following 0.39 identity is preserved as historical provenance.+Veyra calls the independent MIT C ABI from[lmxxf/dlss5-on-amd-9070xt-porting](https://github.com/lmxxf/dlss5-on-amd-9070xt-porting),fixed commit `78f548749e74824327b8458c57be31a1df78376a`, Copyright (c) 2026 Kien.diff --git a/docs/WORKLOG.md b/docs/WORKLOG.mdindex baa18985..45f8a383 100644--- a/docs/WORKLOG.md+++ b/docs/WORKLOG.md@@ -9719,3 +9719,10 @@ final-audit.py pre已通过82旧树/94旧分支/509脏文件与main b571a44不## 2026-10-18 AMD NR0.44隔离接入开工用户下载并提供0.44 Magpie包,要求新分支接入且Claude同时施工不得干扰。main26c0d61→codex/amd-nr-044-20261018;88原树/101分支/509脏文件和已verify source-before.bundle在archives/amd-nr-044-20261018。用户ZIP447952711bytes/SHA cf812fe7…48e030与作者热修一致,875内部SHA全部匹配,80模块/93Small权重加manifest;原件只读,提取到独立deps。固定MIT源码4764e4f1(与release.json一致),C ABI头与旧Veyra逐字节相同,开始审计/独立重编译。首次提取夹具误写Python编码utf8-sig,在读清单前失败,改utf-8-sig后全验证成功,无产品修改。Claude当前AA工作只读核对,不碰其分支/运行目录,不派Agent或发跨任务消息。计划AMD_NR_044_PLAN_2026-10-18.md;新产物全E盘,CPU限并发、GPU测试前核对空闲。不合main/push/发布/改驱动或用户配置/关机。真实AMD推理与画质性能未验。+++### 2026-10-18 AMD NR0.44模型接入与首轮构建+- 同一既有performance参数接入AMD,默认Small/关闭Original;列表/节点/设置重建与关闭效果编辑合同统一,NVIDIA NGX preset不变。公共C ABI逐字节不变,两个独立MIT源码模块固定实际model selector,共享原样权重/内核,禁上游F9与配置轮询,不逐帧改全局环境。真实Small资源预检拒绝缺权重时静默回原模型。+- 上游直接MSVC构建失败:Windows rpcndr small宏与新版bool small冲突、缺utf8。兼容头含D3D12后undef small,增加/utf-8;原源码只在本任务build/source副本施加可复现patch,外部固定checkout不改。初版patch CRLF导致git apply不匹配,规范LF后通过。两模块真实编译通过:logs/amd-nr-044-20261018/runtime-small-03.json、runtime-original-01.json;上游现有C4244告警保留。+- 新stage-044-runtime.py只读验证用户ZIP875条SHA,再部署279旧新权重、80HIP模块及必要codec/许可证;未提取执行Magpie/proxy/driver/add-on。两个真实模块同时加载检查其实际selector和上游Small structural preflight,正式模型与fake合同测试物理分开。0.39脚本保留作历史。+- 增加混合模型真实D3D12合同计数(fake)、磁盘AMD预设/会话恢复、真实runtime元数据/缺资源/错模块测试;这些均不等同HIP推理。四语言新增Small提示。不提高UI33ms/250ms刷新率,Claude树不动。接下来提交输入、限-j2构建13目标并定向执行。diff --git a/i18n/catalog.json b/i18n/catalog.jsonindex 2a6e2f10..970825c7 100644--- a/i18n/catalog.json+++ b/i18n/catalog.json@@ -7351,6 +7351,13 @@"en": "Switches, progress, selected state","ja": "スイッチ、進行状況、選択状態"},+ {+ "zh": "开启使用 Small 模型;关闭使用原模型。每层独立选择,切换会重建 NR,画面可能有所不同。",+ "src": "qml/NrLayerEditor.qml",+ "zh-TW": "開啟使用 Small 模型;關閉使用原模型。每層獨立選擇,切換會重建 NR,畫面可能有所不同。",+ "en": "On: Small model. Off: Original model. Each layer selects independently. Switching rebuilds NR and may change the picture.",+ "ja": "オン:Small モデル。オフ:元のモデル。各レイヤーで個別に選択します。切り替えると NR を再構築し、画面が変わる場合があります。"+ },{"zh": "开启使用新版模型 B;关闭使用旧版模型 A。切换会重建 NR,画面可能有所不同。","src": "qml/NrLayerEditor.qml",diff --git a/include/veyra/engine/EnhancementSettings.h b/include/veyra/engine/EnhancementSettings.hindex d5a5807a..6b4a5679 100644--- a/include/veyra/engine/EnhancementSettings.h+++ b/include/veyra/engine/EnhancementSettings.h@@ -141,7 +141,7 @@ constexpr std::string_view opticalFlowBackendName(OpticalFlowBackend backend) {struct NrSettings {float intensity=1,tone=1,structure=1,skin=-1;int32_t style=0,autoMask=0,uiCorrection=0;- bool performance=true; // SF 310.9.16: preset B; false selects legacy A.+ bool performance=true; // SF: B/A; AMD 0.44: Small/Original. Create-time model choice.bool operator==(const NrSettings&) const = default;};// Create-time I32 contract, verified against both embedded models in the@@ -149,6 +149,12 @@ struct NrSettings {constexpr int32_t nrRenderPreset(NrRuntime runtime,const NrSettings& model) {return currentNrRuntime(runtime)==NrRuntime::Ampere ? (model.performance?2:1) : 0;}+constexpr bool nrUsesPerformanceModel(NrRuntime runtime) {+ return currentNrRuntime(runtime)==NrRuntime::Ampere || runtime==NrRuntime::LmxxfAmd;+}+constexpr int32_t nrModelSelection(NrRuntime runtime,const NrSettings& model) {+ return nrUsesPerformanceModel(runtime) ? (model.performance?2:1) : 0;+}struct NrCorrectionSettings {bool enabled=false,automatic=true;// Manual values survive switching automatic control on and off.@@ -279,14 +285,14 @@ struct EnhancementSettings {}bool sameNrTopology(const EnhancementSettings& other) const {if(nrLayerCount!=other.nrLayerCount)return false;- if(nrRenderPreset(nrRuntime,model)!=nrRenderPreset(other.nrRuntime,other.model))return false;+ if(nrModelSelection(nrRuntime,model)!=nrModelSelection(other.nrRuntime,other.model))return false;if(residual.correction.enabled!=other.residual.correction.enabled||usesNrTemporal()!=other.usesNrTemporal())return false;for(uint32_t i=0;i<nrLayerCount&&i<nrLayers.size();++i){const auto& a=nrLayers[i]; const auto& b=other.nrLayers[i];if(a.enabled!=b.enabled||a.temporal!=b.temporal||a.usesTemporal()!=b.usesTemporal()||a.residual.correction.enabled!=b.residual.correction.enabled||a.runtime!=b.runtime||a.lowLatencyPairing!=b.lowLatencyPairing||a.sizePolicy!=b.sizePolicy||- nrRenderPreset(a.runtime,a.model)!=nrRenderPreset(b.runtime,b.model))return false;+ nrModelSelection(a.runtime,a.model)!=nrModelSelection(b.runtime,b.model))return false;}return true;}@@ -377,14 +383,14 @@ struct EnhancementSettings {active.nrMotion=defaults.nrMotion;active.nrLayers=defaults.nrLayers;}else{active.nrRuntime=currentNrRuntime(active.nrRuntime);- if(active.nrRuntime!=NrRuntime::Ampere)active.model.performance=defaults.model.performance;+ if(!nrUsesPerformanceModel(active.nrRuntime))active.model.performance=defaults.model.performance;if(!active.residual.correction.enabled)active.residual.correction={};if(!active.nrTemporal)active.nrAntiFlicker=defaults.nrAntiFlicker;for(size_t i=0;i<active.nrLayers.size();++i){auto& layer=active.nrLayers[i];if(i>=nrLayerCount||!layer.enabled){layer={};continue;}layer.runtime=currentNrRuntime(layer.runtime);- if(layer.runtime!=NrRuntime::Ampere)layer.model.performance=defaults.model.performance;+ if(!nrUsesPerformanceModel(layer.runtime))layer.model.performance=defaults.model.performance;if(!layer.residual.correction.enabled)layer.residual.correction={};if(!layer.temporal)layer.antiFlicker=NrAntiFlicker::Flow;}diff --git a/include/veyra/pipeline/LmxxfNrBackend.h b/include/veyra/pipeline/LmxxfNrBackend.hindex 577c745a..dd31597e 100644--- a/include/veyra/pipeline/LmxxfNrBackend.h+++ b/include/veyra/pipeline/LmxxfNrBackend.h@@ -14,7 +14,7 @@ public:LmxxfNrBackend() = default;LmxxfNrBackend(const LmxxfNrBackend&) = delete;LmxxfNrBackend& operator=(const LmxxfNrBackend&) = delete;- bool open(const std::filesystem::path& directory, ID3D12Device*, ID3D12CommandQueue*, uint32_t vendor);+ bool open(const std::filesystem::path& directory, ID3D12Device*, ID3D12CommandQueue*, uint32_t vendor, bool performance = true);void close() noexcept;bool ready() const { return context_ != nullptr; }bool admits(uint32_t width, uint32_t height) const;diff --git a/qml/Veyra/NrLayerEditor.qml b/qml/Veyra/NrLayerEditor.qmlindex 5548e38a..8faa4181 100644--- a/qml/Veyra/NrLayerEditor.qml+++ b/qml/Veyra/NrLayerEditor.qml@@ -92,10 +92,10 @@ ColumnLayout {}VRow {objectName: "nr-performance-row"- visible: !editor.amdNrlabel: qsTr("启用性能优化版")- hint: qsTr("开启使用新版模型 B;关闭使用旧版模型 A。切换会重建 NR,画面可能有所不同。")- enabled: editor.layerData.runtime === 2 && Support.available(veyra, "nr2")+ hint: editor.amdNr ? qsTr("开启使用 Small 模型;关闭使用原模型。每层独立选择,切换会重建 NR,画面可能有所不同。")+ : qsTr("开启使用新版模型 B;关闭使用旧版模型 A。切换会重建 NR,画面可能有所不同。")+ enabled: (editor.layerData.runtime === 2 || editor.amdNr) && Support.available(veyra, "nr" + editor.layerData.runtime)opacity: enabled ? 1 : 0.4VSwitch {objectName: "nr-performance"diff --git a/scripts/amd-nr/build-lmxxf-runtime.py b/scripts/amd-nr/build-lmxxf-runtime.pyindex 16703a80..93514d3c 100644--- a/scripts/amd-nr/build-lmxxf-runtime.py+++ b/scripts/amd-nr/build-lmxxf-runtime.py@@ -1,10 +1,11 @@"""Build the pinned MIT runtime from its original checkout; no injection module."""-import argparse, hashlib, json, os, re, subprocess+import argparse, hashlib, json, os, re, shutil, subprocessfrom pathlib import PathPIN = '4764e4f1a24f5234b8e29952dc41f493b2d77c90' #0.44 F9 hotfix; source stays outside Git.p = argparse.ArgumentParser()p.add_argument('--source', type=Path, required=True)+p.add_argument('--model', choices=('small','original'), default='small')p.add_argument('--build', type=Path, required=True)p.add_argument('--tmp', type=Path, required=True)p.add_argument('--log', type=Path, required=True)@@ -38,14 +39,36 @@ if not attributes or any(x != 'noinline' for x in attributes):for target in (a.build,a.tmp,a.log.parent):target.resolve().relative_to(Path('E:/项目/Veyra').resolve())target.mkdir(parents=True,exist_ok=True)+# Compile isolated copies of the same MIT implementation. The model selector is+# fixed per DLL, so different NR layers never exchange a process-global mode and+# upstream game hotkeys cannot write to Veyra's configuration. Weights/kernels+# are neither copied into the build tree nor modified.+build_source = a.build/'source'+inputs = {}+for directory in ('src','include','Development/HIP'):+ for file in (source/directory).rglob('*'):+ if file.is_file() and file.suffix.lower() in ('.h','.hpp','.c','.cpp','.inc','.inl'):+ name=file.relative_to(source);target=build_source/name+ target.parent.mkdir(parents=True,exist_ok=True)+ data=file.read_bytes();inputs[name.as_posix()]=hashlib.sha256(data).hexdigest()+ target.write_text(data.decode('utf8').replace('\r\n','\n'),encoding='utf8',newline='\n')+patch = Path(__file__).resolve().parents[2]/'third_party/lmxxf/veyra-model-isolation.patch'+subprocess.run(['git','apply','--check',str(patch)],cwd=build_source,check=True)+subprocess.run(['git','apply',str(patch)],cwd=build_source,check=True)+model_source=Path(__file__).with_name('veyra-runtime-model.cpp').resolve()+output_name='LmxxfNrRuntime.dll' if a.model=='small' else 'LmxxfNrRuntime-Original.dll'script = a.tmp/'lmxxf-build.cmd'-script.write_text('@echo off\ncall "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat" >nul 2>&1\nif errorlevel 1 exit /b 4\ncd /d "%LMXXF_TASK_BUILD%"\ncl /nologo /std:c++17 /EHsc /O2 /LD /MD /FI"%LMXXF_TASK_COMPAT%" /DNOMINMAX /D_WIN32_WINNT=0x0A00 /DLMXXF_NR_RUNTIME_EXPORTS /I"%LMXXF_TASK_SOURCE%\\include" /I"%LMXXF_TASK_SOURCE%\\src" /I"%LMXXF_TASK_SOURCE%\\Development\\HIP" "%LMXXF_TASK_SOURCE%\\src\\LmxxfNrRuntime.cpp" /Fe:LmxxfNrRuntime.dll /link d3d12.lib dxgi.lib d3dcompiler.lib dxguid.lib user32.lib\nexit /b %errorlevel%\n',encoding='ascii')+script.write_text('@echo off\ncall "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat" >nul 2>&1\nif errorlevel 1 exit /b 4\ncd /d "%LMXXF_TASK_BUILD%"\ncl /nologo /std:c++17 /utf-8 /EHsc /O2 /LD /MD /DVEYRA_LMXXF_MODEL_MODE=%LMXXF_TASK_MODEL% /FI"%LMXXF_TASK_COMPAT%" /DNOMINMAX /D_WIN32_WINNT=0x0A00 /DLMXXF_NR_RUNTIME_EXPORTS /I"%LMXXF_TASK_SOURCE%\\include" /I"%LMXXF_TASK_SOURCE%\\src" /I"%LMXXF_TASK_SOURCE%\\Development\\HIP" "%LMXXF_TASK_SOURCE%\\src\\LmxxfNrRuntime.cpp" \"%LMXXF_TASK_MODEL_SOURCE%\" /Fe:%LMXXF_TASK_OUTPUT% /link d3d12.lib dxgi.lib d3dcompiler.lib dxguid.lib user32.lib\nexit /b %errorlevel%\n',encoding='ascii')env=os.environ.copy()-env.update(LMXXF_TASK_SOURCE=str(source),LMXXF_TASK_BUILD=str(a.build.resolve()),+env.update(LMXXF_TASK_SOURCE=str(build_source.resolve()),LMXXF_TASK_MODEL_SOURCE=str(model_source),LMXXF_TASK_MODEL="0" if a.model=="small" else "1",LMXXF_TASK_OUTPUT=output_name,LMXXF_TASK_BUILD=str(a.build.resolve()),LMXXF_TASK_COMPAT=str(Path(__file__).with_name('msvc-compat.h').resolve()),TEMP=str(a.tmp.resolve()),TMP=str(a.tmp.resolve()),VSLANG='1033')with a.log.open('xb') as log:code=subprocess.run(['cmd.exe','/d','/c',str(script.resolve())],cwd=source,env=env,stdout=log,stderr=subprocess.STDOUT,timeout=290).returncode-print('LMXXF BUILD',code,a.log)+receipt={'passed':code==0,'sourceCommit':PIN,'model':a.model,'command':['cmd.exe','/d','/c',str(script.resolve())],'sourceInputs':inputs,'patchSha256':hashlib.sha256(patch.read_bytes()).hexdigest(),'compatSha256':hashlib.sha256(Path(__file__).with_name('msvc-compat.h').read_bytes()).hexdigest(),'modelSourceSha256':hashlib.sha256(model_source.read_bytes()).hexdigest(),'log':str(a.log)}+if code==0:+ dll=a.build/output_name;receipt.update(path=str(dll),bytes=dll.stat().st_size,sha256=hashlib.sha256(dll.read_bytes()).hexdigest())+a.log.with_suffix('.json').write_text(json.dumps(receipt,ensure_ascii=False,indent=2)+'\n',encoding='utf8')+print('LMXXF BUILD',code,a.model,a.log)raise SystemExit(code)diff --git a/scripts/amd-nr/msvc-compat.h b/scripts/amd-nr/msvc-compat.hindex 0e67c575..52e08e40 100644--- a/scripts/amd-nr/msvc-compat.h+++ b/scripts/amd-nr/msvc-compat.h@@ -1,5 +1,12 @@-// lmxxf 4764e4f1a24f5234b8e29952dc41f493b2d77c90: the only GNU attribute-// used by this runtime is __attribute__((noinline)); map it for MSVC.+// lmxxf4764e4f1: source-compatible MSVC build adaptations only.#ifdef _MSC_VER+#ifndef WIN32_LEAN_AND_MEAN+#define WIN32_LEAN_AND_MEAN+#endif+#include <d3d12.h>+// rpcndr.h defines `small` as a type macro; upstream uses it as an identifier.+#ifdef small+#undef small+#endif#define __attribute__(x) __declspec(noinline)#endifdiff --git a/scripts/amd-nr/stage-044-runtime.py b/scripts/amd-nr/stage-044-runtime.pynew file mode 100644index 00000000..d132c118--- /dev/null+++ b/scripts/amd-nr/stage-044-runtime.py@@ -0,0 +1,83 @@+"""Stage user-approved 0.44 assets and independently built Small/Original modules.+No game/proxy/add-on, driver or SDK is copied. This audit is not HIP validation.+"""+import argparse, collections, ctypes, hashlib, json, shutil, subprocess, zipfile+from pathlib import Path+PIN='4764e4f1a24f5234b8e29952dc41f493b2d77c90'+ARCHIVE_SHA='cf812fe7909fbd53b38f54da8abd584698525f81f7ea71cab19ba14bab48e030'+p=argparse.ArgumentParser()+for name in ('archive','source','dll','original-dll','out'):p.add_argument('--'+name,type=Path,required=True)+a=p.parse_args()+a.out.resolve().relative_to(Path('E:/项目/Veyra').resolve())+if a.out.exists():raise SystemExit('Output must be a new directory')+def sha(file):+ with file.open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()+if sha(a.archive)!=ARCHIVE_SHA:raise SystemExit('Unexpected user package identity')+if subprocess.check_output(['git','rev-parse','HEAD'],cwd=a.source,text=True).strip()!=PIN or subprocess.check_output(['git','diff','--name-only','HEAD'],cwd=a.source):+ raise SystemExit('Expected unchanged pinned source checkout')+with zipfile.ZipFile(a.archive) as archive:+ rows=[]+ for line in archive.read('SHA256SUMS.txt').decode('utf-8-sig').splitlines():+ digest,name=line.split(None,1);name=name.lstrip('*').replace('\\','/')+ if hashlib.sha256(archive.read(name)).hexdigest()!=digest.lower():raise SystemExit('Package checksum mismatch: '+name)+ rows.append(name)+ if len(rows)!=875:raise SystemExit('Unexpected package file count')+ release=json.loads(archive.read('release.json'))+ if release['source_commit']!=PIN or release['hotfix']!='20261018-F9':raise SystemExit('Unexpected release metadata')+ prefix='DLSS5-AMD/native-game-tiled-assets/'+ assets=[name for name in rows if name.startswith(prefix)]+ counts=collections.Counter(Path(name).suffix for name in assets)+ small=[name for name in assets if '/small/' in name and Path(name).suffix in ('.f16','.f32')]+ if counts['.hsaco']!=80 or len(small)!=93:raise SystemExit('Unexpected 0.44 weight/kernel layout')+ a.out.mkdir(parents=True)+ for name in assets:+ relative=Path(name[len(prefix):]);target=(a.out/'assets'/relative).resolve()+ target.relative_to((a.out/'assets').resolve())+ if target.suffix.lower() in ('.exe','.dll','.addon64','.lib'):raise SystemExit('Unexpected executable in assets')+ target.parent.mkdir(parents=True,exist_ok=True);target.write_bytes(archive.read(name))+ for name in ('HIP-API-LICENSE.txt','release.json'):(a.out/name).write_bytes(archive.read(name))+ # Preserve kernel choices, not the add-on's codec/present/history/hotkeys.+ selected=[]+ for line in archive.read('DLSS5-AMD/default-config.txt').decode('utf-8-sig').splitlines():+ if line.startswith(('DLSS5_HIP_','DLSS5_SKIP_BLOCKS=','DLSS5_NETWORK_HEIGHT=',+ 'DLSS5_NETWORK_1080_ROWS=','DLSS5_NETWORK_FREE_RES=','DLSS5_FIT_LARGE=',+ 'DLSS5_STYLE=','DLSS5_DIRECT_IO=')):selected.append(line)+ selected+=['DLSS5_FAST_NUMERIC=0','DLSS5_FRAME_STATS=0','DLSS5_STRENGTH=auto',+ 'DLSS5_HOT_RELOAD=0','DLSS5_MULTI_PASS_HOTKEY=0','DLSS5_VIT_REUSE_HOTKEY=0',+ 'DLSS5_VIT_ADAPTIVE=0','DLSS5_TEMPORAL_MODE=0','DLSS5_FAST_HISTORY=0',+ 'DLSS5_TEMPORAL_HISTORY_EXPERIMENT=0']+ (a.out/'assets/native-game-flags.txt').write_text('\n'.join(selected)+'\n','ascii')+for src,name in ((a.dll,'LmxxfNrRuntime.dll'),(a.original_dll,'LmxxfNrRuntime-Original.dll')):shutil.copy2(src,a.out/name)+shutil.copy2(a.source/'LICENSE',a.out/'LICENSE-lmxxf-MIT.txt')+for file in (a.source/'shaders').glob('*.hlsl'):shutil.copy2(file,a.out/'assets'/file.name)+hip=a.out/'assets/HIP'+(hip/'SHA256SUMS').write_text(''.join(sha(f)+' '+f.relative_to(hip).as_posix()+'\n' for f in sorted(hip.rglob('*.hsaco'))),'ascii')+# Both real modules stay loaded simultaneously. Test the compiled selectors and+# upstream's own Small preflight; never substitute an identity provider here.+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.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())):+ 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')+assert [dll.VeyraLmxxfModelMode() for dll in modules]==[0,1]+(a.out/'LOCAL-EXPERIMENT.txt').write_text(+ 'Veyra AMD NR 0.44 local integration\nMIT source '+PIN+'\n'+ 'Performance enabled: Small 310.9.16. Disabled: Original. Separate modules, shared unchanged assets.\n'+ 'NVIDIA-derived weights are not MIT source. No game/proxy/add-on or driver files included.\n'+ 'gfx1200/gfx1201 only (RX 9000); requires a compatible AMD driver/HIP runtime.\n'+ 'No claim of RX 6000/7000 support or AMD inference, quality, latency or performance acceptance.\n'+ 'Veyra linear FP16, internal <=1920x1080 pixels, height<=1080, width<=2560; HDR rejected.\n'+ 'Veyra owns temporal resets, model selection and strength; external history/AE/hotkeys disabled.\n'+ 'Remove runtime/amd-nr to disable this provider, keeping basic playback.\n','utf8')+files=[dict(path=f.relative_to(a.out).as_posix(),size=f.stat().st_size,sha256=sha(f)) for f in sorted(a.out.rglob('*')) if f.is_file()]+report=dict(version='0.44',upstream=PIN,archiveSha256=ARCHIVE_SHA,packageChecksums=len(rows),+ smallWeightFiles=len(small),weightFiles=counts['.f16']+counts['.f32'],hipModules=counts['.hsaco'],+ architectures=['gfx1200','gfx1201'],models={'Small':'LmxxfNrRuntime.dll','Original':'LmxxfNrRuntime-Original.dll'},+ modelSelectorsVerified=True,smallAssetPreflightVerified=True,inferenceVerified=False,files=files)+(a.out/'amd-nr-local-manifest.json').write_text(json.dumps(report,ensure_ascii=False,indent=2)+'\n','utf8')+print('PASS real model selectors and asset layout;',len(files),'files; no AMD inference test.',a.out)diff --git a/scripts/amd-nr/veyra-runtime-model.cpp b/scripts/amd-nr/veyra-runtime-model.cppnew file mode 100644index 00000000..c13f1ffc--- /dev/null+++ b/scripts/amd-nr/veyra-runtime-model.cpp@@ -0,0 +1,19 @@+// SPDX-License-Identifier: GPL-3.0-only+// Veyra adapter; the linked inference implementation is lmxxf 0.44 (MIT).+#include <cstdint>+#include "native_model_mode.h"+#include "small_model_assets.h"+// Reports the very selector used by the compiled network, rather than a label+// inferred from a filename. The host rejects a swapped/mismatched model module.+extern "C" __declspec(dllexport) uint32_t VeyraLmxxfModelMode() {+ return dlss5_mode::Requested();+}+// 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) {+ if (!assets) return 0;+ try {+ return dlss5_mode::Requested() != 0 || hip_reference::SmallAssetsAvailable(+ (std::filesystem::path(assets) / L"small").u8string());+ } catch (...) { return 0; }+}diff --git a/src/pipeline/EnhanceGraph.cpp b/src/pipeline/EnhanceGraph.cppindex 93555ca0..40df3c4f 100644--- a/src/pipeline/EnhanceGraph.cpp+++ b/src/pipeline/EnhanceGraph.cpp@@ -1328,7 +1328,7 @@ bool EnhanceGraph::initNgxFeatures()if(desc_.hdrWorking()){veyra::log::error("amd-nr","HDR input is not yet validated for this adapter; NR disabled by backend fallback");return false;}instance->amd=std::make_unique<LmxxfNrBackend>();const auto directory=std::filesystem::path(desc_.runtimeAbsPath)/L".."/L"amd-nr";- if(!instance->amd->open(directory.lexically_normal(),context_.device(),ring_.queue(),context_.adapter().vendorId) || !instance->amd->admits(extent.width,extent.height))return false;+ if(!instance->amd->open(directory.lexically_normal(),context_.device(),ring_.queue(),context_.adapter().vendorId,instance->model.performance) || !instance->amd->admits(extent.width,extent.height))return false;}veyra::log::info("resolution",std::format("NR layer={} internal={}x{} composite={}x{} sharedMotion={}",index+1,extent.width,extent.height,fullW,fullH,motion!=nullptr));@@ -3219,8 +3219,8 @@ bool EnhanceGraph::applySettings(const engine::EnhancementSettings& s){if(s.activeNrLayerCount()!=nrInstances_.size())return false;for(size_t i=0;i<nrInstances_.size();++i){const auto& model=i<nextNr.nrLayersModel.size()?nextNr.nrLayersModel[i]:nextNr.model;- if(!lmxxfNr_&&engine::nrRenderPreset(s.nrRuntime,model)!=- engine::nrRenderPreset(desc_.nrRuntime,nrInstances_[i]->model))return false;+ if(engine::nrModelSelection(s.nrRuntime,model)!=+ engine::nrModelSelection(desc_.nrRuntime,nrInstances_[i]->model))return false;const bool temporal=i<nextNr.nrLayersTemporal.size()?nextNr.nrLayersTemporal[i]:nextNr.nrTemporal;if(temporal!=nrInstances_[i]->temporalEnabled)return false;const auto tier=i<nextNr.nrLayersAntiFlicker.size()?nextNr.nrLayersAntiFlicker[i]:nextNr.nrAntiFlicker;diff --git a/src/pipeline/LmxxfNrBackend.cpp b/src/pipeline/LmxxfNrBackend.cppindex 7bb7432f..b5d9fb3b 100644--- a/src/pipeline/LmxxfNrBackend.cpp+++ b/src/pipeline/LmxxfNrBackend.cpp@@ -16,15 +16,26 @@ bool LmxxfNrBackend::result(int32_t code, const char* operation) {log::error("amd-nr", error_);return false;}-bool LmxxfNrBackend::open(const std::filesystem::path& directory, ID3D12Device* device, ID3D12CommandQueue* queue, uint32_t vendor) {+bool LmxxfNrBackend::open(const std::filesystem::path& directory, ID3D12Device* device, ID3D12CommandQueue* queue, uint32_t vendor, bool performance) {close(); error_.clear();if (vendor != 0x1002 || !device || !queue || !directory.is_absolute()) {error_ = "lmxxf NR requires an AMD adapter, a D3D12 queue and an absolute runtime directory";log::error("amd-nr", error_); return false;}- const auto path = directory / L"LmxxfNrRuntime.dll";+ const auto path = directory / (performance ? L"LmxxfNrRuntime.dll" : L"LmxxfNrRuntime-Original.dll");module_ = LoadLibraryExW(path.c_str(), nullptr, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32);- if (!module_) { error_ = std::format("LmxxfNrRuntime.dll load failed win32={}", GetLastError()); log::error("amd-nr", error_); return false; }+ 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)) {+ error_ = "AMD NR model module mismatch: install the complete Veyra lmxxf 0.44 runtime";+ log::error("amd-nr", error_); close(); return false;+ }+ const auto assets = directory / L"assets";+ if (!assetsReady(assets.c_str())) {+ error_ = "AMD NR Small model assets are incomplete; refusing silent fallback to the original model";+ log::error("amd-nr", error_); close(); return false;+ }const auto getApi = reinterpret_cast<decltype(&LmxxfNrGetApi)>(GetProcAddress(module_, "LmxxfNrGetApi"));if (!getApi) { error_ = "LmxxfNrGetApi export is missing"; log::error("amd-nr",error_); close(); return false; }api_.struct_size = sizeof(api_);@@ -43,17 +54,23 @@ bool LmxxfNrBackend::open(const std::filesystem::path& directory, ID3D12Device*// 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");- if((srgb&&std::string_view(srgb)=="1") || (!caps_.history_supported&&adaptive&&std::string_view(adaptive)!="0"&&*adaptive)){- error_="Veyra AMD NR requires DLSS5_CODEC_SRGB=0 and DLSS5_VIT_ADAPTIVE=0: linear input and source-reset isolation";+ const auto hiddenHistory=[] {+ 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;+ }+ return false;+ };+ if((srgb&&std::string_view(srgb)=="1") || (!caps_.history_supported&&adaptive&&std::string_view(adaptive)!="0"&&*adaptive) || hiddenHistory()){+ 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;}- const auto assets = directory / L"assets";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_ || !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 ABI={} session={} maxInput={}x{}; module metadata admitted, HIP inference initializes on first frame", api_.abi_version, session_, caps_.max_input_width, caps_.max_input_height));+ 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));return true;}bool LmxxfNrBackend::admits(uint32_t w, uint32_t h) const {diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cppindex f4c79af7..a7649141 100644--- a/src/ui/QmlPlayerBridge.cpp+++ b/src/ui/QmlPlayerBridge.cpp@@ -5652,7 +5652,7 @@ bool QmlPlayerBridge::setNrLayerParameter(int index,const QString& key,double vaelse if(key=="style"&&value<=2)n.model.style=int(value);else if(key=="autoMask"&&value<=1)n.model.autoMask=int(value);else if(key=="uiCorrection"&&value<=1)n.model.uiCorrection=int(value);- else if(key=="performance"&&value<=1&&engine::currentNrRuntime(n.runtime)==engine::NrRuntime::Ampere)n.model.performance=value!=0;+ else if(key=="performance"&&value<=1&&engine::nrUsesPerformanceModel(n.runtime))n.model.performance=value!=0;else if(key=="temporal"&&value<=1)n.temporal=value!=0;else if(key=="correctionEnabled"&&value<=1)n.residual.correction.enabled=value!=0;else if(key=="correctionAuto"&&value<=1)n.residual.correction.automatic=value!=0;diff --git a/tests/integration/LmxxfNrGraphTests.cpp b/tests/integration/LmxxfNrGraphTests.cppindex 0b5f6f37..ebcb1b2f 100644--- a/tests/integration/LmxxfNrGraphTests.cpp+++ b/tests/integration/LmxxfNrGraphTests.cpp@@ -44,6 +44,7 @@ void checkSrHandoff(gfx::D3D12DeviceContext& ctx,gfx::CommandSlotRing& ring,unsigd.runtimeAbsPath=std::filesystem::absolute("runtime/nvidia").wstring();gd.nrWidth=c.width;gd.nrHeight=c.height;gd.nrLayersModel.resize(c.layers);gd.nrLayersResidual.resize(c.layers);+ for(unsigned n=0;n<c.layers;++n)gd.nrLayersModel[n].performance=n%2==0;for(auto& r:gd.nrLayersResidual)r.total=c.strength;gd.nrLayersTemporal.assign(c.layers,c.temporal);gd.nrLayersSizePolicy.assign(c.layers,pipeline::NrSizePolicy::Native);gd.nrLayersExtent.assign(c.layers,{c.width,c.height});@@ -89,6 +90,16 @@ int main(){}unsigned failures=0,checks=0;checkSrHandoff(ctx,ring,checks,failures);+ // Keep both identity modules resident so per-model creation counters span+ // graph teardown. This catches accidentally routing every layer to Small.+ const auto fakeDirectory=std::filesystem::absolute("runtime/amd-nr");+ HMODULE fakeSmall=LoadLibraryExW((fakeDirectory/L"LmxxfNrRuntime.dll").c_str(),nullptr,LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR|LOAD_LIBRARY_SEARCH_SYSTEM32);+ HMODULE fakeOriginal=LoadLibraryExW((fakeDirectory/L"LmxxfNrRuntime-Original.dll").c_str(),nullptr,LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR|LOAD_LIBRARY_SEARCH_SYSTEM32);+ if(!fakeSmall||!fakeOriginal)return 2;+ using Counter=uint32_t(*)();+ const auto smallCreates=reinterpret_cast<Counter>(GetProcAddress(fakeSmall,"VeyraTestLmxxfCreates"));+ const auto originalCreates=reinterpret_cast<Counter>(GetProcAddress(fakeOriginal,"VeyraTestLmxxfCreates"));+ if(!smallCreates||!originalCreates)return 2;sink::RgbaImage reference;for(unsigned layers:{0u,1u,2u,4u})for(bool temporal:{false,true}){if(!layers&&temporal)continue;@@ -99,10 +110,13 @@ int main(){gd.srMotion=gd.fgMotion=engine::MotionSource::Zero;gd.runtimeAbsPath=std::filesystem::absolute("runtime/nvidia").wstring();gd.nrLayersModel.resize(layers);gd.nrLayersResidual.resize(layers);+ for(unsigned n=0;n<layers;++n)gd.nrLayersModel[n].performance=n%2==0;gd.nrLayersTemporal.assign(layers,temporal);gd.nrLayersSizePolicy.assign(layers,pipeline::NrSizePolicy::P480);gd.nrLayersExtent.assign(layers,{64,36});+ const auto beforeSmall=smallCreates(),beforeOriginal=originalCreates();bool ok=graph.initialize(gd)&&graph.createViews();+ ok=ok&&smallCreates()-beforeSmall==(layers+1)/2&&originalCreates()-beforeOriginal==layers/2;unsigned maximum=0;uint64_t rgbSum=0;for(unsigned f=0;ok&&f<8;++f){pipeline::EnhanceGraph::FrameOutputs out;sink::RgbaImage image;@@ -134,7 +148,7 @@ int main(){engine::EnhancementSettings settings;settings.nr=layers>0;settings.sr=false;settings.multiplier=1;settings.nrRuntime=engine::NrRuntime::LmxxfAmd;settings.nrMotion=engine::MotionSource::Zero;settings.nrLayerCount=layers;- for(unsigned n=0;n<layers;++n){settings.nrLayers[n].enabled=true;settings.nrLayers[n].runtime=engine::NrRuntime::LmxxfAmd;settings.nrLayers[n].sizePolicy=pipeline::NrSizePolicy::Native;}+ for(unsigned n=0;n<layers;++n){settings.nrLayers[n].enabled=true;settings.nrLayers[n].runtime=engine::NrRuntime::LmxxfAmd;settings.nrLayers[n].sizePolicy=pipeline::NrSizePolicy::Native;settings.nrLayers[n].model.performance=n%2==0;}engine::StageRequest request;request.nr=settings.nr;request.width=3840;request.height=2160;request.exportJob=true;request.nvidiaAdapter=false;request.amdNr=true;pipeline::EnhanceGraphDesc gd;const auto plan=engine::describeStages(request,settings,gd);@@ -169,6 +183,7 @@ int main(){}failures+=errors>0;std::cout<<"D3D12_DEBUG errors="<<errors<<'\n';}else{++failures;std::cout<<"D3D12_DEBUG unavailable\n";}+ FreeLibrary(fakeOriginal);FreeLibrary(fakeSmall);av_frame_free(&frame);CoUninitialize();std::cout<<"Shared AMD composition GPU test: "<<checks<<" cases, "<<failures<<" failures. Not HIP inference.\n";return failures?1:0;diff --git a/tests/integration/LmxxfNrRuntimeMetadataTests.cpp b/tests/integration/LmxxfNrRuntimeMetadataTests.cppnew file mode 100644index 00000000..31e2742d--- /dev/null+++ b/tests/integration/LmxxfNrRuntimeMetadataTests.cpp@@ -0,0 +1,35 @@+// Real upstream modules and real D3D12 objects. No PrepareFrame/HIP inference.+#include "veyra/pipeline/LmxxfNrBackend.h"+#include "veyra/gfx/D3D12DeviceContext.h"+#include <iostream>+#include <cstdlib>+using namespace veyra;+int wmain(int argc,wchar_t** argv){+ if(argc!=3)return 2;+ const std::filesystem::path runtime=argv[1],scratch=argv[2];+ if(!runtime.is_absolute()||!scratch.is_absolute()||std::filesystem::exists(scratch))return 2;+ unsigned failures=0,checks=0;+ auto check=[&](bool ok,const char* text){++checks;failures+=!ok;std::cout<<(ok?"PASS ":"FAIL ")<<text<<std::endl;};+ gfx::D3D12DeviceContext ctx;Status status=Status::Ok;gfx::DeviceContextDesc desc{};+ if(!ctx.initialize(desc,status))return 2;+ pipeline::LmxxfNrBackend small,original;+ check(!small.open(runtime,ctx.device(),ctx.directQueue(),0x10de),"actual NVIDIA vendor remains blocked");+ _putenv_s("DLSS5_MULTI_PASS","3"); // Must not override either compiled model.+ check(small.open(runtime,ctx.device(),ctx.directQueue(),0x1002,true),"real Small Create/PrepareSession metadata");+ check(original.open(runtime,ctx.device(),ctx.directQueue(),0x1002,false),"real Original metadata coexists with Small");+ check(small.ready()&&original.ready()&&small.admits(1920,1080)&&!small.admits(3840,2160),"actual capability budget retained");+ original.close();check(small.ready(),"closing Original preserves Small session");small.close();+ _putenv_s("DLSS5_MULTI_PASS","");+ _putenv_s("DLSS5_TEMPORAL_MODE","1");+ check(!small.open(runtime,ctx.device(),ctx.directQueue(),0x1002,true),"hidden temporal mode cannot silently select Original geometry");+ _putenv_s("DLSS5_TEMPORAL_MODE","");+ std::filesystem::create_directories(scratch/L"assets");+ std::filesystem::copy_file(runtime/L"LmxxfNrRuntime.dll",scratch/L"LmxxfNrRuntime.dll");+ check(!small.open(scratch,ctx.device(),ctx.directQueue(),0x1002,true)&&small.error().find("Small model assets")!=std::string::npos,"real missing Small assets fail before Create; no silent fallback");+ std::filesystem::copy_file(runtime/L"LmxxfNrRuntime-Original.dll",scratch/L"LmxxfNrRuntime.dll",std::filesystem::copy_options::overwrite_existing);+ check(!small.open(scratch,ctx.device(),ctx.directQueue(),0x1002,true)&&small.error().find("model module mismatch")!=std::string::npos,"actual swapped module refuses wrong model");+ check(original.open(runtime,ctx.device(),ctx.directQueue(),0x1002,false),"real module reopens after metadata teardown");original.close();+ uint32_t removed=0;check(ctx.checkDeviceAlive(removed),"device alive after metadata lifecycle");+ std::cout<<"Real lmxxf metadata: "<<checks<<" checks, "<<failures<<" failures. NO AMD inference/quality/performance measured.\n";+ return failures?1:0;+}diff --git a/tests/qml/quick/tst_components.qml b/tests/qml/quick/tst_components.qmlindex f0ac23ab..e49113b3 100644--- a/tests/qml/quick/tst_components.qml+++ b/tests/qml/quick/tst_components.qml@@ -522,7 +522,11 @@ Item {compare(control.checked,false)changed[0].runtime=4fixture.rows=changed.map(r => Object.assign({},r))- verify(!row.visible)+ verify(row.visible)+ verify(row.enabled && control.enabled)+ mouseClick(control)+ compare(fixture.lastKey,"performance")+ compare(Boolean(fixture.rows[0].performance),true)}function test_nr_complete_parameters_and_skin_range() {const fixture=createTemporaryObject(nrFixture,root)diff --git a/tests/unit/LmxxfNrFakeRuntime.cpp b/tests/unit/LmxxfNrFakeRuntime.cppindex 0eb45f6e..881f5c64 100644--- a/tests/unit/LmxxfNrFakeRuntime.cpp+++ b/tests/unit/LmxxfNrFakeRuntime.cpp@@ -7,8 +7,13 @@#include <string>#include <cstring>#include <cstdint>+#include <atomic>using Microsoft::WRL::ComPtr;+#ifndef VEYRA_TEST_MODEL_MODE+#define VEYRA_TEST_MODEL_MODE 0+#endifnamespace {+std::atomic<uint32_t> creates{0};struct Session {ID3D12Resource* color=nullptr;ComPtr<ID3D12Resource> output,markerUpload;@@ -19,7 +24,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;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 destroy(void* p){delete static_cast<Session*>(p);return 0;}int ok(void*){return 0;}int prepare(void* p,const LmxxfNrFrameInfo* info,LmxxfNrJob* job){@@ -69,6 +74,13 @@ int poll(void* p,void*,uint32_t* state){*state=static_cast<Session*>(p)->state;rint error(char* b,uint32_t n){if(n)strncpy_s(b,n,"test provider: requested failure / incorrect call order",_TRUNCATE);return 0;}int status(void*,char* b,uint32_t n){return error(b,n);}}+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 VeyraLmxxfModelAssetsReady(const wchar_t*){+ return mode()!="missing-small";+}extern "C" __declspec(dllexport) int32_t LmxxfNrGetApi(uint32_t abi,LmxxfNrApi* p){if(abi!=1)return 1;if(mode()=="oldabi"&&p->struct_size>LMXXF_NR_API_V1_SIZE)return 2;p->abi_version=1;p->QueryCapabilities=caps;p->Create=create;p->Destroy=destroy;p->PrepareSession=ok;p->PrepareFrame=prepare;diff --git a/tests/unit/LmxxfNrTests.cpp b/tests/unit/LmxxfNrTests.cppindex e1eb4c26..50d9ff37 100644--- a/tests/unit/LmxxfNrTests.cpp+++ b/tests/unit/LmxxfNrTests.cpp@@ -19,6 +19,15 @@ int main(){pipeline::LmxxfNrBackend nr;check(!nr.open(directory,ctx.device(),ctx.directQueue(),0x10DE),"NVIDIA path does not load AMD runtime");check(!nr.open(directory/"missing",ctx.device(),ctx.directQueue(),0x1002),"missing runtime refuses NR");+ SetEnvironmentVariableW(L"VEYRA_TEST_LMXXF_MODE",L"wrong-model");+ check(!nr.open(directory,ctx.device(),ctx.directQueue(),0x1002),"swapped model module refuses NR");+ SetEnvironmentVariableW(L"VEYRA_TEST_LMXXF_MODE",L"missing-small");+ check(!nr.open(directory,ctx.device(),ctx.directQueue(),0x1002),"missing Small assets cannot silently fall back");+ SetEnvironmentVariableW(L"VEYRA_TEST_LMXXF_MODE",nullptr);+ pipeline::LmxxfNrBackend original;+ 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"bad-table");check(!nr.open(directory,ctx.device(),ctx.directQueue(),0x1002),"incomplete ABI is rejected");SetEnvironmentVariableW(L"VEYRA_TEST_LMXXF_MODE",nullptr);diff --git a/tests/unit/NrModelSettingsTests.cpp b/tests/unit/NrModelSettingsTests.cppindex 5b548581..196853bf 100644--- a/tests/unit/NrModelSettingsTests.cpp+++ b/tests/unit/NrModelSettingsTests.cpp@@ -21,11 +21,17 @@ int wmain(int argc,wchar_t** argv){check(s.nrRuntime==NrRuntime::Ampere&&s.model.performance&&nrRenderPreset(s.nrRuntime,s.model)==2,"fresh NVIDIA settings select SF preset B");auto a=s;a.model.performance=false;check(nrRenderPreset(a.nrRuntime,a.model)==1&&requiresGraphRebuild(s,a),"active SF model change rebuilds NR");- for(auto runtime:{NrRuntime::NvidiaOriginal,NrRuntime::LmxxfAmd}){+ for(auto runtime:{NrRuntime::NvidiaOriginal}){auto original=s;original.nrRuntime=runtime;auto edited=original;edited.model.performance=false;check(nrRenderPreset(runtime,edited.model)==0&&!requiresGraphRebuild(original,edited)&&- original.sameActiveVideoParameters(edited),"original and AMD ignore the inactive performance option");+ original.sameActiveVideoParameters(edited),"NVIDIA original ignores the inactive performance option");}+ auto amd=s;amd.nrRuntime=NrRuntime::LmxxfAmd;+ auto amdOriginal=amd;amdOriginal.model.performance=false;+ check(nrRenderPreset(amd.nrRuntime,amd.model)==0&&requiresGraphRebuild(amd,amdOriginal)&&+ !amd.sameActiveVideoParameters(amdOriginal),"AMD model changes rebuild without setting an NGX preset");+ amd.nr=false;amdOriginal.nr=false;+ check(!requiresGraphRebuild(amd,amdOriginal)&&amd.sameActiveVideoParameters(amdOriginal),"disabled AMD edits preserve uninterrupted playback");auto off=s;off.nr=false;auto draft=off;draft.model.performance=false;check(!requiresGraphRebuild(off,draft)&&off.sameActiveVideoParameters(draft),"disabled NR model edit does not disturb playback");s.nrLayerCount=2;for(unsigned i=0;i<s.nrLayerCount;++i){s.nrLayers[i].enabled=true;s.nrLayers[i].runtime=s.nrRuntime;}@@ -36,6 +42,11 @@ int wmain(int argc,wchar_t** argv){s.nrLayers[1].enabled=a.nrLayers[1].enabled=true;const auto frozen=freezeExportSettings(a);EnhancementSettings round=frozen;fromChain(toChain(frozen),round);check(round==frozen&&!round.nrLayers[1].model.performance,"export snapshot retains each layer's model");+ auto mixedAmd=a;mixedAmd.nrRuntime=NrRuntime::LmxxfAmd;+ for(auto& layer:mixedAmd.nrLayers)layer.runtime=NrRuntime::LmxxfAmd;+ EnhancementSettings amdRound;fromChain(toChain(freezeExportSettings(mixedAmd)),amdRound);+ check(amdRound.nrLayers[0].model.performance&&!amdRound.nrLayers[1].model.performance&&+ requiresGraphRebuild(mixedAmd,[&]{auto v=mixedAmd;v.nrLayers[1].model.performance=true;return v;}()),"AMD list/export preserves independent Small and Original layers");StageRequest request;request.width=1920;request.height=1080;request.nr=true;request.exportJob=true;pipeline::EnhanceGraphDesc desc;describeStages(request,frozen,desc);check(desc.nrLayersModel.size()==2&&desc.nrLayersModel[0].performance&&!desc.nrLayersModel[1].performance,"export graph receives both model choices");@@ -75,5 +86,13 @@ int wmain(int argc,wchar_t** argv){check(sessions.save(*session)&&bytes(sessionPath)==sessionRollback,"detached editor model opts into session 8 and preserves old file");auto restored=std::make_unique<ChainSession>();ChainSessionStore reader(sessionPath);check(reader.load(*restored)&&*restored==*session,"session restores list, node and editor model choices independently");+ PresetLibrary amdLibrary(out/L"amd-library.v1");amdLibrary.setIncludeBuiltins(false);+ PresetEntry amdEntry;amdEntry.name=L"AMD Small + Original";amdEntry.chain=toChain(mixedAmd);+ const bool amdSaved=amdLibrary.load()&&amdLibrary.put(amdEntry);+ PresetLibrary amdReader(out/L"amd-library.v1");amdReader.setIncludeBuiltins(false);+ check(amdSaved&&amdReader.load()&&amdReader.entries().size()==1&&amdReader.entries()[0]==amdEntry,"AMD mixed models survive disk preset reload");+ auto amdSession=std::make_unique<ChainSession>(ChainSession::initial(mixedAmd));ChainSessionStore amdSessions(out/L"amd-session.v1");+ auto amdRestored=std::make_unique<ChainSession>();+ check(amdSessions.save(*amdSession)&&amdSessions.load(*amdRestored)&&*amdSession==*amdRestored,"AMD mixed models survive complete session restore");std::cout<<"NR model settings failures="<<failures<<std::endl;return failures?1:0;}diff --git a/third_party/lmxxf/VEYRA_ORIGIN.md b/third_party/lmxxf/VEYRA_ORIGIN.mdindex 983ace8a..6a1f6e89 100644--- a/third_party/lmxxf/VEYRA_ORIGIN.md+++ b/third_party/lmxxf/VEYRA_ORIGIN.md@@ -1,14 +1,22 @@# lmxxf AMD NR origin- Upstream: https://github.com/lmxxf/dlss5-on-amd-9070xt-porting-- Fixed commit: `78f548749e74824327b8458c57be31a1df78376a`.+- Current fixed commit: `4764e4f1a24f5234b8e29952dc41f493b2d77c90` (0.44 F9 hotfix).+- Previous 0.39 integration: `78f548749e74824327b8458c57be31a1df78376a`.- License: MIT, Copyright (c) 2026 Kien; original license in `LICENSE`.- `LmxxfNrApi.h`: byte-identical copy of upstream `include/LmxxfNrApi.h`.- Runtime code remains in the external pinned checkout; the Veyra source Gitcontains the public C ABI header, attribution and reproducible build recipe.- Build adaptation: MSVC `NOMINMAX`, linking `user32.lib` for the upstream hotkeyreference, and a forced header mapping its sole GNU `noinline` annotation to- `__declspec(noinline)`. No changes to upstream inference/codec source.+ `__declspec(noinline)`, `/utf-8`, and undefining Windows' `small` macro.+- `veyra-model-isolation.patch` changes `src/native_model_mode.h` and+ `src/native_hot_flags.h` in isolated build copies: fixed model per DLL,+ no external model hotkey/config polling. Small and Original coexist across+ NR layers without per-frame environment mutation. Network/codec math is unchanged.+- `scripts/amd-nr/veyra-runtime-model.cpp` exposes the actual compiled selector+ and upstream Small asset preflight; the host rejects wrong modules and missing+ Small weights instead of silently using Original. The public C ABI remains unchanged.- Veyra-owned host files: `LmxxfNrBackend.h/.cpp`, `NrInstance`/`EnhanceGraph`integration, GPU-specific QML choices and local resource preparation scripts.They use the existing shared enhancement graph and NR composite/history.@@ -16,8 +24,11 @@This does **not** license the whole Magpie portable package under MIT. Magpiehas its own GPL license. The NVIDIA-derived `.f16`/`.f32` model weights areseparate binary assets, not MIT source; HIP modules are also kept outside Git.-User-provided 0.39 resources are used only for the recorded local experiment.+User-provided 0.44 resources are used only for this isolated local integration;+`stage-044-runtime.py` audits all 875 package checksums before extracting assets.+The old `prepare-local-runtime.py` is retained solely for historical 0.39 builds.No Magpie executable, proxy `dxgi.dll` or ReShade `.addon64` is loaded by Veyra.See `docs/AMD_NR_INTEGRATION_2026-10-03.md` for asset provenance, ABI limits andthe distinction between host tests and unperformed RX 9000 inference validation.+See `docs/AMD_NR_044_PLAN_2026-10-18.md` for the current scope and validation.diff --git a/third_party/lmxxf/veyra-model-isolation.patch b/third_party/lmxxf/veyra-model-isolation.patchnew file mode 100644index 00000000..8e4b07d9--- /dev/null+++ b/third_party/lmxxf/veyra-model-isolation.patch@@ -0,0 +1,67 @@+--- a/src/native_model_mode.h++++ b/src/native_model_mode.h+@@ -10,7 +10,14 @@+ std::fprintf(stderr,"DLSS5_MULTI_PASS=%s invalid (0.5/1/2/3), using 0.5\n",v);return 0;}+ inline unsigned Environment(){return Parse(std::getenv("DLSS5_MULTI_PASS"));}+ inline std::atomic<int> hot_mode{-1};+-inline unsigned Requested(){int n=hot_mode.load(std::memory_order_relaxed);return n<0?Environment():unsigned(n);}++inline unsigned Requested(){++#ifdef VEYRA_LMXXF_MODEL_MODE++ static_assert(VEYRA_LMXXF_MODEL_MODE==0||VEYRA_LMXXF_MODEL_MODE==1,"Veyra supports Small and Original single-pass models");++ return VEYRA_LMXXF_MODEL_MODE;++#else++ int n=hot_mode.load(std::memory_order_relaxed);return n<0?Environment():unsigned(n);++#endif++}+ inline void Request(unsigned n){if(n<=3)hot_mode.store(int(n),std::memory_order_relaxed);}+ inline const char* Name(unsigned mode){static const char*names[]={"0.5","1","2","3"};return names[mode<=3?mode:0];}+ inline unsigned Passes(unsigned mode){return mode?mode:1;}+--- a/src/native_hot_flags.h++++ b/src/native_hot_flags.h+@@ -51,9 +51,13 @@+ }+ public:+ static bool Enabled(){++#ifdef VEYRA_LMXXF_MODEL_MODE++ return false; // Veyra owns all controls; no add-on configuration polling.++#else+ static const bool on=[]{if(const wchar_t*e=_wgetenv(L"DLSS5_HOT_RELOAD"))return wcscmp(e,L"0")!=0;+ unsigned x=1;for(const std::string&cfg_line:NativeConfigFileLines()){const char*line=cfg_line.c_str();sscanf(line,"DLSS5_HOT_RELOAD=%u",&x);}return x!=0;}();+ return on;++#endif+ }+ /* Current values (defaults = "use what was read at start"). Polls the file stamp at most once per second. */+ NativeHotFlagValues Get(){+@@ -69,13 +73,18 @@+ If native-game-flags.txt also has the key (it would win over custom), that line is rewritten as well, with a stderr line.+ A DLSS5_MULTI_PASS system environment variable wins over every file: stderr line, files still written. The running mode changes immediately, even if persistence fails; HOT_RELOAD controls external file polling. Returns the new count (0 = no press). Not pressed = no file access. */+ static unsigned HotkeyCode(){++#ifdef VEYRA_LMXXF_MODEL_MODE++ return 0; // Never capture/write the add-on model hotkey.++#else+ static const unsigned vk=[]{std::string v="F9";for(const std::string&l:NativeConfigFileLines())if(!l.compare(0,24,"DLSS5_MULTI_PASS_HOTKEY="))v=l.substr(24);+ if(const char*e=std::getenv("DLSS5_MULTI_PASS_HOTKEY"))v=e;+ if(v.empty()||v=="0")return 0u;+ if((v[0]=='F'||v[0]=='f')&&v.size()>1){char*end=nullptr;unsigned long n=strtoul(v.c_str()+1,&end,10);if(!*end&&n>=1&&n<=24)return unsigned(VK_F1+n-1);}+ char*end=nullptr;unsigned long n=strtoul(v.c_str(),&end,0);if(!*end&&n>0&&n<256)return unsigned(n);+ std::fprintf(stderr,"DLSS5_MULTI_PASS_HOTKEY=%s invalid (F1..F24, key code, 0), using F9\n",v.c_str());return unsigned(VK_F9);}();+- return vk;}++ return vk;++#endif++ }+ static bool RewriteKey(const wchar_t*name,const char*key,const std::string&value,bool create){+ const std::wstring path=NativeLabPath(name);std::string text;const bool exists=NativeConfigReadFile(path,text);if(!exists&&!create)return false;+ const std::string nl=text.find("\r\n")!=std::string::npos?"\r\n":"\n";std::string out;bool done=false;size_t at=0;const std::string want=std::string(key)+"="+value;+@@ -114,8 +123,12 @@++ // Called before choosing per-frame geometry so a model hot switch can rebuild its buffers.+ inline unsigned NativePollRequestedModelMode(bool allow=true){++#ifdef VEYRA_LMXXF_MODEL_MODE++ (void)allow;return dlss5_mode::Requested();++#else+ auto&hot=NativeHotFlags::Instance();if(NativeHotFlags::Enabled()||NativeHotFlags::HotkeyCode()){+ hot.PollMultiPassHotkey(dlss5_mode::Requested(),allow);auto v=hot.Get();+ if(v.multi_pass>=0)dlss5_mode::Request(unsigned(v.multi_pass));+ }return dlss5_mode::Requested();++#endif+ }