Skip to content

startup: read one-dimensional linear (0x100) textures in slot 70 - #2929

Open
pigalot wants to merge 3 commits into
R0Y00:mainfrom
pigalot:slot70/linear-1d
Open

pigalot wants to merge 3 commits into
R0Y00:mainfrom
pigalot:slot70/linear-1d

Conversation

@pigalot

@pigalot pigalot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #2926. This branch contains its commit (80443a7); the change here is the next two commits, a8cf51a and 146bf76. Rebased on main 3e9542a on 27 Nov. Please review #2926 first. I will rebase this onto main once that one merges.

Summary

#2926 reads two-dimensional textures in the console linear layout (0x100) through
device slot 70. A one-dimensional 0x100 description is still refused with
reason=unsupported_description: gfx10::supports takes only 2D textures and address_view_fits has no
1D view.

AMD addrlib's Gfx10Lib::HwlComputeSurfaceInfoLinear lays out a 1D surface with the same linear rule,
one row per mip (each mip padded to 256 bytes, the smallest first), and refuses a 1D surface taller than
one row. This change takes such textures through the existing console-layout path. The draw already
uploads a 1D texture that is not an array.

  • src/startup_stubs/gfx10_layout.h: supports takes a 1D texture in the linear mode with a height of
    one and an element of one texel. Block-compressed formats and the tiled modes stay refused for 1D.
  • src/startup_stubs/address_texture.h: a 1D array is refused. address_view_fits takes a TEXTURE1D
    view of a 1D texture that fits the mip range with no LOD clamp.
  • src/startup_stubs/d3d12_memory_srv.inl: the desktop format check asks for the TEXTURE1D support
    bit for a 1D texture.
  • tests/startup_gfx10_layout_check.cpp:
    • 2 new 1D round trips, 4 new refusals (one is a 1D array: since 146bf76 gfx10::supports refuses it as address_view_fits already did), 3 new address descriptions and 6 new view checks.
    • The --addrlib run gains three 1D textures (ADDR_RSRC_TEX_1D).
  • tests/startup_address_srv.cpp: X2W_TEST_CONSOLE_DESC takes an optional trailing 1d, which
    creates a 1D description with a 1D view.
  • tests/startup_address_console_check.py:
    • 3 new draws through a Texture1D view: RGBA8 300 with one mip, and a 4-mip chain viewed at mips 0 and 2.
    • The linear-unpadded control also checks the 1D chain with its mips packed without padding.
  • docs/startup-runtime.md: the description rule names 1D linear textures.
  • docs/experiments/startup-gfx10-linear-1d.md: the note (linked from the 2D note).

Tests

Windows 11 Pro 10.0.26200, NVIDIA GeForce RTX 5090 (driver 32.0.16.1088), Microsoft WARP. Debug layer
on (dev preset). addrlib: Mesa 25.1.0 via tools/fetch_addrlib.py.

cmake --preset dev -DXBOX2WINDOWS_ADDRLIB_DIR=<mesa>/src/amd/addrlib
cmake --build --preset dev
ctest --preset dev --no-tests=error -R '^startup_gfx10_layout'
ctest --preset dev --no-tests=error -R '^startup_address_console_(warp|hardware|linear_unpadded_(warp|hardware))$' -V
  • startup_gfx10_layout: PASS (15 round trips, 1 linear chain, 15 refusals, 22 address descriptions, 33 views). Negative control for 146bf76: without its guard, FAIL accepted: 1D array.
  • Regression on the rebased stack (d190f0d): ctest --preset dev --no-tests=error -R 'address|gfx10|memory_srv|xg_|bc64|tile64|small_texture|bc7|slot70|texture|console|1d|draw|translated|sampler|d16' -E '_hardware$|startup_audio' -j 8: 228 of 228 passed, 9 capability skips (spirv_*_warp, bc7_mode6_multiblock_warp). The same filter on _hardware tests at -j 1: 130 of 130 passed, 9 capability skips. The --addrlib comparison was not rerun after the rebase (that build had no addrlib); the layout code it checks did not change in the rebase.
  • startup_gfx10_layout_linear_order_control: expected failure (unchanged).
  • startup_gfx10_layout_linear_addrlib: PASS, 349547 linear sizes and addresses compared, 0 mismatches.
  • startup_address_console_warp, _hardware: PASS. The 3 new 1D draws match all 65,536 pixels
    exactly; the earlier draws and the held/late cases are unchanged.
  • startup_address_console_linear_unpadded_warp, _hardware: PASS. The unpadded 1D chain (mip 2 at
    152 instead of 256) is published and 65,536 of 65,536 pixels differ. The 2D case is unchanged
    (63,488 differ).
  • On startup: read linear (0x100) textures in slot 70 #2926 without the three source changes, the first 1D draw reads the null view: pixel (0,0) is
    00000000, and 010300ff was expected.
  • Wider set: ctest --preset dev -R 'address|gfx10|memory_srv|xg_|bc64|tile64|small_texture|bc7|slot70|texture|console|1d'.
    • Software (-j 8, _hardware and startup_audio excluded): 124 tests, 0 failed, 7 skipped
      (spirv_address_window*_warp and bc7_mode6_multiblock_warp, all capability skips, 77).
    • Hardware (-j 1): 49 tests, 0 failed, 7 skipped (the same capability skips).

A local 600 s real-world run (release build, same change on top of the slot-70 stack) ended at the
timeout with exit 0. The two 1D 0x100 shapes the previous run refused as unsupported_description
(R8G8B8A8_UNORM_SRGB and R8_UNORM, one mip each) were not refused, and no 0x100 description was
refused.

The addressing rule is addrlib's desktop GFX10 rule. That console memory uses it for 0x100 is
inferred from the layout word, not measured on console hardware.

This change was AI-assisted.

@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.

PR #2929 by @pigalot — startup: read one-dimensional linear (0x100) textures in slot 70

What works

  • 1D textures in linear mode are handled correctly: single-row height validated, block-compressed formats refused (addrlib returns INVALIDPARAMS for 1D BC formats)
  • 1D array guard DepthOrArraySize != 1 is consistent with how the draw path uploads 1D (no array variant)
  • address_view_fits properly checks dimension match: D3D12_SRV_DIMENSION_TEXTURE1D returns true only when resource is also 1D
  • desktop_address_view_supported now covers 1D, 2D, and 3D with correct format support queries
  • Experiment notes in startup-gfx10-linear-1d.md are thorough with addrlib-derived layout rules and full test matrix

Issues

  • address_view_fits checks r.DepthOrArraySize == 1 for 1D but does not verify v.Texture1D.MostDetailedMip is a valid index — the mips_fit closure handles bounds, but consider adding a guard for MostDetailedMip >= r.MipLevels for symmetry with the 2D case
  • The D3D12_RESOURCE_DIMENSION_TEXTURE1D check could use a brief comment clarifying "not an array" intent

Recommendations

  • Consider adding an explicit D3D12_SRV_DIMENSION_TEXTURE1D_ARRAY check in address_view_fits (returns false by fallthrough, but explicit is better)
  • Verify the gfx10::supports change for 1D in gfx10_layout.h explicitly rejects 1D array textures to match the main path guard

Overall

A clean extension of the linear layout path to 1D textures. The layout derivation from addrlib is well-documented and the test matrix covers accepted, refused, and control cases. Ready to merge once the minor view-dimension explicitness items are addressed.

@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.

PR #2929 by @pigalot -- startup: read one-dimensional linear (0x100) textures in slot 70

What works

  • Clean, well-documented addition that extends slot 70 0x100 linear layout support from 2D to 1D textures
  • The gfx10_layout.h supports() check is precise -- one-dimensional linear only when height and element are 1, block-compressed formats and tiled modes stay refused
  • address_view_fits() correctly rejects 1D arrays and adds mip-level/LOD clamp validation for the 1D view dimension
  • d3d12_memory_srv.inl properly routes to D3D12_FORMAT_SUPPORT1_TEXTURE1D for the format capability check
  • Documentation is thorough -- both the new experiment note and the updated startup-runtime.md are accurate and thorough
  • The stacked-on note (#2926) is clear and helpful for reviewers

Issues

  • The supports() check in gfx10_layout.h should probably assert or add an unreachable() for the new fallback path -- currently returns false for any case not explicitly handled, which is safe but a future regression hazard if a new dimension is added to the switch
  • Consider adding a small unit test in startup_gfx10_layout for a 1D BC1 texture in the linear layout to formally confirm the refusal behavior rather than depending on integration tests

Recommendations

  • The new code path is correct and the test matrix (round trips, refusals, addrlib verification, address_console draws) gives strong confidence
  • When stacking order lands, verify the tests still pass after rebasing on main

Overall

A focused, well-tested extension to the linear layout path. The code is clean and consistent with the existing 2D linear work. No blocking issues.

Slot 70 refused a 2D texture whose Layout is the ADDR_SW_LINEAR word 0x100
because the extent of its rows was not established. Restate addrlib's
Gfx10Lib::HwlComputeSurfaceInfoLinear in gfx10_layout.h: each mip's pitch is
its rounded-up width aligned to 256 bytes, and the mips are packed from the
smallest to the largest with no tail. Such textures then take the existing
console-layout path. 1D and 3D linear textures stay refused.

Tests: linear round trips, a hand-worked chain with a mip-order control, an
optional comparison of every element address with addrlib, four exact linear
draws in startup_address_console and an unpadded-pitch control.
Take a 1D, non-array texture in the console linear layout through the console-layout path: one row per mip, each padded to 256 bytes, smallest mip first (addrlib HwlComputeSurfaceInfoLinear). Add a TEXTURE1D view check, the 1D format-support bit, 1D unit and addrlib cases, three 1D draws and a 1D unpadded control.
address_view_fits already refused a 1D array, but gfx10::supports took
one. Refuse it there too, so the layout check and the view check agree,
and name the case in startup_gfx10_layout's refusals.
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.

2 participants