Skip to content

GPU: render on the widest-PCIe-link adapter; place the window on its monitor without a resize - #750

Open
KyleS98 wants to merge 1 commit into
fxceless:mainfrom
KyleS98:feat/adapter-widest-pcie-link
Open

KyleS98 wants to merge 1 commit into
fxceless:mainfrom
KyleS98:feat/adapter-widest-pcie-link

Conversation

@KyleS98

@KyleS98 KyleS98 commented Nov 25, 2026

Copy link
Copy Markdown

The host device is made on the default adapter (D3D12CreateDevice(None, …)), which is DXGI's first. On a PC with two cards of the same name, the first one listed isn't necessarily the fast one. The test machine has two RTX 3090 Ti: one on an x16 link with both monitors attached, and one on an x1 link in a chipset slot. Measured in the world with everything else equal, the x1 card ran at 1.2–1.3 fps (≈550 ms on the GPU) against ≈3 fps (≈210 ms) on the x16 card.

Change

  • chosen_adapter: lists every hardware adapter with its PCI bus (D3DKMT adapter address) and its current PCIe link width (cfgmgr32 device properties). The widest link wins, then the most dedicated memory. Each adapter and the choice are logged at warn level.
    • VICTORY_ADAPTER=<part of the name> filters by name.
    • VICTORY_ADAPTER_BUS=<n> pins a PCI bus.
  • place_on_render_gpu runs when the swap chain is made. If the title's window is already on a monitor driven by the render adapter, it is left alone. Otherwise it is moved, never resized, onto that adapter's first output, so the picture isn't copied to another card for scan-out. An earlier version resized the title's window from the host thread, which sent the title's own thread size messages it wasn't ready for: a null write in the title at startup on every launch.
  • On a single-GPU PC nothing changes: one adapter is listed and chosen, and the window stays where it is.

Testing (this branch on 310c6eb, RTX 3090 Ti ×2 + AMD iGPU, Windows 11, diag build, retail title)

run result
defaults, 200 s, cold shader cache 3 adapters listed (bus 1 ×16, bus 116 iGPU, bus 5 ×1); device on bus 1, link width 16; "window already on a monitor of the render GPU"; renders, no crash
defaults, 200 s, warm cache same
VICTORY_ADAPTER_BUS=5, 100 s device on bus 5, link width 1; "render GPU has no monitor; the window stays on whichever display is plugged in"; renders, no crash

cargo clippy -p victory-gpu --all-targets: no new warnings.

Credit: the adapter choice is @KyleS98's; the placement fix came from debugging it.

AI-assisted (Claude Code, Claude Opus 5.5). No game data attached.

🤖 Generated with Claude Code

…monitor without a resize

The host device was made on the default adapter, DXGI's first. On a PC
with two cards of the same name (here two RTX 3090 Ti, one on an x16
link, one on an x1 link of a chipset slot) the first one listed is not
necessarily the fast one.

- chosen_adapter: every hardware adapter is listed with its PCI bus
  (D3DKMT adapter address) and current PCIe link width (cfgmgr32 device
  properties); the widest link wins, then the most dedicated memory.
  VICTORY_ADAPTER=<part of the name> filters by name, VICTORY_ADAPTER_BUS=
  <n> pins a PCI bus. Each adapter and the choice are logged.
- place_on_render_gpu: when the swap chain is made, the title's window is
  left alone if its monitor is already an output of the render adapter;
  otherwise it is moved (never resized) onto that adapter's first output,
  so the picture is not copied to another card for scan-out. Resizing the
  title's window from this thread sent the title's thread size messages it
  was not ready for (a null write in the title at startup).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@KyleS98
KyleS98 force-pushed the feat/adapter-widest-pcie-link branch from 2169035 to 5d6b582 Compare November 25, 2026 08:47
e4glevlr pushed a commit to e4glevlr/victory-fork that referenced this pull request Nov 25, 2026
With TdrLevel 0 Windows never resets a hung GPU: a slow or hung world
frame freezes the whole desktop, and the runtime never sees a device
removal it could report (#1054). With 1 the timeout is a blue screen.
Both are set by hand, often to keep slow frames from being reset, and
reports of "the PC froze" do not say so.

When the host device is made on a hardware adapter, read TdrLevel,
TdrDelay and TdrDdiDelay from HKLM\SYSTEM\CurrentControlSet\Control\
GraphicsDrivers, log them ("default" where a value is not set), and warn
for TdrLevel 0 or 1 with what to set instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 42961e8)
(cherry picked from commit 73938de)

Port notes: the device stays on fxceless#750's chosen adapter; the TDR log follows its creation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant