shader: integrate explicit startup mip loads from #1284 #1379

Merged
R0Y00 merged 18 commits from upstream-pr/1386 into main 2026-11-24 10:16:57 +00:00
R0Y00 commented 2026-11-24 10:13:03 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T10:13:03Z.


Integrates Evan-Lowry's #1284 with current main. The original commits are retained. The fork has maintainer edits disabled. Refs #1284.

The merge retains the mip, flat-parameter, inline-sampler, host-CPU and ordinary translator CI commands and the two startup-runtime documentation sections. On Windows at d926b1f9 these five checks passed individually with the project Python environment:

python -B tests/startup_image_load_mip_check.py
python -B tests/startup_translator_check.py
python -B tests/startup_image_3d_check.py
python -B tests/startup_flat_param_check.py
python -B tests/startup_inline_sampler_check.py

The mip check exercised 2D packed coordinates, 3D nonconsecutive coordinates, and implicit mip zero. The original PR contains the hardware/WARP two-mip readback evidence.

The combined candidate at 3696ec96 also includes #1381. Its source retains the verified array-sampling and ordinary array-load cases and rejects the unverified combination of an explicit mip load on a 2D array. Both feature fixtures, the 3D, explicit LOD, flat, inline sampler, and existing startup translator checks passed (7 scripts). The original #1381 can land independently.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6579476179 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1386). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T10:13:03Z. --- Integrates Evan-Lowry's #1284 with current main. The original commits are retained. The fork has maintainer edits disabled. Refs #1284. The merge retains the mip, flat-parameter, inline-sampler, host-CPU and ordinary translator CI commands and the two startup-runtime documentation sections. On Windows at d926b1f9 these five checks passed individually with the project Python environment: ```powershell python -B tests/startup_image_load_mip_check.py python -B tests/startup_translator_check.py python -B tests/startup_image_3d_check.py python -B tests/startup_flat_param_check.py python -B tests/startup_inline_sampler_check.py ``` The mip check exercised 2D packed coordinates, 3D nonconsecutive coordinates, and implicit mip zero. The original PR contains the hardware/WARP two-mip readback evidence. The combined candidate at 3696ec96 also includes #1381. Its source retains the verified array-sampling and ordinary array-load cases and rejects the unverified combination of an explicit mip load on a 2D array. Both feature fixtures, the 3D, explicit LOD, flat, inline sampler, and existing startup translator checks passed (7 scripts). The original #1381 can land independently.
tedin7 commented 2026-11-24 10:17:10 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T10:17:10Z.

Review: COMMENTED


Technical review at 3696ec9661216acebde8fb91af983640e32ec674:

Checks run

  • Linux: docs_links_check.py, bidi_controls_check.py, startup_translator_check.py, startup_image_load_mip_check.py --llvm-mc llvm-mc-19, startup_image_2d_array_check.py binary llvm-mc-19, startup_image_3d_check.py binary llvm-mc-19, and startup_image_sample_l_check.py binary llvm-mc-19 all passed.
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP):
    • Debug (--preset dev, target offscreen_check): ctest -R '^startup_image_(3d|load_mip|2d_array)_(controls|warp)$' 6/6 passed (2.19s).
    • Release /O2 (--preset release, target offscreen_check): ctest -R '^startup_image_(3d|load_mip|2d_array)_(controls|warp)$' 6/6 passed (2.03s).

Code audit

  • tools/startup/gfx2hlsl.py: image_load_mip decodes and rejects tfe / a16 / d16 / 2D arrays / wrong address counts / empty dmask, and lowers 2D packed and 3D NSA addresses to Texture.Load(int3/int4(..., mip)). SQ_RSRC_IMG_2D_ARRAY lowers to Texture2DArray<float4> (tex2da) for image_sample* and image_load.
  • tests/startup_image_load_mip_check.py and tests/startup_image_2d_array_check.py: negative controls (wrong-mip mismatch at pixel (0, 0), unsupported modifiers/dimensions) and llvm-mc reassembly checks are solid.
  • Minor observation (non-blocking): in tests/startup_image_3d.cpp, the array upload loop indexes footprints[tz].Offset while using footprint.Footprint.RowPitch (footprints[0]); for equal-sized 2D array slices at mip 0 the row pitch is identical, though footprints[tz].Footprint.RowPitch would be slightly more direct.

Looks good to merge.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6037389272 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1386#pullrequestreview-6037389272). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T10:17:10Z. **Review:** COMMENTED --- Technical review at `3696ec9661216acebde8fb91af983640e32ec674`: **Checks run** - **Linux**: `docs_links_check.py`, `bidi_controls_check.py`, `startup_translator_check.py`, `startup_image_load_mip_check.py --llvm-mc llvm-mc-19`, `startup_image_2d_array_check.py binary llvm-mc-19`, `startup_image_3d_check.py binary llvm-mc-19`, and `startup_image_sample_l_check.py binary llvm-mc-19` all passed. - **Windows Server 2025 (Build 26100, MSVC 14.44.35207 + D3D12 WARP)**: - Debug (`--preset dev`, target `offscreen_check`): `ctest -R '^startup_image_(3d|load_mip|2d_array)_(controls|warp)$'` **6/6 passed** (`2.19s`). - Release `/O2` (`--preset release`, target `offscreen_check`): `ctest -R '^startup_image_(3d|load_mip|2d_array)_(controls|warp)$'` **6/6 passed** (`2.03s`). **Code audit** - `tools/startup/gfx2hlsl.py`: `image_load_mip` decodes and rejects `tfe` / `a16` / `d16` / 2D arrays / wrong address counts / empty `dmask`, and lowers 2D packed and 3D NSA addresses to `Texture.Load(int3/int4(..., mip))`. `SQ_RSRC_IMG_2D_ARRAY` lowers to `Texture2DArray<float4>` (`tex2da`) for `image_sample*` and `image_load`. - `tests/startup_image_load_mip_check.py` and `tests/startup_image_2d_array_check.py`: negative controls (wrong-mip mismatch at pixel `(0, 0)`, unsupported modifiers/dimensions) and `llvm-mc` reassembly checks are solid. - Minor observation (non-blocking): in `tests/startup_image_3d.cpp`, the `array` upload loop indexes `footprints[tz].Offset` while using `footprint.Footprint.RowPitch` (`footprints[0]`); for equal-sized 2D array slices at mip 0 the row pitch is identical, though `footprints[tz].Footprint.RowPitch` would be slightly more direct. Looks good to merge.
upstream-sync closed this pull request 2026-11-24 11:02:44 +00:00
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
R0Y00/Xbox2Windows!1379
No description provided.