upscale: DLSS frames reach the layer in Streamline/Unreal D3D12 games

Bright Memory: Infinite (Unreal Engine, D3D12, NVIDIA Streamline) now passed NGX's checks but no
frame reached the layer. Two causes, fixed here:

- The layer recognised the bridge's mailbox by size and the storage bit only, in a 128-entry table;
  the game's own 8 KB storage buffers filled it first, so the bridge's doorbells were ignored. It now
  matches the exact usage the bridges create them with (mailbox STORAGE|TRANSFER_DST, marker
  TRANSFER_DST), keeps 1024 entries and warns once if the table is ever full.
- Streamline (sl.interposer) wraps the devices and command lists it creates; vkd3d-proton and DXVK
  do not know the wrappers. wl_streamline.h asks a wrapper for StreamlineRetrieveBaseInterface
  (Streamline source/core/sl.interposer/d3d12/d3d12Device.cpp) and the interop calls retry on the
  wrapped object: device queries, BeginVkCommandBufferInterop/End, GetVulkanResourceInfo1.

DROIDDECK_UPSCALE_LOG=1 now also logs the NGX bridge's D3D12 attach and first evaluate (seam
ready, images found, command list accepted, dispatch result).
This commit is contained in:
The412Banner committed 2026-12-05 02:40:10 -05:00
1 parent 772f83cf95
commit e5d7bddfdb
11 files changed
+230 -28

No files matched your search

@@ -1190,15 +1190,12 @@ def time_now():
return time.time()
def upscale_xess(prefix, data):
"""Intel's XeSS runtime beside the bridge: libxess.dll loads wl_xess_official.dll from system32. A hard link
when the prefix is on the same file system as the data, else a copy."""
source = os.path.join(data, "xess", UPSCALE_XESS)
if not os.path.isfile(source):
return "XeSS runtime not downloaded"
target = os.path.join(prefix, "pfx", "drive_c", "windows", "system32", UPSCALE_XESS)
def upscale_link(source, target):
"""target = source's bytes: a hard link when both are on one file system, else a copy. Kept when equal."""
if os.path.isfile(target) and os.path.getsize(target) == os.path.getsize(source):
return None
with open(source, "rb") as a, open(target, "rb") as b:
if a.read() == b.read():
return
staged = target + ".droiddeck-tmp"
if os.path.lexists(staged):
os.unlink(staged)
@@ -1212,6 +1209,42 @@ def upscale_xess(prefix, data):
break
dst.write(chunk)
os.replace(staged, target)
# DLSS games load nvapi64.dll and NGX's core from system32 only (NGXCore FullPath is C:\windows\system32), which
# the bridge folder on WINEDLLPATH does not answer. Wine copies the bridges there only when a prefix is created with
# the upscaler already on; Bright Memory: Infinite's prefix predates it: "Failed to initialize NVAPI", then NGX
# "failed to load C:\windows\system32\_nvngx.dll". With these four in system32 NGX reports "DLSS supported 1".
UPSCALE_NGX_FILES = ("nvapi64.dll", "_nvngx.dll", "nvngx.dll", "nvngx_dlss.dll")
def upscale_ngx_files(prefix, bridges, dlss):
"""DLSS mode: the bridge's NVAPI and NGX DLLs as files in the prefix's system32. Other modes: our copies go,
so a game taken out of DLSS mode no longer sees the NVIDIA stand-in (other files there are left alone)."""
system32 = os.path.join(prefix, "pfx", "drive_c", "windows", "system32")
if not os.path.isdir(system32):
return False
for name in UPSCALE_NGX_FILES:
source = os.path.join(bridges, "x86_64-windows", name)
target = os.path.join(system32, name)
if not os.path.isfile(source):
continue
if dlss:
upscale_link(source, target)
elif os.path.isfile(target) and os.path.getsize(target) == os.path.getsize(source):
with open(source, "rb") as a, open(target, "rb") as b:
if a.read() == b.read():
os.unlink(target)
return True
def upscale_xess(prefix, data):
"""Intel's XeSS runtime beside the bridge: libxess.dll loads wl_xess_official.dll from system32. A hard link
when the prefix is on the same file system as the data, else a copy."""
source = os.path.join(data, "xess", UPSCALE_XESS)
if not os.path.isfile(source):
return "XeSS runtime not downloaded"
upscale_link(source, os.path.join(prefix, "pfx", "drive_c", "windows", "system32", UPSCALE_XESS))
return None
@@ -1280,6 +1313,11 @@ def upscale_settings(env, prefix):
notes.append("NVIDIA NGX registry entries added to the prefix (DLSS mode)")
except OSError as error:
notes.append("NGX registry entries not written (%s)" % error)
try:
if prefix:
upscale_ngx_files(prefix, bridges, True)
except OSError as error:
notes.append("NVAPI/NGX DLLs not placed in system32 (%s)" % error)
elif mode == "native":
result["DROIDDECK_UPSCALE_SPOOF_DLSS"] = "0"
result["DROIDDECK_UPSCALE_GPU_SPOOF"] = "rdna4"
@@ -1288,6 +1326,11 @@ def upscale_settings(env, prefix):
else:
result["DROIDDECK_UPSCALE_SPOOF_DLSS"] = "0"
result["DROIDDECK_UPSCALE_GPU_SPOOF"] = "off"
if prefix and mode != "dlss":
try:
upscale_ngx_files(prefix, bridges, False)
except OSError:
pass
if dxvk:
current = result.get("DXVK_CONFIG", "").strip().rstrip(";").strip()
result["DXVK_CONFIG"] = current + "; " + dxvk if current else dxvk