xshader: add --capabilities, --stride-report, and --stride-hints CLI options #547

Merged
glovepost merged 1 commit from upstream-pr/547 into main 2026-11-29 21:51:41 +00:00
glovepost commented 2026-11-29 21:21:41 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by glovepost on 2026-11-29T21:21:41Z.


Summary

Split from #522 per reviewer feedback. Adds --capabilities, --stride-report, and --stride-hints to tuxbox-xshader:

  • CLI capabilities discovery (tools/shader-compiler/src/main.rs, tests/main.rs): Adds --capabilities using standard-library JSON output (no new crate dependencies) reporting the binary's supported CLI flags.
  • Guessed-stride reporting and host hints (tools/shader-compiler/src/hlsl.rs, hlsl/emitter/resources.rs, main.rs, tests/hlsl/raw_width.rs): Adds --stride-report and --stride-hints (StrideGuess, set_stride_hints, take_stride_report) wired into sbuf_words so external callers can inspect guessed structured-buffer strides or supply real byte strides and observe any refused hints. Default translation behavior when these flags are absent is unchanged.

Prepared with AI assistance; all changes were reviewed and verified with host checks (tuxbox.py check --no-gpu). ProjectScarlett itself was not run with this split branch.

Tested

Run the checks relevant to this change.

  • The checks relevant to this change passed
  • Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below
  • Where the table calls for AMD and NVIDIA, they passed on both. Otherwise, say which vendor still needs to run them:

Pure CLI option plumbing (--capabilities, --stride-report, --stride-hints) with no default HLSL output changes, so no GPU or Lanes scenario is affected; behavior is covered directly by tools/shader-compiler/src/tests/main.rs and tools/shader-compiler/src/tests/hlsl/raw_width.rs. ProjectScarlett was not run with this change.

Commands run and their results:

DXC=<dxc> python3 tuxbox.py check --no-gpu
  -> 9/9 passed (Python tests; shader compiler unit + integration tests; DXBC; XG layout; XG entry point; storage codec; ACP HAL; D3D12 Windows typecheck)

./build/shader-compiler/x86_64-unknown-linux-gnu/release/xshader --capabilities
  -> {"options":["--hlsl-out","--profile-out","--link-pixel","--pixel-order","--stencil-target","--wave32-host","--stride-table","--root","--stride-report","--stride-hints"]}

Checks

CI runs the Python unit tests, the shader compiler, DXBC, and XG layout tests, and a Windows typecheck of tuxbox-d3d12.

<!-- greyfinch-sync:brcly/TuxBox:issue:5555251074 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/547). Originally posted by [glovepost](https://github.com/glovepost) on 2026-11-29T21:21:41Z. --- ## Summary Split from #522 per reviewer feedback. Adds `--capabilities`, `--stride-report`, and `--stride-hints` to `tuxbox-xshader`: - **CLI capabilities discovery (`tools/shader-compiler/src/main.rs`, `tests/main.rs`):** Adds `--capabilities` using standard-library JSON output (no new crate dependencies) reporting the binary's supported CLI flags. - **Guessed-stride reporting and host hints (`tools/shader-compiler/src/hlsl.rs`, `hlsl/emitter/resources.rs`, `main.rs`, `tests/hlsl/raw_width.rs`):** Adds `--stride-report` and `--stride-hints` (`StrideGuess`, `set_stride_hints`, `take_stride_report`) wired into `sbuf_words` so external callers can inspect guessed structured-buffer strides or supply real byte strides and observe any refused hints. Default translation behavior when these flags are absent is unchanged. Prepared with AI assistance; all changes were reviewed and verified with host checks (`tuxbox.py check --no-gpu`). ProjectScarlett itself was not run with this split branch. ## Tested Run the [checks relevant to this change](../CONTRIBUTING.md#test-what-your-change-touches). - [x] The checks relevant to this change passed - [x] Changed or new behaviour is covered by a Lanes scenario, or the reason it cannot be is stated below - [x] Where the table calls for AMD and NVIDIA, they passed on both. Otherwise, say which vendor still needs to run them: Pure CLI option plumbing (`--capabilities`, `--stride-report`, `--stride-hints`) with no default HLSL output changes, so no GPU or Lanes scenario is affected; behavior is covered directly by `tools/shader-compiler/src/tests/main.rs` and `tools/shader-compiler/src/tests/hlsl/raw_width.rs`. ProjectScarlett was not run with this change. Commands run and their results: ```text DXC=<dxc> python3 tuxbox.py check --no-gpu -> 9/9 passed (Python tests; shader compiler unit + integration tests; DXBC; XG layout; XG entry point; storage codec; ACP HAL; D3D12 Windows typecheck) ./build/shader-compiler/x86_64-unknown-linux-gnu/release/xshader --capabilities -> {"options":["--hlsl-out","--profile-out","--link-pixel","--pixel-order","--stencil-target","--wave32-host","--stride-table","--root","--stride-report","--stride-hints"]} ``` ## Checks CI runs the Python unit tests, the shader compiler, DXBC, and XG layout tests, and a Windows typecheck of `tuxbox-d3d12`.
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
brcly/TuxBox!547
No description provided.