Skip to content

Shaders: lower s_bitcmp0/1_b32 and s_bitcmp0/1_b64 - #117

Merged
Marvisak merged 1 commit into
Marvisak:mainfrom
tedin7:vic-s-bitcmp-2
Nov 24, 2026
Merged

Marvisak merged 1 commit into
Marvisak:mainfrom
tedin7:vic-s-bitcmp-2

Conversation

@tedin7

@tedin7 tedin7 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

What

  • Lowers s_bitcmp0_b32, s_bitcmp1_b32, s_bitcmp0_b64 and s_bitcmp1_b64. SCC becomes whether bit src1 (mod 32, mod 64 for the 64-bit forms) of src0 is clear (bitcmp0) or set (bitcmp1).

Why

  • The instructions decode and ir.rs already tracks them as SCC writers, but sop() had no case for them. Any shader using one failed to translate with Unsupported.

Tested

  • Linux x86_64 only. Commands run:
    • cargo test -j4 -p victory-shader scalar_bit_tests_lower with the lowering disabled (test only): fails with Unsupported { offset: 8, what: "s_bitcmp0_b32" }.
    • cargo test -j4 -p victory-shader after the change: 56 passed (origin/main 237f2e8), 0 failed (the new test included).
    • cargo clippy -j4 -p victory-shader --tests: no new warnings (existing: dead_code constant_color in emit/mod.rs, a boolean-simplification note in resource.rs).
    • rustfmt --edition 2024 --check on lower.rs: clean.
  • The test uses synthetic machine code (no game data) and checks that lowering succeeds, not the emitted DXIL values.
  • NOT run: Windows runtime, GPU, or a real console shader.
  • The test reuses the existing lowers() helper in the tests module.

The scalar bit tests decode and are tracked in ir.rs (they write SCC) but the lowering had no case for them, so any shader using one failed to translate with Unsupported.
@lordon1a

Copy link
Copy Markdown
Contributor

Verified 3c860538e on Windows 11 (x86_64-pc-windows-gnullvm, rustc 1.100.0, applied cleanly to main@4c0bb89): pass.

  • cargo xtask policy: 151 files ok
  • cargo test -p victory-shader -- --skip v_med3_f32_matches_rdna2_with_nan: 69 passed, 0 failed.

AI-assisted.

@DaviTostes

Copy link
Copy Markdown

Tested 3c86053 on Arch Linux x86_64, rustc 1.98.1: pass.

@Marvisak
Marvisak merged commit 3d77d5e into Marvisak:main Nov 24, 2026
r4tedx added a commit to r4tedx/VIctory that referenced this pull request Nov 24, 2026
main moved under Marvisak#307 and this branch. One conflict, in the test module of
emit/lower.rs: the imports take both sides' names (Marvisak#117's `half_shift`
beside `Lowered`), and Marvisak#117's `scalar_bit_tests_lower` sits after this
branch's waterfall tests. No code outside the test module was touched by
hand. A merge rather than a rebase so Marvisak#307's commits keep their ids.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
BastienRodz added a commit to BastienRodz/VIctory that referenced this pull request Nov 24, 2026
… the tests compile

cargo test -p victory-shader does not compile on main (cf0bb43):

    error[E0061]: this function takes 2 arguments but 1 argument was supplied
    --> crates/victory-shader/src/emit/lower.rs:6954:13

25b0f88 (Marvisak#432) gave the test helper lowers() an rsrc2 argument and
updated its callers; 3c86053 (Marvisak#117), merged in the same wave, added the
s_bitcmp test with a call of the old form. The helper used rsrc2 0
before, so the call passes 0. One argument, nothing else changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
r4tedx added a commit to r4tedx/VIctory that referenced this pull request Nov 24, 2026
On main at 8d23f07 the test target of victory-shader does not compile:
Marvisak#612 gave the test helper `lowers` a second argument (rsrc2) and Marvisak#117's
`scalar_bit_tests_lower`, merged beside it, still calls it with one. The
call passes 0, as the helper's other callers without group ids do.

Not part of the scratch-memory change; it is here so this branch's tests
can run. Drop it when main has the same fix.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
r4tedx added a commit to r4tedx/VIctory that referenced this pull request Nov 24, 2026
On main the test target of victory-shader does not compile (upstream
issue Marvisak#719): Marvisak#612 gave the test helper `lowers` a second argument (rsrc2)
and Marvisak#117's `scalar_bit_tests_lower`, merged beside it, still calls it with
one. The call passes 0, as the helper's other callers without group ids
do.

Not part of the image sampling change; it is here so this branch's tests
can run. Drop it when main has the same fix.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
suirentakamura referenced this pull request in suirentakamura/victory-suiren Nov 24, 2026
Shaders: lower s_bitcmp0/1_b32 and s_bitcmp0/1_b64
suirentakamura referenced this pull request in suirentakamura/victory-suiren Nov 24, 2026
main moved under #307 and this branch. One conflict, in the test module of
emit/lower.rs: the imports take both sides' names (#117's `half_shift`
beside `Lowered`), and #117's `scalar_bit_tests_lower` sits after this
branch's waterfall tests. No code outside the test module was touched by
hand. A merge rather than a rebase so #307's commits keep their ids.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
itsonlysimbo pushed a commit to itsonlysimbo/VIctory that referenced this pull request Nov 24, 2026
Shaders: lower s_bitcmp0/1_b32 and s_bitcmp0/1_b64
itsonlysimbo pushed a commit to itsonlysimbo/VIctory that referenced this pull request Nov 24, 2026
main moved under Marvisak#307 and this branch. One conflict, in the test module of
emit/lower.rs: the imports take both sides' names (Marvisak#117's `half_shift`
beside `Lowered`), and Marvisak#117's `scalar_bit_tests_lower` sits after this
branch's waterfall tests. No code outside the test module was touched by
hand. A merge rather than a rebase so Marvisak#307's commits keep their ids.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants