Device-removal diagnostics: TDR log, clearer DRED report, LARP_BYTE_VIEWS=0, LARP_SHADER_REPLACE=0, docs (part b of #77) #126

Manually merged
github merged 6 commits from github-bot/gh-126 into main 2026-12-05 20:46:13 +00:00 AGit
Owner

@⁠kadiratesdev on GitHub · 2026-12-05 19:17 UTC · original
kadiratesdev:pr/split-b-diagnostics → main · +209 −2 · 7 files · 6 commits · merged 2026-12-05 20:43 UTC

This is part (b) of the split @⁠gamingwithhomie asked for on #77 (see the review there); #77 stays open for now. This PR is independent of the other two parts (a: Agility/d3d12.dll loader, c: stack copy and watchdog tools), which will follow as separate PRs after the smoke test and the stall-dump run. It is based on current main (334be94).

None of it changes default behaviour of a normal run, except two new log lines (the TDR line and, with LARP_D3D12_DRED, the DRED-applied line) and the wording of the device-removal report.

What is in it

  • TDR settings in the log: TdrLevel, TdrDelay, TdrDdiDelay are read from HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers when the host device is made, with a warning for level 0 (a GPU hang freezes the PC) and 1 (blue screen). Ported from VIctory-NVIDIA 474f949c; the new tdr module has unit tests.
  • Removal report: without LARP_D3D12_DRED, GetAutoBreadcrumbsOutput returns DXGI_ERROR_UNSUPPORTED (0x887A0004). The report used to print that as no breadcrumbs (... 0x887A0004), which reads like the reason (it is not; the reason is the 0x887A0005 after it). It now says the data is off and names LARP_D3D12_DRED=1.
  • DRED report, two additions:
    • With LARP_D3D12_DRED on, the log says device-removed data on ...; if the runtime gave no settings interface it warns instead of staying silent.
    • When the report has no breadcrumb in flight and no faulting address, it says the device was removed outside larp's command lists and points at the shader heap (larp.exe nv-profile, which is already in main).
  • LARP_BYTE_VIEWS=0: every buffer view is made by element (CreateShaderResourceView) instead of ID3D12Device15::TryCreateShaderResourceView byte-offset views. Off by default.
  • LARP_SHADER_REPLACE=0 (or off/none): no replacement shaders are read and every shader runs as translated. Before, the only way was to move the folder, and a missing folder stops larp run. Default unchanged.
  • Docs: the three env vars (plus LARP_D3D12_DRED) in environment-variables.md, and a bisect recipe under exit -2005270523 in troubleshooting-and-crashes.md (DRED first, then each switch alone).

Dependencies

  • None on (a) or (c). LARP_AGILITY is not mentioned anywhere in this PR; its docs row and recipe step come with (a).
  • The "no list in flight" text mentions larp.exe nv-profile, which already exists on main (apps/larp/src/nvprofile.rs).
  • I merged this branch with (a) and (c) locally: no conflicts, and the code is identical to what #77 had.

Testing

  • Cross-built for x86_64-pc-windows-msvc (cargo xwin build --release -p larp): builds, same 8 warning lines as main.
  • cargo test --release --workspace under Wine: everything passes except one test that fails the same way on main: larp-game prompts::font::...the_host_font_outlines_every_label_character_within_its_advance (needs a host font Wine lacks). larp-gpu goes from 3 to 8 tests (the five tdr tests).
  • On Windows 11 with an RTX 3080 Ti, a build containing this code ran a session of more than 50 minutes with LARP_D3D12_DRED=1 (shader heap set to 2048 MiB with nv-profile). The log showed the TDR line (all defaults), the device-removed data on line and the byte-view line as expected, and no device removal up to when I last looked, so the "no list in flight" report text has not been seen in a real removal. It was written after the earlier DRED capture (empty breadcrumbs, no page fault).
  • LARP_BYTE_VIEWS=0 and LARP_SHADER_REPLACE=0 are covered by compilation only. I have not run the game with either set.
**@⁠kadiratesdev** on GitHub · 2026-12-05 19:17 UTC · [original](https://github.com/gamingwithhomie/larp/pull/126) `kadiratesdev:pr/split-b-diagnostics` → `main` · +209 −2 · 7 files · 6 commits · merged 2026-12-05 20:43 UTC This is part (b) of the split @⁠gamingwithhomie asked for on #77 (see the review there); #77 stays open for now. This PR is independent of the other two parts (a: Agility/d3d12.dll loader, c: stack copy and watchdog tools), which will follow as separate PRs after the smoke test and the stall-dump run. It is based on current `main` (334be94). None of it changes default behaviour of a normal run, except two new log lines (the TDR line and, with `LARP_D3D12_DRED`, the DRED-applied line) and the wording of the device-removal report. ## What is in it - **TDR settings in the log:** `TdrLevel`, `TdrDelay`, `TdrDdiDelay` are read from `HKLM\SYSTEM\CurrentControlSet\Control\GraphicsDrivers` when the host device is made, with a warning for level 0 (a GPU hang freezes the PC) and 1 (blue screen). Ported from VIctory-NVIDIA 474f949c; the new `tdr` module has unit tests. - **Removal report:** without `LARP_D3D12_DRED`, `GetAutoBreadcrumbsOutput` returns DXGI_ERROR_UNSUPPORTED (0x887A0004). The report used to print that as `no breadcrumbs (... 0x887A0004)`, which reads like the reason (it is not; the reason is the `0x887A0005` after it). It now says the data is off and names `LARP_D3D12_DRED=1`. - **DRED report, two additions:** - With `LARP_D3D12_DRED` on, the log says `device-removed data on ...`; if the runtime gave no settings interface it warns instead of staying silent. - When the report has no breadcrumb in flight and no faulting address, it says the device was removed outside larp's command lists and points at the shader heap (`larp.exe nv-profile`, which is already in `main`). - **`LARP_BYTE_VIEWS=0`:** every buffer view is made by element (`CreateShaderResourceView`) instead of `ID3D12Device15::TryCreateShaderResourceView` byte-offset views. Off by default. - **`LARP_SHADER_REPLACE=0` (or `off`/`none`):** no replacement shaders are read and every shader runs as translated. Before, the only way was to move the folder, and a missing folder stops `larp run`. Default unchanged. - **Docs:** the three env vars (plus `LARP_D3D12_DRED`) in `environment-variables.md`, and a bisect recipe under `exit -2005270523` in `troubleshooting-and-crashes.md` (DRED first, then each switch alone). ## Dependencies - None on (a) or (c). `LARP_AGILITY` is not mentioned anywhere in this PR; its docs row and recipe step come with (a). - The "no list in flight" text mentions `larp.exe nv-profile`, which already exists on `main` (`apps/larp/src/nvprofile.rs`). - I merged this branch with (a) and (c) locally: no conflicts, and the code is identical to what #77 had. ## Testing - Cross-built for `x86_64-pc-windows-msvc` (`cargo xwin build --release -p larp`): builds, same 8 warning lines as `main`. - `cargo test --release --workspace` under Wine: everything passes except one test that fails the same way on `main`: `larp-game prompts::font::...the_host_font_outlines_every_label_character_within_its_advance` (needs a host font Wine lacks). `larp-gpu` goes from 3 to 8 tests (the five `tdr` tests). - On Windows 11 with an RTX 3080 Ti, a build containing this code ran a session of more than 50 minutes with `LARP_D3D12_DRED=1` (shader heap set to 2048 MiB with `nv-profile`). The log showed the TDR line (all defaults), the `device-removed data on` line and the byte-view line as expected, and no device removal up to when I last looked, so the "no list in flight" report text has not been seen in a real removal. It was written after the earlier DRED capture (empty breadcrumbs, no page fault). - `LARP_BYTE_VIEWS=0` and `LARP_SHADER_REPLACE=0` are covered by compilation only. I have not run the game with either set.
A switch to bisect host device removals (0x887A0005) on NVIDIA: with it the
layer takes the ID3D12Device::CreateShaderResourceView path it takes on a
device without ID3D12Device15 / D3D12_OPTIONS22. Default unchanged.
Before, the only way to run without replacements was to move the folder,
and a missing folder stops larp run at its start. With 0 (or off/none) no
replacement is read; pipelines are named by their code, so the ones made
from translations get their own cache entries. Default unchanged.
TdrLevel 0 or 1 turns a GPU hang into a frozen PC or a blue screen instead of
a device removal the layer can report; the log names TdrLevel, TdrDelay and
TdrDdiDelay so a removal report says whether a timeout reset was possible.
Ported from VIctory-NVIDIA (474f949c).
Without LARP_D3D12_DRED, GetAutoBreadcrumbsOutput answers
DXGI_ERROR_UNSUPPORTED and the report read "no breadcrumbs (... not
supported ... 0x887A0004)", which users (and we) took for the removal's
reason. The reason is the 0x887A0005 that follows; the report now says the
data is off and which switch turns it on.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-05 19:20:13 +00:00
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-12-05 19:17 UTC · original · reviewed

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-12-05 19:17 UTC · [original](https://github.com/gamingwithhomie/larp/pull/126#pullrequestreview-6205411808) · **reviewed** Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
github-bot referenced this pull request from a commit 2026-12-05 20:45:09 +00:00
github manually merged commit b7bf40dc1d into main 2026-12-05 20:46:13 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.