Fix game startup resource lifetime and D32S8 depth-plane interop

This commit is contained in:
Codex committed 2026-10-01 17:27:06 +03:00
1 parent 19d859e43d
commit 5d33bddcd0
17 files changed
+539 -11

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
# Native Windows RDNA4 game development package
Validated hardware: Windows 11 x64 / Radeon RX 9070 XT / gfx1201. Native K and
M transformer kernels pass standalone D3D12 + OptiScaler checks. Actual game
compatibility and performance are still being validated. This is a local
development package; no NVIDIA proprietary DLL is included.
Build the shim/diagnostics, corrected ZLUDA, K/M native objects and patched
OptiScaler using the scripts in `scripts/windows`, then run:
```powershell
.\scripts\windows\package-windows-game.ps1
```
The package pins TheRock 10.2.0a20260929 because its Windows external-memory
mapping lifetime passes the repeated import/release test. Stable HIP 7.2 has
a reproduced mapped-view leak; see `docs/windows-rdna4-port.md` for the source
fix, exact dependency versions, validation and complete build commands.
Run a D3D12 game without anti-cheat using your locally supplied NVIDIA DLLs:
```powershell
.\dist\windows-rdna4-game\windows-game.ps1 -GameExe "D:\Games\SILENT HILL 2\SHProto\Binaries\Win64\SHProto-Win64-Shipping.exe" -NgxCore "C:\Users\Administrator\d4r\_nvngx.dll" -DlssDll "C:\Users\Administrator\d4r\nvngx_dlss.dll" -Preset 11
```
Use `-Preset 13` for M. The validated manifest requires DLSS 310.9.1 with the
recorded SHA256; other feature DLLs require regenerating and validating the
native manifest. Select an upscaler supported by OptiScaler in the game.
The script installs `dxgi.dll`, an explicit DLSS configuration and a private
`d4r` runtime directory, and captures stdout/stderr, an external debugger log,
crash dump, loaded DLL paths, driver information and OptiScaler logs. A local
ZIP bundle is printed at exit. `-RunSeconds 120` bounds a diagnostic run;
the normal default allows you to play until you close the game.
For the Silent Hill 2 startup black-screen investigation, add
`-DiagnosticResolution 1280x720`. This backs up its two graphics configuration
files, temporarily selects a window at that resolution, and restores the
original bytes after the test. It does not change progression saves. First-use
PTX compilation can be slow; `-CacheDirectory <existing-ZLUDA-cache>` reuses
modules with matching GPU, codegen switches and ZLUDA binary fingerprint.
Original files are backed up before replacement. Restore with:
```powershell
.\dist\windows-rdna4-game\windows-game.ps1 -Action restore -GameExe "D:\Games\SILENT HILL 2\SHProto\Binaries\Win64\SHProto-Win64-Shipping.exe"
```
Restore refuses to overwrite files changed since installation. Backups and
diagnostic results are retained. The script does not change progression saves,
system DLLs, driver settings or security settings. All runtime work is native
Windows. Colour, depth, motion, exposure and output cross APIs through VRAM
and shared D3D12 fences; the backend waits for the current frame and never
uses a previous-frame fallback.
OptiScaler source modifications are GPL-3.0 and exported under
`source-patches/optiscaler`. ZLUDA source modifications are exported under
`source-patches/zluda`. Dependency license texts and build hashes are included.
+49 -2
View File
@@ -8,6 +8,53 @@ An actual game session remains unverified.
## Milestone and gates
First actual game runs (2026-10-01): Silent Hill 2 1.2, XeSS input -> OptiScaler
DLSS K. `silent-hill2-k-first.zip` found the old Project ID wrapper initializing
CUDA NGX with app 4919 instead of the caller's identity, and back-buffer
tracking references blocking `ResizeBuffers` (DXGI_ERROR_INVALID_CALL).
OptiScaler patch `0003` preserves identity; resource-state records now follow
the public D3D12 caller-owned resource lifetime instead of retaining barriers'
resources. A composition swap-chain regression resizes while its submitted,
unreset command list remains alive; it passes on Radeon and WARP, along with
all 16 CTest gates (`game-resize-ctest.log`). K/M legacy Project ID standalone
frames have bit-exact RGB. The invalid-core test propagates the error from
legacy Init rather than pretending initialization succeeded.
`silent-hill2-k-project-resize.zip` successfully initializes CUDA DLSS and
presents thousands of startup frames with no d4r failures. It has **zero
completed DLSS frames** and is not a game acceptance pass. The next interactive
run reaches native K feature creation at 2259x1271 -> 3840x2160 after Enter;
the user reports a black screen during this phase. Capture and isolate this
before claiming successful in-game execution.
`silent-hill2-k-720p.zip` localizes the flashing “upscaler failed to run”
message to the actual depth resource: DXGI `R32G8X24_TYPELESS` (19). The
backend previously rejected it before executing CUDA Evaluate. Implemented
its D3D12 depth copy plane as R32; it is not an interleaved 64-bit texel.
The [public planar depth/stencil specification](https://github.com/microsoft/DirectX-Specs/blob/master/d3d/PlanarDepthStencilDDISpec.md)
defines this plane mapping. `GetCopyableFootprints` is checked against R32
and width * 4 bytes; copies/barriers affect subresource 0 only. All 4403 depth
pixels match an independent D3D12 typed SRV exactly in each of two legacy and
two enhanced runs. Full build / CTest 16/16 pass
(`d32-stencil-full-ctest.log`). The NGX runner supports
`-PixelProfile depth-stencil` for full-network validation.
`optiscaler-k-depth-stencil.zip` and `optiscaler-m-depth-stencil.zip` both
pass four full frames, with all 44/40 native transformer launches and bit-exact
RGB against the respective non-stencil depth baselines.
The local game package is `dist/windows-rdna4-game`, produced by
`scripts/windows/package-windows-game.ps1`. Its native manifest combines all
11 K + 5 M objects; NVIDIA binaries are excluded. `windows-game.ps1` backs up
replaced files, verifies package hashes and the local DLSS identity, sets the
native runtime environment, and captures stdout/stderr, external debugger,
OptiScaler, exception and version/driver logs. Install/restore regression
restores original DLL/config sentinel bytes exactly. For Silent Hill 2,
`-DiagnosticResolution 1280x720` backs up and restores its two graphics config
files; this avoids modifying progression saves. Original settings after the
stopped failing run have an identical SHA256. `-CacheDirectory` can reuse an
already validated local JIT cache. Development package usage is documented in
`docs/windows-game.md`; in-game success is still a gate.
Startup coverage (2026-10-01): OptiScaler patch `0002` installs d4r at device
discovery, before NGX initialization. `optiscaler-k-preinit-signature.zip` and
`optiscaler-m-preinit-signature.zip` create a dispatch-only command signature
@@ -149,8 +196,8 @@ copy counts remain zero. Add `-BarrierMode enhanced` to the packed-run command
below to reproduce. The explicit harness can also supply layout metadata.
Tracking now also publishes explicit ordinary texture state/layout metadata
in the actual queue submission order. Each split segment retains its own
resource-state snapshot and COM references. An Evaluate input with no barrier
in the actual queue submission order. Each split segment stores its own
resource-state snapshot. An Evaluate input with no barrier
in its own list resolves the most recently submitted state at the callback,
after preceding lists in the batch. The metadata belongs to the resource, with
no global pointer cache or ownership cycle. Legacy buffer/simultaneous-access