Reuse sibling hardware adapter pipeline library when DeviceId is spoofed (MFG Unlocker) #486

Open
feng wants to merge 1 commit from feng/Darner:pipeline-library-sibling-adapter into Main
First-time contributor

Contributor role (optional)

  • Fluxer ID: kirums#8956

What it changes

  • The problem on main: pipeline::library keys each adapter cache folder by hardware-{VendorId:04x}-{DeviceId:04x}-{SubSysId:08x}-{Revision:02x}. When a DXGI DeviceId spoofer (such as MFG Unlocker spoofing e.g. 1e07 -> 2684) is toggled on or off, Darner looks in a new adapter directory with no host-pipelines.bin and rebuilds the entire pipeline library from scratch even though the physical GPU, driver, (VendorId, SubSysId, Revision), and translator are identical.

This updates crates/darner-gpu/src/pipeline/library.rs so that when the current hardware adapter directory has no fresh host-pipelines.bin for the current translator, Darner scans sibling hardware-{vendor}-*-{subsys}-{rev} directories matching the same (VendorId, SubSysId, Revision) (case-insensitive hex for NTFS, supporting directories/junctions, skipping software adapters and stale translators), sorts candidates deterministically (largest first), and probes each candidate read-only against D3D12 CreatePipelineLibrary until one succeeds. Writes and compactions still target only the active adapter directory, leaving the sibling cache untouched.

How it was tested

  • Tested revision: 8a30f9f (rebased cleanly onto origin/main d91d8e4)
  • Commands and results:
    • cargo xtask policy -> PASS (565 files ok)
    • cargo clippy --workspace --all-targets --locked -- -D warnings -> PASS (0 warnings)
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings -> PASS (0 warnings)
    • cargo test -p darner-gpu --lib --locked pipeline::library -> PASS (36/36, including live D3D12 hardware_library_reopens_from_sibling_device_id_on_live_device on RTX 2080 Ti plus unit tests covering multi-candidate fallback, NTFS hex case, NEXT_FILE dir fallback, stale translator skipping, and read-only sibling protection)
  • Changes a default: yes, for hardware adapters whose own DeviceId cache directory has no fresh host-pipelines.bin while a sibling hardware-{vendor}-*-{subsys}-{rev} directory with a matching translator does (typical when toggling MFG Unlocker). No change when the active adapter directory already has a fresh library or no matching sibling exists.
  • A/B result: Not a frame-rate change; avoids cold pipeline rebuild on startup when DeviceId changes. Verified via live D3D12 test hardware_library_reopens_from_sibling_device_id_on_live_device confirming CreatePipelineLibrary opens the sibling blob directly on the live RTX 2080 Ti device.
  • Gates run on that revision (the three in AGENTS.md; there is no CI):
    • Gate 1 (cargo clippy --workspace --all-targets --locked -- -D warnings): PASS on 8a30f9f
    • Gate 2 (cargo clippy --workspace --all-targets --all-features --locked -- -D warnings): PASS on 8a30f9f
    • Gate 3 (cargo test --workspace --locked): pipeline::library (36/36) passed on 8a30f9f; full workspace test run was not completed on this machine due to pre-existing unrelated darner-shader oracle64::legacy_mul_forms_are_exact debug-mode hang (>20 min) and darner-gpu watch::tests parallel flakes (related to #262).
  • Gameplay, when relevant: Verified via live D3D12 unit test on RTX 2080 Ti (Windows 11 build 26300, driver 621.1) and compiled into a 114-minute local run (native un-spoofed DeviceId, where the existing primary directory was used as expected).
  • Shader wave sizes tested, when relevant: N/A.
  • Hardware dependence: General for Windows/D3D12 hardware adapters with DXGI DeviceId spoofing; software (WARP) adapters are explicitly excluded from sibling matching.
  • Coverage gaps: End-to-end in-game launch with MFG Unlocker actively spoofing DeviceId was not separately re-run on 8a30f9f (MFG Unlocker was disabled on this rig in favour of dlssg_for_sm86); the live D3D12 CreatePipelineLibrary reopen from a sibling DeviceId directory is directly covered by hardware_library_reopens_from_sibling_device_id_on_live_device.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only).
    • Compiled and run in-game on native DeviceId (non-fallback path) and verified the fallback reopen path directly on the live D3D12 device via hardware_library_reopens_from_sibling_device_id_on_live_device; did not re-run a full game session with MFG Unlocker enabled.
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: #348, #275, #270, #232, #235 (all touch crates/darner-gpu/src/pipeline/library.rs for unrelated issues)
  • Replaces or overlaps: none found
## Contributor role (optional) - Fluxer ID: kirums#8956 ## What it changes - The problem on main: `pipeline::library` keys each adapter cache folder by `hardware-{VendorId:04x}-{DeviceId:04x}-{SubSysId:08x}-{Revision:02x}`. When a DXGI `DeviceId` spoofer (such as MFG Unlocker spoofing e.g. `1e07` -> `2684`) is toggled on or off, Darner looks in a new adapter directory with no `host-pipelines.bin` and rebuilds the entire pipeline library from scratch even though the physical GPU, driver, `(VendorId, SubSysId, Revision)`, and translator are identical. This updates `crates/darner-gpu/src/pipeline/library.rs` so that when the current hardware adapter directory has no fresh `host-pipelines.bin` for the current translator, Darner scans sibling `hardware-{vendor}-*-{subsys}-{rev}` directories matching the same `(VendorId, SubSysId, Revision)` (case-insensitive hex for NTFS, supporting directories/junctions, skipping software adapters and stale translators), sorts candidates deterministically (largest first), and probes each candidate read-only against D3D12 `CreatePipelineLibrary` until one succeeds. Writes and compactions still target only the active adapter directory, leaving the sibling cache untouched. ## How it was tested - Tested revision: `8a30f9f` (rebased cleanly onto `origin/main` `d91d8e4`) - Commands and results: - `cargo xtask policy` -> PASS (`565 files ok`) - `cargo clippy --workspace --all-targets --locked -- -D warnings` -> PASS (0 warnings) - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` -> PASS (0 warnings) - `cargo test -p darner-gpu --lib --locked pipeline::library` -> PASS (36/36, including live D3D12 `hardware_library_reopens_from_sibling_device_id_on_live_device` on RTX 2080 Ti plus unit tests covering multi-candidate fallback, NTFS hex case, `NEXT_FILE` dir fallback, stale translator skipping, and read-only sibling protection) - Changes a default: yes, for hardware adapters whose own `DeviceId` cache directory has no fresh `host-pipelines.bin` while a sibling `hardware-{vendor}-*-{subsys}-{rev}` directory with a matching translator does (typical when toggling MFG Unlocker). No change when the active adapter directory already has a fresh library or no matching sibling exists. - A/B result: Not a frame-rate change; avoids cold pipeline rebuild on startup when `DeviceId` changes. Verified via live D3D12 test `hardware_library_reopens_from_sibling_device_id_on_live_device` confirming `CreatePipelineLibrary` opens the sibling blob directly on the live RTX 2080 Ti device. - Gates run on that revision (the three in AGENTS.md; there is no CI): - Gate 1 (`cargo clippy --workspace --all-targets --locked -- -D warnings`): PASS on `8a30f9f` - Gate 2 (`cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`): PASS on `8a30f9f` - Gate 3 (`cargo test --workspace --locked`): `pipeline::library` (36/36) passed on `8a30f9f`; full workspace test run was not completed on this machine due to pre-existing unrelated `darner-shader` `oracle64::legacy_mul_forms_are_exact` debug-mode hang (>20 min) and `darner-gpu` `watch::tests` parallel flakes (related to #262). - Gameplay, when relevant: Verified via live D3D12 unit test on RTX 2080 Ti (Windows 11 build 26300, driver 621.1) and compiled into a 114-minute local run (native un-spoofed `DeviceId`, where the existing primary directory was used as expected). - Shader wave sizes tested, when relevant: N/A. - Hardware dependence: General for Windows/D3D12 hardware adapters with DXGI `DeviceId` spoofing; software (WARP) adapters are explicitly excluded from sibling matching. - Coverage gaps: End-to-end in-game launch with MFG Unlocker actively spoofing `DeviceId` was not separately re-run on `8a30f9f` (MFG Unlocker was disabled on this rig in favour of `dlssg_for_sm86`); the live D3D12 `CreatePipelineLibrary` reopen from a sibling `DeviceId` directory is directly covered by `hardware_library_reopens_from_sibling_device_id_on_live_device`. ## Checklist - [ ] I ran this change in the game, or say below why it can't be (docs, tests only). - Compiled and run in-game on native `DeviceId` (non-fallback path) and verified the fallback reopen path directly on the live D3D12 device via `hardware_library_reopens_from_sibling_device_id_on_live_device`; did not re-run a full game session with MFG Unlocker enabled. - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: #348, #275, #270, #232, #235 (all touch `crates/darner-gpu/src/pipeline/library.rs` for unrelated issues) - Replaces or overlaps: none found
Author
First-time contributor

Rebased onto latest main (c8258f9 / v2026.12.04.01) as 33eee64, resolving the conflict in crates/darner-gpu/src/pipeline/library.rs while keeping upstream's read_pending_or_primary handling in read_legacy.

Re-verified on 33eee64:

  • cargo xtask policy --staged (1 files ok)
  • cargo clippy --workspace --all-targets --locked -- -D warnings (pass, 0 warnings)
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings (pass, 0 warnings)
  • cargo test -p darner-gpu --lib --locked pipeline::library (40/40 passed, including the 4 new empty-pending-file tests and live D3D12 hardware_library_reopens_from_sibling_device_id_on_live_device)
Rebased onto latest `main` (`c8258f9` / `v2026.12.04.01`) as `33eee64`, resolving the conflict in `crates/darner-gpu/src/pipeline/library.rs` while keeping upstream's `read_pending_or_primary` handling in `read_legacy`. Re-verified on `33eee64`: - `cargo xtask policy --staged` (`1 files ok`) - `cargo clippy --workspace --all-targets --locked -- -D warnings` (pass, 0 warnings) - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` (pass, 0 warnings) - `cargo test -p darner-gpu --lib --locked pipeline::library` (40/40 passed, including the 4 new empty-pending-file tests and live D3D12 `hardware_library_reopens_from_sibling_device_id_on_live_device`)
feng force-pushed pipeline-library-sibling-adapter from 8a30f9fba4 to 33eee644bd 2026-12-05 05:39:54 +00:00 Compare
TrustNo1 changed title from [pr-fix][startup][shaders] Reuse sibling hardware adapter pipeline library when DeviceId is spoofed (MFG Unlocker) to Reuse sibling hardware adapter pipeline library when DeviceId is spoofed (MFG Unlocker) 2026-12-06 03:28:05 +00:00
Owner

Test needed — commit 33eee644; what to check:

  • The problem on main: pipeline::library keys each adapter cache folder by hardware-{VendorId:04x}-{DeviceId:04x}-{SubSysId:08x}-{Revision:02x}. When a DXGI DeviceId spoofer (such as MFG Unlocker spoofing e.g. 1e07 -> 2684) is toggled on or off, Darner looks in a new adapter directory with no host-pipelines.bin and rebuilds the entire pipeline library from scratch even though the physical GPU, driver, (VendorId, SubSysId, Revision), and translator are identical.

This updates crates/darner-gpu/src/pipeline/library.rs so that when the current hardware adapter directory has no fresh host-pipelines.bin for the current translator, Darner scans sibling hardware-{vendor}-*-{subsys}-{rev} directories matching the same (VendorId, SubSysId, Revision) (case-insensitive hex for NTFS, supporting directories/junctions, skipping software adapters and stale translators), sorts candidates deterministically (largest first), and probes each candidate read-only against D3D12 CreatePipelineLibrary until one succeeds. Writes and compactions still target only the active adapter directory, leaving the sibling cache untouched.

Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture.

Reply testing to take this run; it's free again after 24 h with no results.

**Test needed** — commit `33eee644`; what to check: - The problem on main: `pipeline::library` keys each adapter cache folder by `hardware-{VendorId:04x}-{DeviceId:04x}-{SubSysId:08x}-{Revision:02x}`. When a DXGI `DeviceId` spoofer (such as MFG Unlocker spoofing e.g. `1e07` -> `2684`) is toggled on or off, Darner looks in a new adapter directory with no `host-pipelines.bin` and rebuilds the entire pipeline library from scratch even though the physical GPU, driver, `(VendorId, SubSysId, Revision)`, and translator are identical. This updates `crates/darner-gpu/src/pipeline/library.rs` so that when the current hardware adapter directory has no fresh `host-pipelines.bin` for the current translator, Darner scans sibling `hardware-{vendor}-*-{subsys}-{rev}` directories matching the same `(VendorId, SubSysId, Revision)` (case-insensitive hex for NTFS, supporting directories/junctions, skipping software adapters and stale translators), sorts candidates deterministically (largest first), and probes each candidate read-only against D3D12 `CreatePipelineLibrary` until one succeeds. Writes and compactions still target only the active adapter directory, leaving the sibling cache untouched. Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture. Reply `testing` to take this run; it's free again after 24 h with no results.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'pipeline-library-sibling-adapter:feng-pipeline-library-sibling-adapter'
git switch 'feng-pipeline-library-sibling-adapter'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'Main'
git merge --no-ff 'feng-pipeline-library-sibling-adapter'
git switch 'feng-pipeline-library-sibling-adapter'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'feng-pipeline-library-sibling-adapter'
git switch 'feng-pipeline-library-sibling-adapter'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'feng-pipeline-library-sibling-adapter'
git switch 'Main'
git merge --squash 'feng-pipeline-library-sibling-adapter'
git switch 'Main'
git merge --ff-only 'feng-pipeline-library-sibling-adapter'
git switch 'Main'
git merge 'feng-pipeline-library-sibling-adapter'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!486
No description provided.