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

Closed
github-bot wants to merge 1 commit from gh-pr/348/head into gh-pr/348/base
Owner

@⁠GDAgent on GitHub · 2026-11-23 23:19 UTC · original
GDAgent:feat/d3d12-gpu-based-validation → main · +44 −0 · 1 files · 1 commits · closed without merging

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.
**@⁠GDAgent** on GitHub · 2026-11-23 23:19 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/348) `GDAgent:feat/d3d12-gpu-based-validation` → `main` · +44 −0 · 1 files · 1 commits · closed without merging **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.
When the D3D12 debug layer is enabled (TOMBOX_D3D12_DEBUG), setting
TOMBOX_D3D12_GBV=1 (or "on") also queries ID3D12Debug1 and calls
SetEnableGPUBasedValidation(TRUE) before the device is created. The log
records whether it was enabled or why not (ID3D12Debug1 unavailable).
Without the variable nothing changes.

GPU-based validation reports errors the CPU-side debug layer cannot see,
e.g. GPU_BASED_VALIDATION_STRUCTURED_BUFFER_STRIDE_MISMATCH between a
title's buffer views and a translated shader's element type (26 such
errors in The Matrix Awakens led to #346 and #347).

Tests: gbv_tests (the variable is opt-in, the ID3D12Debug1 IID matches
d3d12sdklayers.h).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:19:50 +00:00
github-bot closed this pull request 2026-11-26 06:19:50 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-25 13:50 UTC · original

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

**@⁠omonkeyz** on GitHub · 2026-11-25 13:50 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/348#issuecomment-7164370227) 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

This discussion has been locked. Commenting is limited to contributors.
No description provided.