Support one-dimensional textures in translated startup draws #1623

Merged
R0Y00 merged 2 commits from upstream-pr/1630 into main 2026-11-24 15:56:21 +00:00
R0Y00 commented 2026-11-24 15:27:30 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T15:27:30Z.


Refs #874

Support ordinary, single-coordinate 1D image samples in the startup shader translator. The Windows draw path binds explicit and default 1D SRVs and uploads source-built, single-slice CPU textures using desktop copy footprints.

The translator fixture samples two distinct alpha values and changes the channel selector to red as a negative control. The runtime fixture checks rebinding and a mismatched 2D view across 32 output pixels. Existing 3D, array and address-SRV controls run alongside them.

Tested on Windows x64 Release with NVIDIA GeForce RTX 4060 Laptop GPU (32.0.16.1656) and Microsoft WARP. Seven tests passed, zero failures, zero capability skips at 9c40e65f. Inputs and expected outputs are synthetic.

cmake --build out/build/release --target startup_stream_consumer offscreen_check
ctest --test-dir out/build/release --no-tests=error --output-on-failure -R '^startup_((1d_srv|address_srv)_(warp|hardware)|image_3d_(controls|warp|hardware))$'
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6585301403 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1630). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T15:27:30Z. --- Refs #874 Support ordinary, single-coordinate 1D image samples in the startup shader translator. The Windows draw path binds explicit and default 1D SRVs and uploads source-built, single-slice CPU textures using desktop copy footprints. The translator fixture samples two distinct alpha values and changes the channel selector to red as a negative control. The runtime fixture checks rebinding and a mismatched 2D view across 32 output pixels. Existing 3D, array and address-SRV controls run alongside them. Tested on Windows x64 Release with NVIDIA GeForce RTX 4060 Laptop GPU (32.0.16.1656) and Microsoft WARP. Seven tests passed, zero failures, zero capability skips at 9c40e65f. Inputs and expected outputs are synthetic. ```powershell cmake --build out/build/release --target startup_stream_consumer offscreen_check ctest --test-dir out/build/release --no-tests=error --output-on-failure -R '^startup_((1d_srv|address_srv)_(warp|hardware)|image_3d_(controls|warp|hardware))$' ```
tedin7 commented 2026-11-24 15:46:46 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T15:46:46Z.

Review: COMMENTED


Reviewed at 9c40e65fe4d355a76c51e970f8cc1ee7daff3e2b.

Summary

  • Translator (tools/startup/gfx2hlsl.py): Adds SQ_RSRC_IMG_1D (tex1d -> Texture1D<float4>), conservatively gated to sample with a single coordinate, non-zero dmask, and no modifiers other than dim: / dmask:.
  • Runtime (src/startup_stubs/d3d12_draw.inl): Maps tex1d to D3D12_SRV_DIMENSION_TEXTURE1D, enables upload_texture for single-slice TEXTURE1D (DepthOrArraySize == 1 && Height == 1), and binds null when a tex1d slot sees a non-1D resource or DepthOrArraySize != 1 (or mismatched view dimension).
  • Tests: tests/startup_image_3d_check.py covers 1D alpha sampling and a channel-swizzle mutant; tests/startup_1d_srv_check.py + tests/startup_address_srv.cpp cover explicit 1D views, default (nullptr) views, and a mismatched 2D resource/view.

No blocking issues found.

Verification

  • Linux:
    • python3 -B tests/startup_image_3d_check.py: passed
    • python3 -B tests/docs_links_check.py: passed (16 Markdown files, 348 links)
    • python3 -B tests/bidi_controls_check.py: passed (1266 files)
  • Windows Server 2025 (MSVC 14.44.35207, D3D12 WARP):
    • Debug (--preset dev): ctest --preset dev -R '^(startup_1d_srv_warp|startup_image_3d_warp|startup_image_3d_controls|startup_address_srv_warp|startup_stream_draw_warp|startup_translator)$' --parallel 4 --no-tests=error — 6/6 passed (startup_1d_srv_warp 1.16s, startup_image_3d_warp 1.65s)
    • Release /O2 (--preset release): same regex — 6/6 passed (startup_1d_srv_warp 1.09s, startup_image_3d_warp 1.50s)

AI-assisted; commands listed were executed locally.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6042553560 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1630#pullrequestreview-6042553560). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T15:46:46Z. **Review:** COMMENTED --- Reviewed at `9c40e65fe4d355a76c51e970f8cc1ee7daff3e2b`. ### Summary - **Translator (`tools/startup/gfx2hlsl.py`)**: Adds `SQ_RSRC_IMG_1D` (`tex1d` -> `Texture1D<float4>`), conservatively gated to `sample` with a single coordinate, non-zero `dmask`, and no modifiers other than `dim:` / `dmask:`. - **Runtime (`src/startup_stubs/d3d12_draw.inl`)**: Maps `tex1d` to `D3D12_SRV_DIMENSION_TEXTURE1D`, enables `upload_texture` for single-slice `TEXTURE1D` (`DepthOrArraySize == 1 && Height == 1`), and binds null when a `tex1d` slot sees a non-1D resource or `DepthOrArraySize != 1` (or mismatched view dimension). - **Tests**: `tests/startup_image_3d_check.py` covers 1D alpha sampling and a channel-swizzle mutant; `tests/startup_1d_srv_check.py` + `tests/startup_address_srv.cpp` cover explicit 1D views, default (`nullptr`) views, and a mismatched 2D resource/view. No blocking issues found. ### Verification - **Linux**: - `python3 -B tests/startup_image_3d_check.py`: passed - `python3 -B tests/docs_links_check.py`: passed (16 Markdown files, 348 links) - `python3 -B tests/bidi_controls_check.py`: passed (1266 files) - **Windows Server 2025 (MSVC 14.44.35207, D3D12 WARP)**: - Debug (`--preset dev`): `ctest --preset dev -R '^(startup_1d_srv_warp|startup_image_3d_warp|startup_image_3d_controls|startup_address_srv_warp|startup_stream_draw_warp|startup_translator)$' --parallel 4 --no-tests=error` — **6/6 passed** (`startup_1d_srv_warp` 1.16s, `startup_image_3d_warp` 1.65s) - Release `/O2` (`--preset release`): same regex — **6/6 passed** (`startup_1d_srv_warp` 1.09s, `startup_image_3d_warp` 1.50s) AI-assisted; commands listed were executed locally.
upstream-sync closed this pull request 2026-11-24 16:03:23 +00:00
R0Y00 commented 2026-11-24 16:03:35 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T15:46:05Z.


2469f688 updates only the diagnostic asserted by the explicit-LOD 1D refusal case. Ordinary single-coordinate sampling stays covered separately, and the unsupported explicit-LOD form still has to fail. I reproduced the Linux assertion and verified the explicit LOD, 1D/3D and array Python controls on the corrected sources.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7136578313 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1630#issuecomment-7136578313). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T15:46:05Z. --- 2469f688 updates only the diagnostic asserted by the explicit-LOD 1D refusal case. Ordinary single-coordinate sampling stays covered separately, and the unsupported explicit-LOD form still has to fail. I reproduced the Linux assertion and verified the explicit LOD, 1D/3D and array Python controls on the corrected sources.
Lifither commented 2026-11-24 20:01:19 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Lifither on 2026-11-24T19:38:14Z.


Independent Polaris retest on bbadc76deae60a3e7fa3e81b883ee27ca31af183. Windows 11 x64 build 26300.9974, Release, clang-cl 23.1.6 with /EHa, Windows SDK 10.0.26100. Radeon RX 590 Series (1002:67df), driver 31.0.21923.1000. WARP: Microsoft Basic Render Driver, version 10.0.26100.9818. DXC 1.9.2609.5 and Microsoft FXC from SDK package 10.0.26100.3916. The offscreen image test reported the D3D12 debug layer as unavailable. The stream-consumer cases did not report debug-layer status.

cmake --build <build> --target startup_stream_consumer offscreen_check
$env:XBOX2WINDOWS_ADAPTER = 'RX 590'
ctest --test-dir <build> --no-tests=error -R '^startup_((1d_srv|address_srv)_(warp|hardware)|image_3d_(controls|warp|hardware))$' -V

All seven cases passed across the two runs, with zero skips. The 3D controls and both backend cases passed in the initial run. The four stream-consumer cases initially stopped before drawing because FXC was missing. They all passed after setting STARTUP_FXC at configure time and rerunning those four cases.

Both adapters matched all 32 pixels in the explicit/default 1D views and mismatched 2D view fixture. The address-SRV fixture also matched all 32 RGBA pixels on both adapters across its valid and invalid update cases.

Source-built fixtures only. Codex assisted with build, testing and reporting.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7142378862 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1630#issuecomment-7142378862). Originally posted by [Lifither](https://github.com/Lifither) on 2026-11-24T19:38:14Z. --- Independent Polaris retest on `bbadc76deae60a3e7fa3e81b883ee27ca31af183`. Windows 11 x64 build 26300.9974, Release, clang-cl 23.1.6 with `/EHa`, Windows SDK 10.0.26100. Radeon RX 590 Series (1002:67df), driver 31.0.21923.1000. WARP: Microsoft Basic Render Driver, version 10.0.26100.9818. DXC 1.9.2609.5 and Microsoft FXC from SDK package 10.0.26100.3916. The offscreen image test reported the D3D12 debug layer as unavailable. The stream-consumer cases did not report debug-layer status. ```powershell cmake --build <build> --target startup_stream_consumer offscreen_check $env:XBOX2WINDOWS_ADAPTER = 'RX 590' ctest --test-dir <build> --no-tests=error -R '^startup_((1d_srv|address_srv)_(warp|hardware)|image_3d_(controls|warp|hardware))$' -V ``` All seven cases passed across the two runs, with zero skips. The 3D controls and both backend cases passed in the initial run. The four stream-consumer cases initially stopped before drawing because FXC was missing. They all passed after setting `STARTUP_FXC` at configure time and rerunning those four cases. Both adapters matched all 32 pixels in the explicit/default 1D views and mismatched 2D view fixture. The address-SRV fixture also matched all 32 RGBA pixels on both adapters across its valid and invalid update cases. Source-built fixtures only. Codex assisted with build, testing and reporting.
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!1623
No description provided.