Skip to content

startup: read 0x105 volume mip chains in slot 70 - #2876

Merged
tedin7 merged 5 commits into
R0Y00:mainfrom
pigalot:slot70/console-3d-mips
Nov 28, 2026
Merged

tedin7 merged 5 commits into
R0Y00:mainfrom
pigalot:slot70/console-3d-mips

Conversation

@pigalot

@pigalot pigalot commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Depends on #2871, which reads single-mip 0x105 volumes; until that merges, this PR's diff includes its commit. Review the last commit only.

A Texture3D description in 0x105 with more than one mip was still refused as unsupported_description. This reads the mip chain too. The rest of the accepted shape is unchanged: one sample, an uncompressed format with a known element size, at most 2048 texels on each side, viewed as a Texture3D whose mips fit the chain.

addrlib's thick layout for a mip chain (Gfx10Lib::ComputeSurfaceInfoMacroTiled, ComputeSurfaceAddrFromCoordMacroTiled, GetMipTailDim, GetMaxNumMipsInTail):

  • the volume is stored a layer of blocks (one block deep) at a time, and each layer holds that layer of every mip;
  • inside a layer: the shared tail block first when the chain has one, then the mips from the smallest to the largest, each in blocks along x, then y;
  • mip sizes round up at every level;
  • a mip is in the tail when it is at most a block wide and half a block high and at most five mips remain;
  • tail mip k from the end starts at byte k x 256 of the tail block, which, read as 256-byte micro blocks (Block256_3d), gives its origin in x and y; z is not moved.

As before, the rules are restated as data and code of our own; no addrlib code is included.

Changes:

  • gfx10_layout.h: supports_volume takes 1 to 15 mips. Layout::thick computes the tail, the mip starts inside a layer of blocks and the tail origins; address uses them.
  • address_texture.h: the mip-count check counts the depth of a volume, as D3D12 does.

Still refused, unchanged: block-compressed volumes, volumes in every other mode, cube views, and layout 0/0x100 without a live texture.

Tests (tests/cmake/startup_gfx10_volume.cmake):

  • startup_gfx10_volume:
    • the addresses of a 32x32x32 RGBA8 volume with six mips: 11 blocks to a layer, mip 1 after the tail block, mip 0 after mip 1, and mips 2 to 5 at (0,8), (4,4), (4,0) and (0,4) in the tail block;
    • distinct bytes and tile/detile round trips for every mip of ten chains: a tail from mip 0, a chain with no tail, odd sides, and a deep volume whose depth allows the mip count;
    • which chains are taken, and which views of them are allowed.
  • New startup_gfx10_volume_tail_control (WILL_FAIL): puts every tail mip at the start of the tail block. It fails 14 checks.
  • startup_gfx10_volume_addrlib: now also compares every mip count of four chains for each element size. 305 volumes, 12,704,487 element addresses, 0 mismatches.
  • startup_address_console_{warp,hardware}: also draws four mips of two chains (RGBA8 32x32x32 with six mips, and 20x24x16 with five; mip 1 and mip 3, the second in the tail, of each). The backing holds every mip with its own texels, and all 65,536 pixels of each draw must match.
  • startup_address_volume_srv_*: refusal 5 (a 0x105 description at the address of the live desktop-layout volume) is now refused as overlapping_resource instead of unsupported_description, because the shape is now one slot 70 reads. The test still checks the exact line, and that the earlier descriptor is kept.

Negative control run once by hand, not registered: dropping the volume tail origins in gfx10_layout.h fails startup_address_console_warp on the first tail mip, which then reads another mip's texels.

Checks (Windows 11 build 26200, MSVC 14.52, debug layer off; the _hardware run's adapter on this host was Microsoft Basic Render Driver 10.0.26100.9818, so no physical-GPU result is claimed):

ctest --preset dev --no-tests=error -j 1 -R "startup_gfx10_(layout|volume)|startup_memory_srv_volume|startup_address_|startup_small_texture_4k|xg_swizzle|bc7_|texture_bc_volume"
# 54 passed; bc7_mode6_multiblock_{warp,hardware} skipped (77), unchanged
python -B tests/docs_links_check.py      # Checked 29 Markdown files and 545 links.
python -B tests/bidi_controls_check.py   # no bidirectional controls

The layout is checked against addrlib, not against console memory.

This change was AI-assisted.

A Texture3D description in the 4 KiB standard layout with one mip and an uncompressed format is now detiled from its thick blocks (GFX10_SW_4K_S3_PATINFO rows) instead of refused. The XG-size hold counts a volume as one slice, since its footprints already span every depth layer.
A Texture3D description in the 4 KiB standard layout with a mip chain is now detiled instead of refused. Each layer of thick blocks holds that layer of every mip: the shared tail block, then the mips from the smallest to the largest, with the tail mips at the origins addrlib gives them. The mip-count check counts a volume's depth.

@KelboLive KelboLive left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: startup: read 0x105 volume mip chains in slot 70

Depends on #2871 (single-mip 0x105 volumes). This extends that to multi-mip chains, following addrlib's thick-block layout for 3D textures in the 4 KiB standard mode.

What changed

  1. gfx10_layout.h — New supports_volume() validates D3D12_RESOURCE_DIMENSION_TEXTURE3D resources with swizzle mode 5, element size, single sample, axes ≤ 2048, and valid mip count. New Layout::thick() computes thick-block layout (8×16×8 element blocks for 4-byte elements, following Gfx10Lib::HwlIsThick). Added depth, block_depth, z_bits, layer_size fields, and layers(mip) method. address() extended with z parameter.

  2. address_texture.h — The max-dimension check now includes depth for volumes: std::max({Width, Height, depth_or_array_size}) >> (mips - 1).

  3. d3d12_draw.inl — upload_texture() compares plan.placed[i].Footprint.Depth against console_layout->layers(i) and passes the layer stride to detile() so depth layers follow one another rows apart.

  4. d3d12_memory_srv.inl — console_address_hold() computes slices as 1 for volumes (one slice = all depth layers), matching the layout semantics.

  5. Tests — New startup_gfx10_volume.cmake with --mutate thin, --mutate tail, and --addrlib test variants. Address console check extended to six volume mips.

Observations

  • The thick layout code faithfully follows the documented addrlib patterns: the nibble01/row patterns for each element size, the tail mip positioning at (k << 8) in the tail block read back as micro blocks, and the first-tail calculation matching the shifted macro + tail_mips = 5 thresholds. This is the correct approach.
  • The z_bits computation mirrors the x/y pattern exactly, just using the third axis from the bit pattern. Clean and consistent.
  • console_address_hold() volume fix (slices = 1) is exactly right — a 3D resource has one slice containing all depth layers, so the footprint already spans the entire depth.

Minor note

The thick() function iterates for (UINT mip = 0; mips > 1 && mip < mips; ++mip) — the condition mips > 1 && mip < mips is logically just mip < mips once you subtract (the < check dominates). This is either intentional (the mips > 1 guards against zero) or could be cleaned up to mips > 1 && mip < mips → mips > 1 outer guard + for (UINT mip = 1; mip < mips; ++mip) skipping mip 0, which the tail logic doesn't use. Looking more carefully, this skips mip 0 in the first-tail loop, which appears correct since the tail mips start from mip 1 and the first mip is never a tail mip (it's always the largest). This is a minor readability point, not a bug.

Verdict

Solid, correct implementation. The thick-block layout matches addrlib, the volume semantics (1 slice, depth as z) are consistent throughout, and the test coverage is thorough with negative controls. Approving.

Copy link
Copy Markdown
Contributor

Independent Windows Release verification at eb36ad01e6576f016df0859d36defdc515611fa0. The slot-70 volume SRV and console readback tests passed on both in-box WARP (10.0.26100.10068) and RTX 4070 (32.0.16.2124). In each console run the four mip-chain draws compared all 65,536 RGBA pixels per draw, including the tail mips of both volume shapes. Layout checks passed, and the thin and tail negative controls triggered 62 and 14 checks respectively. Totals were 7 passed and 1 skip: addrlib was unavailable locally. Windows 26300.10075, MSVC 19.52 x64 Release. Built startup_stream_consumer startup_gfx10_volume_check and ran ctest --preset release --no-tests=error -j 1 -R '^startup_(gfx10_volume($|_)|address_(console|volume_srv)_(warp|hardware)$)' -V.

@tedin7

tedin7 commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

This PR no longer merges cleanly with main. #2871 has merged (squashed), so the old #2871 commit in this branch now collides with the squashed copy (add/add).

Conflicting files: docs/experiments.md, docs/startup-runtime.md, src/startup_stubs/gfx10_layout.h, tests/cmake/startup_gfx10_volume.cmake (add/add), tests/startup_address_console_check.py, tests/startup_gfx10_volume_check.cpp (add/add).

Please merge main into the branch and keep main's version of the #2871 files, then re-apply only this PR's change. Order: this PR first, then #2881.

AI-assisted; commands listed were executed locally. (Trial merge against origin/main.)

Main carries the single-mip volume change as one squashed commit, so the old
copy of that commit in this branch is replaced by main's files; only the mip
chain change remains on top.
@tedin7

tedin7 commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Merged main into this branch to clear the conflicts (merge commit c7b10b1, no rebase); main carries the single-mip volume change as one squashed commit, so its files replace the old copy here and only the mip chain change stays on top. Testing on Windows now.

AI-assisted; commands listed were executed locally.

Main now holds the linear (0x100) change; the volume docs and the console check
keep both the linear cases and the volume mip cases.
@tedin7

tedin7 commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Merged main into this branch again after #2926 landed (merge commit 2783c10, no rebase); the volume docs and the console check keep both the linear cases and the volume mip cases. Testing on Windows now.

AI-assisted; commands listed were executed locally.

Main now holds the cube view change; the address check keeps the 1D array
refusal next to the depth-aware mip count, and the console check keeps the
cubes and the volume mips.

@tedin7 tedin7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged main into this branch once more after #2938 landed (merge commit d09ad54, no rebase): the 1D array refusal from main stays next to the depth-aware mip count, and the console check keeps the cubes and the volume mips.

Reviewed the diff against the D3D12 and console layout rules. No bug found. Volume mip chains: each layer of blocks holds that layer of every mip, tail block first, then mips smallest to largest; the tail test, tail origins and the depth-aware mip count follow the cited addrlib rules, and the tests use hand-computed layouts.

Verification (Windows Server 2025, MSVC 14.44, D3D12 WARP, aws-1, exact head d09ad54, dev and release in parallel):

  • x2w_pipe.py win2025 2876 --force --scope full --host aws-1 --regex 'startup_address|startup_resource_address|gfx10|memory_srv|slot70|volume|linear|cube|console|_1d|startup_ui_texture': dev 128 of 128 run passed, release exit 0 (capability skips only).
  • PR CI at this head green; no open change request; no conflict with main.

AI-assisted; commands listed were executed locally.

@tedin7
tedin7 merged commit b1e9225 into R0Y00:main Nov 28, 2026
5 checks passed
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.

4 participants