d3d12_xs: opt-in GPU-based validation with TOMBOX_D3D12_GBV=1 #348

Closed
GDAgent wants to merge 1 commit from upstream-pr/348 into main
GDAgent commented 2026-11-23 23:19:00 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by GDAgent on 2026-11-23T23:19:00Z.


Library / area: d3d12_xs, debug-layer setup (lib.rs, maybe_enable_debug_layer)

What it does

With the D3D12 debug layer enabled (TOMBOX_D3D12_DEBUG), TOMBOX_D3D12_GBV=1 (or on) additionally queries ID3D12Debug1 and calls SetEnableGPUBasedValidation(TRUE) before the device is created. The compat log says whether it was enabled or why not (ID3D12Debug1 unavailable hr=...). Without the variable nothing changes; it is a diagnostic switch, off by default.

Why

GPU-based validation sees what the CPU-side debug layer cannot: descriptors and views as shaders actually use them. On The Matrix Awakens (native Windows 11; not run under Proton; RDNA2) it reported 26 GPU_BASED_VALIDATION_STRUCTURED_BUFFER_STRIDE_MISMATCH errors between the title's buffer views and the translated shaders' element types, which led to #346 and #347 (0 errors after both).

Tests

  • gbv_tests::gbv_is_opt_in: 1/on enable it; unset, 0, off, yes do not.
  • gbv_tests::debug1_iid_is_the_sdk_layers_value: ID3D12Debug1 = {affaa4ca-63fe-4d8e-b8ad-159000af4304}.
  • Used in two 600 s / 420 s title runs on this host (enabled, messages arrive through OutputDebugString like the rest of the debug layer).

Limits

  • Needs a working debug layer: docs/BLOCKERS.md notes hosts where D3D12GetDebugInterface fails (Graphics Tools / Developer Mode); there the switch logs nothing extra and changes nothing.
  • GPU-based validation is very slow (the title reached its second frame in ~10 minutes); it is for targeted diagnosis only.
<!-- greyfinch-sync:omonkeyz/xbox-emulator:issue:6570868918 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/348). Originally posted by [GDAgent](https://github.com/GDAgent) on 2026-11-23T23:19:00Z. --- **Library / area:** d3d12_xs, debug-layer setup (`lib.rs`, `maybe_enable_debug_layer`) ### What it does With the D3D12 debug layer enabled (`TOMBOX_D3D12_DEBUG`), `TOMBOX_D3D12_GBV=1` (or `on`) additionally queries `ID3D12Debug1` and calls `SetEnableGPUBasedValidation(TRUE)` before the device is created. The compat log says whether it was enabled or why not (`ID3D12Debug1 unavailable hr=...`). Without the variable nothing changes; it is a diagnostic switch, off by default. ### Why GPU-based validation sees what the CPU-side debug layer cannot: descriptors and views as shaders actually use them. On The Matrix Awakens (native Windows 11; not run under Proton; RDNA2) it reported 26 `GPU_BASED_VALIDATION_STRUCTURED_BUFFER_STRIDE_MISMATCH` errors between the title's buffer views and the translated shaders' element types, which led to #346 and #347 (0 errors after both). ### Tests - `gbv_tests::gbv_is_opt_in`: `1`/`on` enable it; unset, `0`, `off`, `yes` do not. - `gbv_tests::debug1_iid_is_the_sdk_layers_value`: `ID3D12Debug1` = `{affaa4ca-63fe-4d8e-b8ad-159000af4304}`. - Used in two 600 s / 420 s title runs on this host (enabled, messages arrive through OutputDebugString like the rest of the debug layer). ### Limits - Needs a working debug layer: `docs/BLOCKERS.md` notes hosts where `D3D12GetDebugInterface` fails (Graphics Tools / Developer Mode); there the switch logs nothing extra and changes nothing. - GPU-based validation is very slow (the title reached its second frame in ~10 minutes); it is for targeted diagnosis only.
omonkeyz commented 2026-11-25 13:50:35 +00:00 (Migrated from github.com)

Imported from omonkeyz/xbox-emulator. Originally posted by omonkeyz on 2026-11-25T13:50:35Z.


Applied on main in 0e6bde2 (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

<!-- greyfinch-sync:omonkeyz/xbox-emulator:comment:7164370227 --> Imported from [omonkeyz/xbox-emulator](https://github.com/omonkeyz/xbox-emulator/pull/348#issuecomment-7164370227). Originally posted by [omonkeyz](https://github.com/omonkeyz) on 2026-11-25T13:50:35Z. --- Applied on main in 0e6bde2 (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
omonkeyz/xbox-emulator!348
No description provided.