Shaders: accept known D3D_MIN_PRECISION signature elements #286

Open
github-bot wants to merge 1 commit from github-bot/gh-286 into main AGit
Owner

@⁠tarcisioads on GitHub · 2026-11-24 02:03 UTC · original
tarcisioads:shader/min-precision-signature → main · +50 −2 · 1 files · 1 commits · open

Allow known D3D_MIN_PRECISION values (1 FLOAT_16, 2 FLOAT_2_8, 4 SINT_16, 5 UINT_16, 240 ANY_16, 241 ANY_10) at offset +28 of ISG1/OSG1/PSG1 signature rows in crates/victory-shader/src/emit/mod.rs, instead of failing with "a minimum-precision signature element".

DXBC already encodes those elements with a 32-bit ComponentType (1..=3), and DXIL SM 6.x declares them as 32-bit with MinPrecision = 0. Unknown/reserved MinPrecision values (such as 3) continue to return ShaderError::Unsupported.

Adds a unit test signature_accepts_known_min_precision_and_rejects_unknown covering all known D3D_MIN_PRECISION values and an unknown value.

Verification

  • cargo test -p victory-shader (57/57 passed on macOS; Windows dxil.dll validation not run)
  • cargo xtask policy (ok)
  • rustfmt --edition 2024 --check crates/victory-shader/src/emit/mod.rs (ok)
**@⁠tarcisioads** on GitHub · 2026-11-24 02:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/286) `tarcisioads:shader/min-precision-signature` → `main` · +50 −2 · 1 files · 1 commits · open Allow known `D3D_MIN_PRECISION` values (`1` `FLOAT_16`, `2` `FLOAT_2_8`, `4` `SINT_16`, `5` `UINT_16`, `240` `ANY_16`, `241` `ANY_10`) at offset `+28` of `ISG1`/`OSG1`/`PSG1` signature rows in `crates/victory-shader/src/emit/mod.rs`, instead of failing with `"a minimum-precision signature element"`. DXBC already encodes those elements with a 32-bit `ComponentType` (`1..=3`), and DXIL SM 6.x declares them as 32-bit with `MinPrecision = 0`. Unknown/reserved `MinPrecision` values (such as `3`) continue to return `ShaderError::Unsupported`. Adds a unit test `signature_accepts_known_min_precision_and_rejects_unknown` covering all known `D3D_MIN_PRECISION` values and an unknown value. ### Verification - `cargo test -p victory-shader` (57/57 passed on macOS; Windows `dxil.dll` validation not run) - `cargo xtask policy` (ok) - `rustfmt --edition 2024 --check crates/victory-shader/src/emit/mod.rs` (ok)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:57:59 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 04:16 UTC · original

Tested PR #286 at head 6afdb58eeb875499ff79b3f8434500894df2ace4 (state at test time: OPEN). Pre-comment refresh: state OPEN, head unchanged at 6afdb58eeb875499ff79b3f8434500894df2ace4.

  • cargo test --locked -p victory-shader signature_accepts_known_min_precision_and_rejects_unknown — passed (ok. 1 passed; 0 failed; 0 ignored; 0 measured; 69 filtered out; finished in 0.00s ); cases: emit::tests::signature_accepts_known_min_precision_and_rejects_unknown.

Behavior covered: Checks known D3D_MIN_PRECISION signature elements are accepted while unknown values are rejected.
Code: crates/victory-shader/src/emit/mod.rs

**@⁠jeremygold02** on GitHub · 2026-11-24 04:16 UTC · [original](https://github.com/Marvisak/VIctory/pull/286#issuecomment-7121873209) Tested PR #286 at head `6afdb58eeb875499ff79b3f8434500894df2ace4` (state at test time: OPEN). Pre-comment refresh: state OPEN, head unchanged at `6afdb58eeb875499ff79b3f8434500894df2ace4`. - `cargo test --locked -p victory-shader signature_accepts_known_min_precision_and_rejects_unknown` — passed (ok. 1 passed; 0 failed; 0 ignored; 0 measured; 69 filtered out; finished in 0.00s ); cases: emit::tests::signature_accepts_known_min_precision_and_rejects_unknown. Behavior covered: Checks known D3D_MIN_PRECISION signature elements are accepted while unknown values are rejected. Code: [crates/victory-shader/src/emit/mod.rs](https://github.com/Marvisak/VIctory/blob/6afdb58eeb875499ff79b3f8434500894df2ace4/crates/victory-shader/src/emit/mod.rs)
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:29 UTC · original

Automated triage for the maintainers.

Needs work. signature in crates/victory-shader/src/emit/mod.rs now accepts min-precision signature elements as plain 32-bit ones (half: false); the enum values are right. The open question is how the console program passes these values: main decides 16-bit packing from the signature's component type and, for outputs, from the native program's fp16/pack2 flags (half_outputs in lower.rs). If the console compiler stores or interpolates min16 values packed, declaring them 32-bit unpacked reads or writes the wrong bits, whereas the current refusal at least fails clearly. Please add a console shader (or its translation log) with a min-precision element showing how its GFX10 code accesses it, or a round-trip test that passes dxil.dll validation and reads the right values.

CI: no check runs on the head commit.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/286#issuecomment-7148564430) <!-- victory-triage v1 head=6afdb58eeb875499ff79b3f8434500894df2ace4 verdict=needs-work at=2026-11-25T00:19:34Z --> Automated triage for the maintainers. **Needs work.** `signature` in `crates/victory-shader/src/emit/mod.rs` now accepts min-precision signature elements as plain 32-bit ones (`half: false`); the enum values are right. The open question is how the console program passes these values: main decides 16-bit packing from the signature's component type and, for outputs, from the native program's `fp16`/`pack2` flags (`half_outputs` in `lower.rs`). If the console compiler stores or interpolates min16 values packed, declaring them 32-bit unpacked reads or writes the wrong bits, whereas the current refusal at least fails clearly. Please add a console shader (or its translation log) with a min-precision element showing how its GFX10 code accesses it, or a round-trip test that passes `dxil.dll` validation and reads the right values. CI: no check runs on the head commit. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/286/head:github-bot/gh-286'
git switch 'github-bot/gh-286'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-286'
git switch 'github-bot/gh-286'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-286'
git switch 'github-bot/gh-286'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-286'
git switch 'main'
git merge --squash 'github-bot/gh-286'
git switch 'main'
git merge --ff-only 'github-bot/gh-286'
git switch 'main'
git merge 'github-bot/gh-286'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!286
No description provided.