startup: size device view descriptions by the title record #3554

Closed
opened 2026-11-30 04:28:42 +00:00 by github-bot · 3 comments
Owner

@⁠KelboLive on GitHub · 2026-11-30 04:28 UTC · original

Change

view_slot() sized its own checks on a slot 18-21 description from the desktop header, and forwarded the
title's pointer to the desktop for the desktop to read at its width. The title supplies a 40-byte record;
the Agility SDK 1.620.2 header makes D3D12_UNORDERED_ACCESS_VIEW_DESC 48 bytes. A description ending
exactly at a readable page therefore failed the 48-byte readability test, the 3D mip range check was
skipped, and the desktop then read its own struct from a 40-byte record and removed the device with
DXGI_ERROR_INVALID_CALL (0x887a0001).

Two changes:

  • The shim's checks use the record width (ViewRecord::srv_desc_bytes, ViewRecord::uav_desc_bytes, 20 for
    a render target, 16 for a depth-stencil view), which is what note_view() already records for the same
    slots, with static_asserts holding each desktop struct to at least that width.
  • The record is copied into a zero-filled 64-byte buffer and that is forwarded, so the desktop can
    never read past the title's record. The null-view adaptation reads the same copy rather than the title
    pointer.

startup_view_dimension_device gains two cases that place the description at the end of a committed page
with a PAGE_NOACCESS page after it.

Verification

Base 44a3ad5aa. Agility SDK 1.620.2, WARP 1.0.22, NVIDIA GeForce RTX 4070 Ti SUPER (driver 32.0.16.2101).

ctest --test-dir out/build/warp-agility -R '^startup_view_dimension_' -V
Case Before After
Out-of-range 3D mip at an ordinary address refused, descriptor kept refused, descriptor kept
Out-of-range 3D mip at a page boundary device removed 0x887a0001 refused, descriptor kept
Valid 3D mip at a page boundary device removed 0x887a0001 created, device alive

The same three rows hold on warp and on hardware. The control row is what separates a working range
check from a skipped one; the middle row is the refusal the fixture expects.

Negative control: with the source change stashed and the fixture rebuilt, both boundary cases fail on
both adapters:

FAIL: (e) the page-boundary description removed the device
FAIL: (f) a valid description at the page boundary removed the device

No regression. The change touches every view creation, so:

# Agility tree
ctest --test-dir out/build/warp-agility -R 'view|descriptor|uav|srv'
100% tests passed out of 236

# In-box tree, complete non-hardware suite
ctest --preset dev --parallel 4 -E '_hardware$'
99% tests passed, 5 tests failed out of 2224   (2169 passed, 50 skipped)

All five in-box failures are on main already and unrelated: native_cvt_f16_i16_{ir,controls} and
native_sdwa_profiles_{ir,dxil} (issue #3549) and startup_triage_run (#3548). Each startup_view_dimension_*,
startup_null_views_* and startup_present_view* entry passed.

Why CI cannot see this

In-box headers already report 40 bytes, so the check succeeded before and after and the fixture passes in
both Windows jobs. The reproduction needs the Agility configuration. The three earlier instances of this
40/48 split are #3512 and #3525 (merged) and #3538 (issue); this closes the device-slot instance.

Measured detail and the case table are also recorded in docs/experiments/agility-compute-views.md.

Fixes #3538.

Follow-up at 386db6092

  • Review MUST: slots 20 and 21 now use sizeof(D3D12_RENDER_TARGET_VIEW_DESC) and sizeof(D3D12_DEPTH_STENCIL_VIEW_DESC) (24 each) instead of 20 and 16, which truncated ArraySize at offset 16 and PlaneSlice at 20.
  • Review SHOULD: record_view's width for those slots is the same 24, so recorded array RTV/DSV views keep their fields.
  • static_asserts pin both to 24 bytes, so the truncation cannot return silently.
  • Rebased onto 844e57d.

Verification at this head:

in-box:  ctest -R 'view|descriptor|depth|dsv'                          171/171
agility: ctest -R 'view|descriptor|uav|srv|rtv|dsv'                    247/250

The three Agility failures (startup_memory_srv_diag_{warp,hardware}, startup_compute_comparison_srv_warp) fail identically with this change stashed, so they are not from it.

Pull request details or commits were not available from GitHub; kept as an issue.

**@⁠KelboLive** on GitHub · 2026-11-30 04:28 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3552) ## Change `view_slot()` sized its own checks on a slot 18-21 description from the desktop header, and forwarded the title's pointer to the desktop for the desktop to read at *its* width. The title supplies a 40-byte record; the Agility SDK 1.620.2 header makes `D3D12_UNORDERED_ACCESS_VIEW_DESC` 48 bytes. A description ending exactly at a readable page therefore failed the 48-byte readability test, the 3D mip range check was skipped, and the desktop then read its own struct from a 40-byte record and removed the device with `DXGI_ERROR_INVALID_CALL` (`0x887a0001`). Two changes: - The shim's checks use the record width (`ViewRecord::srv_desc_bytes`, `ViewRecord::uav_desc_bytes`, 20 for a render target, 16 for a depth-stencil view), which is what `note_view()` already records for the same slots, with `static_assert`s holding each desktop struct to at least that width. - The record is copied into a zero-filled 64-byte buffer and **that** is forwarded, so the desktop can never read past the title's record. The null-view adaptation reads the same copy rather than the title pointer. `startup_view_dimension_device` gains two cases that place the description at the end of a committed page with a `PAGE_NOACCESS` page after it. ## Verification Base `44a3ad5aa`. Agility SDK 1.620.2, WARP 1.0.22, NVIDIA GeForce RTX 4070 Ti SUPER (driver 32.0.16.2101). ```powershell ctest --test-dir out/build/warp-agility -R '^startup_view_dimension_' -V ``` | Case | Before | After | |---|---|---| | Out-of-range 3D mip at an ordinary address | refused, descriptor kept | refused, descriptor kept | | Out-of-range 3D mip at a page boundary | **device removed `0x887a0001`** | refused, descriptor kept | | Valid 3D mip at a page boundary | **device removed `0x887a0001`** | created, device alive | The same three rows hold on `warp` and on `hardware`. The control row is what separates a working range check from a skipped one; the middle row is the refusal the fixture expects. **Negative control:** with the source change stashed and the fixture rebuilt, both boundary cases fail on both adapters: ``` FAIL: (e) the page-boundary description removed the device FAIL: (f) a valid description at the page boundary removed the device ``` **No regression.** The change touches every view creation, so: ```powershell # Agility tree ctest --test-dir out/build/warp-agility -R 'view|descriptor|uav|srv' 100% tests passed out of 236 # In-box tree, complete non-hardware suite ctest --preset dev --parallel 4 -E '_hardware$' 99% tests passed, 5 tests failed out of 2224 (2169 passed, 50 skipped) ``` All five in-box failures are on `main` already and unrelated: `native_cvt_f16_i16_{ir,controls}` and `native_sdwa_profiles_{ir,dxil}` (issue #3549) and `startup_triage_run` (#3548). Each `startup_view_dimension_*`, `startup_null_views_*` and `startup_present_view*` entry passed. ## Why CI cannot see this In-box headers already report 40 bytes, so the check succeeded before and after and the fixture passes in both Windows jobs. The reproduction needs the Agility configuration. The three earlier instances of this 40/48 split are #3512 and #3525 (merged) and #3538 (issue); this closes the device-slot instance. Measured detail and the case table are also recorded in `docs/experiments/agility-compute-views.md`. Fixes #3538. ## Follow-up at `386db6092` - Review MUST: slots 20 and 21 now use `sizeof(D3D12_RENDER_TARGET_VIEW_DESC)` and `sizeof(D3D12_DEPTH_STENCIL_VIEW_DESC)` (24 each) instead of 20 and 16, which truncated `ArraySize` at offset 16 and `PlaneSlice` at 20. - Review SHOULD: `record_view`'s width for those slots is the same 24, so recorded array RTV/DSV views keep their fields. - `static_assert`s pin both to 24 bytes, so the truncation cannot return silently. - Rebased onto `844e57d`. Verification at this head: ``` in-box: ctest -R 'view|descriptor|depth|dsv' 171/171 agility: ctest -R 'view|descriptor|uav|srv|rtv|dsv' 247/250 ``` The three Agility failures (`startup_memory_srv_diag_{warp,hardware}`, `startup_compute_comparison_srv_warp`) fail identically with this change stashed, so they are not from it. *Pull request details or commits were not available from GitHub; kept as an issue.*
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 04:28:43 +00:00
Author
Owner

@⁠KelboLive on GitHub · 2026-11-30 04:33 UTC · original

The Linux job's failure is inherited from main at 44a3ad5aa, not caused by this change:

FAIL source reasons missing from COMPUTE_DISPATCH_REASONS: 'an output UAV interval exceeds the D3D12 buffer view element limit'
FAILED: tests/startup_triage_run_check.py

That is the entry #3548 adds. #3537, #3540 and #3548 are green because their branches predate #3473; this PR is based on current main, so it carries the failure. Nothing here touches d3d12_compute_dispatch.inl or the triage reasons.

I will rebase this branch on main once #3548 lands and re-run the check, rather than duplicate the one-line fix here.

**@⁠KelboLive** on GitHub · 2026-11-30 04:33 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3552#issuecomment-7268887701) The Linux job's failure is inherited from `main` at `44a3ad5aa`, not caused by this change: ``` FAIL source reasons missing from COMPUTE_DISPATCH_REASONS: 'an output UAV interval exceeds the D3D12 buffer view element limit' FAILED: tests/startup_triage_run_check.py ``` That is the entry #3548 adds. #3537, #3540 and #3548 are green because their branches predate #3473; this PR is based on current `main`, so it carries the failure. Nothing here touches `d3d12_compute_dispatch.inl` or the triage reasons. I will rebase this branch on `main` once #3548 lands and re-run the check, rather than duplicate the one-line fix here.
Author
Owner

@⁠KelboLive on GitHub · 2026-11-30 06:51 UTC · original

Audited the rest of the shim for this class, so the answer to "is this the last one" is measured rather than assumed.

Compiled a probe that prints sizeof and lignof for every struct the shim sizes or forwards, once against the in-box headers and once with -I out/build/warp-agility/agility-headers/build/native/include. Of 63 structs, exactly one differs:

inbox : D3D12_UNORDERED_ACCESS_VIEW_DESC   40  8
agility: D3D12_UNORDERED_ACCESS_VIEW_DESC   48  8

Everything else agrees: D3D12_SHADER_RESOURCE_VIEW_DESC, D3D12_RENDER_TARGET_VIEW_DESC, D3D12_DEPTH_STENCIL_VIEW_DESC, the blend/rasterizer/depth-stencil descriptions, D3D12_GRAPHICS_PIPELINE_STATE_DESC, D3D12_COMPUTE_PIPELINE_STATE_DESC, the indirect argument and draw/dispatch argument structs, root signature and descriptor range descriptions, D3D12_RESOURCE_DESC, heap, barrier, rect, viewport, copy-location and subresource structs.

Cross-check of every remaining use of a UAV description in the shim:

Site Handling
iew_slot slots 18-21 this change: record width, zero-filled copy forwarded
compute output tokens (#3512) record width into a zero-initialised struct
esolve_pixel_uavs (#3525) record width into a zero-initialised itle_view, with static_assert
pixel_uav_view (d3d12_draw.inl:107) dereferences only Format, ViewDimension and the first union member, all inside the first 24 bytes
d3d12_draw.inl:3659, d3d12_compute_dispatch.inl:1331,1341 pass a local struct, never a title pointer

So the 40/48 split has no remaining instance. The probe is untracked scratch right now; I can add it under ools/ with the two compile lines if you would rather future SDK bumps be re-measured than re-audited by reading.

**@⁠KelboLive** on GitHub · 2026-11-30 06:51 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3552#issuecomment-7271091661) Audited the rest of the shim for this class, so the answer to "is this the last one" is measured rather than assumed. Compiled a probe that prints sizeof and lignof for every struct the shim sizes or forwards, once against the in-box headers and once with -I out/build/warp-agility/agility-headers/build/native/include. Of **63 structs, exactly one differs**: ``` inbox : D3D12_UNORDERED_ACCESS_VIEW_DESC 40 8 agility: D3D12_UNORDERED_ACCESS_VIEW_DESC 48 8 ``` Everything else agrees: D3D12_SHADER_RESOURCE_VIEW_DESC, D3D12_RENDER_TARGET_VIEW_DESC, D3D12_DEPTH_STENCIL_VIEW_DESC, the blend/rasterizer/depth-stencil descriptions, D3D12_GRAPHICS_PIPELINE_STATE_DESC, D3D12_COMPUTE_PIPELINE_STATE_DESC, the indirect argument and draw/dispatch argument structs, root signature and descriptor range descriptions, D3D12_RESOURCE_DESC, heap, barrier, rect, viewport, copy-location and subresource structs. Cross-check of every remaining use of a UAV description in the shim: | Site | Handling | |---|---| | iew_slot slots 18-21 | this change: record width, zero-filled copy forwarded | | compute output tokens (#3512) | record width into a zero-initialised struct | | esolve_pixel_uavs (#3525) | record width into a zero-initialised itle_view, with static_assert | | pixel_uav_view (d3d12_draw.inl:107) | dereferences only Format, ViewDimension and the first union member, all inside the first 24 bytes | | d3d12_draw.inl:3659, d3d12_compute_dispatch.inl:1331,1341 | pass a local struct, never a title pointer | So the 40/48 split has no remaining instance. The probe is untracked scratch right now; I can add it under ools/ with the two compile lines if you would rather future SDK bumps be re-measured than re-audited by reading.
Author
Owner

@⁠KelboLive on GitHub · 2026-11-30 12:38 UTC · original

Both points are fixed at 386db6092, and you were right about the consequence: the truncated copy would have regressed array views that worked before.

Measured layout, both header sets:

RTV 24  DSV 24
DSV Flags@8  Texture2DArray@12   (ArraySize at 16)
RTV Texture2DArray@8  PlaneSlice@20
  • view_bytes for slots 20 and 21 now uses sizeof(D3D12_RENDER_TARGET_VIEW_DESC) and sizeof(D3D12_DEPTH_STENCIL_VIEW_DESC).
  • record_view's width for those slots is the same 24, so recorded array RTV/DSV views keep the fields too (the SHOULD).
  • static_asserts hold both to 24 bytes, so this cannot come back silently.

Verification at this head, after rebasing onto 844e57d:

in-box:  ctest -R 'view|descriptor|depth|dsv'          171/171
agility: ctest -R 'view|descriptor|uav|srv|rtv|dsv'    247/250

The three Agility failures are startup_memory_srv_diag_{warp,hardware} and startup_compute_comparison_srv_warp; they fail identically with this change stashed, so they are not from it.

On the suggested test: I could not get an array-DSV case to work in startup_view_dimension_device, so I removed it rather than ship a fixture I do not understand. Creating the view removed the device even for a plain TEXTURE2D DSV on a desktop-created resource with a guest DSV heap, while startup_clear_depth_stencil passes doing the same thing through the same slots. That is either a mistake in my setup that I have not found or something specific to that fixture, and I would rather report it than encode it. The static_asserts are the guard in the meantime; if you can point at what I got wrong in the setup I will add the case.

**@⁠KelboLive** on GitHub · 2026-11-30 12:38 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/3552#issuecomment-7278730171) Both points are fixed at `386db6092`, and you were right about the consequence: the truncated copy would have regressed array views that worked before. Measured layout, both header sets: ``` RTV 24 DSV 24 DSV Flags@8 Texture2DArray@12 (ArraySize at 16) RTV Texture2DArray@8 PlaneSlice@20 ``` - `view_bytes` for slots 20 and 21 now uses `sizeof(D3D12_RENDER_TARGET_VIEW_DESC)` and `sizeof(D3D12_DEPTH_STENCIL_VIEW_DESC)`. - `record_view`'s width for those slots is the same 24, so recorded array RTV/DSV views keep the fields too (the SHOULD). - `static_assert`s hold both to 24 bytes, so this cannot come back silently. Verification at this head, after rebasing onto `844e57d`: ``` in-box: ctest -R 'view|descriptor|depth|dsv' 171/171 agility: ctest -R 'view|descriptor|uav|srv|rtv|dsv' 247/250 ``` The three Agility failures are `startup_memory_srv_diag_{warp,hardware}` and `startup_compute_comparison_srv_warp`; they fail identically with this change stashed, so they are not from it. On the suggested test: I could not get an array-DSV case to work in `startup_view_dimension_device`, so I removed it rather than ship a fixture I do not understand. Creating the view removed the device even for a plain `TEXTURE2D` DSV on a desktop-created resource with a guest DSV heap, while `startup_clear_depth_stencil` passes doing the same thing through the same slots. That is either a mistake in my setup that I have not found or something specific to that fixture, and I would rather report it than encode it. The `static_assert`s are the guard in the meantime; if you can point at what I got wrong in the setup I will add the case.
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/R0Y00--Xbox2Windows#3554
No description provided.