startup: bind cube views of console-layout textures in slot 70 #2938

Manually merged
github merged 8 commits from github-bot/gh-2938 into gh-pr/2938/base 2026-11-28 00:00:01 +00:00 AGit
Owner

@⁠pigalot on GitHub · 2026-11-26 22:20 UTC · original
pigalot:slot70/cube-views → main · +234 −24 · 9 files · 8 commits · merged 2026-11-27 23:54 UTC

Refs #2943

Stacked on #2929 (which is stacked on #2926). This branch contains their commits (80443a78, a8cf51a7, 146bf761); the change here is the last commit, d190f0db. Rebased on main 3e9542a6 on 27 Nov. I'll rebase it onto main once those merge.

Translator half: no translated shader reads these views yet. tools/startup/gfx2hlsl.py refuses an image instruction with dim:SQ_RSRC_IMG_CUBE (image dimension SQ_RSRC_IMG_CUBE), so it never writes the new texcube manifest kind. This PR is the runtime half. The translator half is a separate change: lower cube image_sample* to a TextureCube and write texcube. That is tracked in #2943.

What changes

Device slot 70 refused a two-dimensional array of six slices in a console layout with a TEXTURECUBE view (reason=unsupported_description), because address_view_fits had no cube view.

  • src/startup_stubs/address_texture.h: address_view_fits takes a TEXTURECUBE view of a 2D texture of exactly six slices that fits the mip range with no LOD clamp. The faces are the slices in D3D order (+X, -X, +Y, -Y, +Z, -Z); they are already addressed and uploaded like any 2D array.
  • src/startup_stubs/d3d12_memory_srv.inl: the desktop format check also asks for D3D12_FORMAT_SUPPORT1_TEXTURECUBE for a cube view.
  • src/startup_stubs/d3d12_draw.inl: a manifest srv line of kind texcube (kind 5) binds a TEXTURECUBE view. The view dimension of each kind is now in one function. A cube view where the shader declares tex2da, or the reverse, still binds null. The d16 exact path still takes only kinds 1 to 4.
  • Tests: six cube view cases in startup_gfx10_layout, three cube draws in startup_address_console_{warp,hardware}, and a new negative control startup_address_console_cube_order_{warp,hardware} (tests/cmake/startup_slot70_cube.cmake).
  • Notes: docs/experiments/startup-slot70-cube.md, docs/startup-runtime.md.

Results

Build: this branch, dev preset (debug layer on). Windows 11 Pro 10.0.26200, NVIDIA GeForce RTX 5090 (driver 32.0.16.1088) and Microsoft WARP.

Test Result
startup_gfx10_layout PASS: 39 views (new: a whole BC1 cube chain, its last mip, past the chain, an LOD clamp, a cube view of one slice and of an array of twelve)
startup_address_console_{warp,hardware} PASS: 3 new cube draws are exact on all 65,536 pixels, covering every texel of all six faces. The cases are RGBA8 64x64 in 0x105, its 4-mip chain viewed at mip 1, and BC1 64x64 in 0x105. The hand-written shader point-samples each texel centre along the face's direction
startup_address_console_cube_order_{warp,hardware} PASS (control): a cube with face f written into slice 5 - f is published and all 65,536 pixels differ

Without the source change (on its parent commit), the first cube draw reads the null view: pixel (0,0) is 00000000, but 010300ff was expected.

Regression on the rebased stack (d190f0db): 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. Before the rebase (602a8618): 224 of 224 and 128 of 128.

After cpp-migration merged into main (#3039), the same stack rebased locally onto main 98007de5 (b38df255) gives the same results: 228 of 228 and 130 of 130, 9 capability skips each. The branch on GitHub still merges cleanly, so it is not force-pushed again.

Commands (PowerShell, at the repository root, after . .\tools\dev.ps1):

cmake --preset dev
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|cube_order_(warp|hardware))$' -V

Still not done: cube arrays (TEXTURECUBEARRAY) and a cube view of a larger array stay refused.

This change was AI-assisted.

**@⁠pigalot** on GitHub · 2026-11-26 22:20 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2938) `pigalot:slot70/cube-views` → `main` · +234 −24 · 9 files · 8 commits · merged 2026-11-27 23:54 UTC Refs #2943 **Stacked on #2929 (which is stacked on #2926).** This branch contains their commits (80443a78, a8cf51a7, 146bf761); the change here is the last commit, d190f0db. Rebased on main 3e9542a6 on 27 Nov. I'll rebase it onto `main` once those merge. **Translator half:** no translated shader reads these views yet. `tools/startup/gfx2hlsl.py` refuses an image instruction with `dim:SQ_RSRC_IMG_CUBE` (`image dimension SQ_RSRC_IMG_CUBE`), so it never writes the new `texcube` manifest kind. This PR is the runtime half. The translator half is a separate change: lower cube `image_sample*` to a `TextureCube` and write `texcube`. That is tracked in #2943. ## What changes Device slot 70 refused a two-dimensional array of six slices in a console layout with a `TEXTURECUBE` view (`reason=unsupported_description`), because `address_view_fits` had no cube view. - `src/startup_stubs/address_texture.h`: `address_view_fits` takes a `TEXTURECUBE` view of a 2D texture of exactly six slices that fits the mip range with no LOD clamp. The faces are the slices in D3D order (+X, -X, +Y, -Y, +Z, -Z); they are already addressed and uploaded like any 2D array. - `src/startup_stubs/d3d12_memory_srv.inl`: the desktop format check also asks for `D3D12_FORMAT_SUPPORT1_TEXTURECUBE` for a cube view. - `src/startup_stubs/d3d12_draw.inl`: a manifest `srv` line of kind `texcube` (kind 5) binds a `TEXTURECUBE` view. The view dimension of each kind is now in one function. A cube view where the shader declares `tex2da`, or the reverse, still binds null. The d16 exact path still takes only kinds 1 to 4. - Tests: six cube view cases in `startup_gfx10_layout`, three cube draws in `startup_address_console_{warp,hardware}`, and a new negative control `startup_address_console_cube_order_{warp,hardware}` (`tests/cmake/startup_slot70_cube.cmake`). - Notes: `docs/experiments/startup-slot70-cube.md`, `docs/startup-runtime.md`. ## Results Build: this branch, dev preset (debug layer on). Windows 11 Pro 10.0.26200, NVIDIA GeForce RTX 5090 (driver 32.0.16.1088) and Microsoft WARP. | Test | Result | | --- | --- | | `startup_gfx10_layout` | PASS: 39 views (new: a whole BC1 cube chain, its last mip, past the chain, an LOD clamp, a cube view of one slice and of an array of twelve) | | `startup_address_console_{warp,hardware}` | PASS: 3 new cube draws are exact on all 65,536 pixels, covering every texel of all six faces. The cases are RGBA8 64x64 in `0x105`, its 4-mip chain viewed at mip 1, and BC1 64x64 in `0x105`. The hand-written shader point-samples each texel centre along the face's direction | | `startup_address_console_cube_order_{warp,hardware}` | PASS (control): a cube with face f written into slice 5 - f is published and all 65,536 pixels differ | Without the source change (on its parent commit), the first cube draw reads the null view: pixel (0,0) is `00000000`, but `010300ff` was expected. Regression on the rebased stack (d190f0db): `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. Before the rebase (602a8618): 224 of 224 and 128 of 128. After cpp-migration merged into main (#3039), the same stack rebased locally onto main 98007de5 (b38df255) gives the same results: 228 of 228 and 130 of 130, 9 capability skips each. The branch on GitHub still merges cleanly, so it is not force-pushed again. Commands (PowerShell, at the repository root, after `. .\tools\dev.ps1`): ```powershell cmake --preset dev 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|cube_order_(warp|hardware))$' -V ``` Still not done: cube arrays (`TEXTURECUBEARRAY`) and a cube view of a larger array stay refused. This change was AI-assisted.
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.
A TEXTURECUBE view of a 2D array of exactly six slices in a console layout is
now taken by address_view_fits (the slices are the faces in D3D order), and a
translation manifest srv of kind texcube binds it. The translator does not
emit texcube yet (gfx2hlsl refuses dim:SQ_RSRC_IMG_CUBE); the draws here use
a hand-written shader. Adds six layout cube cases, three exact cube draws and
a reversed-face-order negative control.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:29:42 +00:00
Author
Owner

@⁠KelboLive on GitHub · 2026-11-27 05:22 UTC · original · reviewed

PR #2938 by @⁠pigalot — startup: bind cube views of console-layout textures in slot 70

What works

  • TEXTURECUBE view correctly maps a 2D array of 6 slices in D3D order (+X, -X, +Y, -Y, +Z, -Z)
  • address_view_fits accepts exactly 6 slices (sensible: cubes always have 6 faces)
  • Desktop format check adds D3D12_FORMAT_SUPPORT1_TEXTURECUBE for cube views — correct validation
  • Kind 5 (texcube) in the manifest routing, keeping view dimensions centralized
  • Mismatch between manifest kind and shader texture type still binds null (texcube manifest + tex2da shader = null)
  • Negative control cube_order test: reversed face order causes pixel mismatch, confirming correct face mapping
  • Tests cover RGBA8 64x64 cube, 4-mip chain viewed at mip 1, and BC1 64x64 cube — good format variety
  • Hand-written shaders point-sample each texel center, giving deterministic pixel results across 65,536 pixels
  • docs/experiments/startup-slot70-cube.md explains the layout thoroughly with reproduction commands
  • D3D12_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION cap preserved for array depth

Issues

  • This PR is draft and stacked on #2929 and #2926: the review applies once those merge, but structural concerns can be addressed now. The stacked nature means reviewers need to check all three PRs together, which increases review complexity.
  • address_view_fits checks DepthOrArraySize == 6 for cubes, but there is no explicit guard that the texture has 2 dimensions (r.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D). The gfx10 layout code likely handles this, but adding an explicit check at the cube entry point would be clearer.
  • The D3D12_FORMAT_SUPPORT1_TEXTURECUBE check in d3d12_memory_srv.inl runs before the format itself is validated — a format without cube support would be rejected by the desktop check, but the error path (unsupported_description) does not distinguish whether it failed format support or cube slice count.
  • The manifest kind enum value for texcube appears as "kind 5" — if the enum was not explicitly assigned this value in the header, rely on implicit ordering. Consider adding an explicit = 5 comment in the enum definition.
  • With 6 face slices uploaded as rows in a 2D array, mip tail regions (for BC formats) are stored per-slice. The addrlib equations should handle this correctly since the slices follow the 2D array layout, but the BC64 support for cube mip tails should be verified.

Recommendations

  • Rebase the stack onto main once #2926 and #2929 land to reduce review complexity.
  • Add an explicit D3D12_RESOURCE_DIMENSION_TEXTURE2D check before attempting cube view creation in address_view_fits.
  • Consider documenting the D3D face order (+X, -X, ...) in address_texture.h to prevent future slice-ordering bugs.
  • The negative control test is excellent — consider extending it to also check that mip 0 face order is preserved.

Overall

Clean extension of the slot-70 console path with well-crafted tests. The face ordering control test is particularly good. This is ready as a stack review — defer merge-approval until the stacked PRs (#2926, #2929) also pass review.

**@⁠KelboLive** on GitHub · 2026-11-27 05:22 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2938#pullrequestreview-6083824725) · **reviewed** PR #2938 by @⁠pigalot — startup: bind cube views of console-layout textures in slot 70 ## What works - TEXTURECUBE view correctly maps a 2D array of 6 slices in D3D order (+X, -X, +Y, -Y, +Z, -Z) - address_view_fits accepts exactly 6 slices (sensible: cubes always have 6 faces) - Desktop format check adds D3D12_FORMAT_SUPPORT1_TEXTURECUBE for cube views — correct validation - Kind 5 (texcube) in the manifest routing, keeping view dimensions centralized - Mismatch between manifest kind and shader texture type still binds null (texcube manifest + tex2da shader = null) - Negative control cube_order test: reversed face order causes pixel mismatch, confirming correct face mapping - Tests cover RGBA8 64x64 cube, 4-mip chain viewed at mip 1, and BC1 64x64 cube — good format variety - Hand-written shaders point-sample each texel center, giving deterministic pixel results across 65,536 pixels - docs/experiments/startup-slot70-cube.md explains the layout thoroughly with reproduction commands - D3D12_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION cap preserved for array depth ## Issues - This PR is draft and stacked on #2929 and #2926: the review applies once those merge, but structural concerns can be addressed now. The stacked nature means reviewers need to check all three PRs together, which increases review complexity. - address_view_fits checks DepthOrArraySize == 6 for cubes, but there is no explicit guard that the texture has 2 dimensions (r.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE2D). The gfx10 layout code likely handles this, but adding an explicit check at the cube entry point would be clearer. - The D3D12_FORMAT_SUPPORT1_TEXTURECUBE check in d3d12_memory_srv.inl runs before the format itself is validated — a format without cube support would be rejected by the desktop check, but the error path (unsupported_description) does not distinguish whether it failed format support or cube slice count. - The manifest kind enum value for texcube appears as "kind 5" — if the enum was not explicitly assigned this value in the header, rely on implicit ordering. Consider adding an explicit = 5 comment in the enum definition. - With 6 face slices uploaded as rows in a 2D array, mip tail regions (for BC formats) are stored per-slice. The addrlib equations should handle this correctly since the slices follow the 2D array layout, but the BC64 support for cube mip tails should be verified. ## Recommendations - Rebase the stack onto main once #2926 and #2929 land to reduce review complexity. - Add an explicit D3D12_RESOURCE_DIMENSION_TEXTURE2D check before attempting cube view creation in address_view_fits. - Consider documenting the D3D face order (+X, -X, ...) in address_texture.h to prevent future slice-ordering bugs. - The negative control test is excellent — consider extending it to also check that mip 0 face order is preserved. ## Overall Clean extension of the slot-70 console path with well-crafted tests. The face ordering control test is particularly good. This is ready as a stack review — defer merge-approval until the stacked PRs (#2926, #2929) also pass review.
github-bot force-pushed github-bot/gh-2938 from 602a8618a4 to d190f0db48 2026-11-27 10:42:02 +00:00 Compare
Author
Owner

@⁠tedin7 on GitHub · 2026-11-27 21:53 UTC · original

This PR is stacked on #2929 (which is stacked on #2926) and no longer merges cleanly with main, through the inherited #2926 commit.

Order: #2926, then #2929, then this one. Please merge main into the branch after #2929 lands.

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

**@⁠tedin7** on GitHub · 2026-11-27 21:53 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2938#issuecomment-7228845508) This PR is stacked on #2929 (which is stacked on #2926) and no longer merges cleanly with main, through the inherited #2926 commit. Order: #2926, then #2929, then this one. Please merge main into the branch after #2929 lands. AI-assisted; commands listed were executed locally. (Trial merge against origin/main.)
Keeps the volume (0x105) support from main next to the linear (0x100) mode:
supports() checks volumes first, then 2D linear and tiled modes; the console
check keeps both the volume cases and the linear cases.
Keeps the 1D linear texture parsing (",1d") and the volume depth field in the
console view test, both in one description string; supports() checks volumes
first, then 1D linear and 2D textures.
Keeps the cube view cases next to the volume cases: the console view test
reads one description string with a ",1d", ",cube" or ",depth" suffix, and the
console check draws the cubes and the volumes.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-27 23:17 UTC · original

Merged main into this branch to clear the conflicts (merge commit 16f8d91a9, no rebase); took the updated #2929 branch too; the console view test reads ,1d, ,cube or ,depth, and the check runs the cubes and the volumes. Testing on Windows now.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-27 23:17 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2938#issuecomment-7230030441) Merged main into this branch to clear the conflicts (merge commit 16f8d91a9, no rebase); took the updated #2929 branch too; the console view test reads ,1d, ,cube or ,depth, and the check runs the cubes and the volumes. Testing on Windows now. AI-assisted; commands listed were executed locally.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-27 23:42 UTC · original · reviewed

No bug found.

Reviewed the diff against the D3D12 and console layout rules. Cube views read a 2D array of six as faces +X, -X, +Y, -Y, +Z, -Z (D3D12 order) and check FORMAT_SUPPORT1_TEXTURECUBE on the desktop device.

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

  • x2w_pipe.py win2025 2938 --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 and release both pass (127 of 127 in the final run).
  • PR CI at this head: all required checks green. No open change request. No conflict with main.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-27 23:42 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2938#pullrequestreview-6094365861) · **reviewed** No bug found. Reviewed the diff against the D3D12 and console layout rules. Cube views read a 2D array of six as faces +X, -X, +Y, -Y, +Z, -Z (D3D12 order) and check FORMAT_SUPPORT1_TEXTURECUBE on the desktop device. Verification (Windows Server 2025, MSVC 14.44, D3D12 WARP, aws-1, exact head 16f8d91a9, dev and release run in parallel): - `x2w_pipe.py win2025 2938 --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 and release both pass (127 of 127 in the final run). - PR CI at this head: all required checks green. No open change request. No conflict with main. AI-assisted; commands listed were executed locally.
Main now carries the linear and 1D linear changes as squashed commits; their
files replace the old copies here and only the cube view change remains.
github-bot changed target branch from main to gh-pr/2938/base 2026-11-27 23:59:59 +00:00
github manually merged commit a44deaa851 into gh-pr/2938/base 2026-11-28 00:00:01 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-27 23:54 UTC · original · reviewed

Merged main into this branch after #2926 and #2929 landed (merge commit a44deaa85, no rebase); their squashed files replace the old copies here and only the cube view change remains.

Reviewed the diff against the D3D12 and console layout rules. No bug found. A cube view reads a 2D array of six as faces +X, -X, +Y, -Y, +Z, -Z (D3D12 order), checks FORMAT_SUPPORT1_TEXTURECUBE on the desktop device, and the console check draws the cubes (including an order control).

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

  • x2w_pipe.py win2025 2938 --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 127 of 127 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** on GitHub · 2026-11-27 23:54 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2938#pullrequestreview-6094447120) · **reviewed** Merged main into this branch after #2926 and #2929 landed (merge commit a44deaa85, no rebase); their squashed files replace the old copies here and only the cube view change remains. Reviewed the diff against the D3D12 and console layout rules. No bug found. A cube view reads a 2D array of six as faces +X, -X, +Y, -Y, +Z, -Z (D3D12 order), checks FORMAT_SUPPORT1_TEXTURECUBE on the desktop device, and the console check draws the cubes (including an order control). Verification (Windows Server 2025, MSVC 14.44, D3D12 WARP, aws-1, exact head a44deaa85, dev and release in parallel): - `x2w_pipe.py win2025 2938 --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 127 of 127 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.
This discussion has been locked. Commenting is limited to contributors.
No description provided.