Skip to content

Shaders: 16-bit compares ignore VOP3 op_sel - #2

Open
Altorru wants to merge 2 commits into
mainfrom
fix/cmp16-opsel
Open

Altorru wants to merge 2 commits into
mainfrom
fix/cmp16-opsel

Conversation

@Altorru

@Altorru Altorru commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Fixes Marvisak#833. On RDNA2, v_cmp_*/v_cmpx_* over f16, u16 and i16 ignore VOP3 op_sel and compare the low 16 bits; VIctory read the high half when the bit was set. Arithmetic paths still honour op_sel, and v_cmp_class_f16 is unchanged (the issue notes its op_sel behaviour was not measured).

Changes:

  • half_src/half_fsrc keep their behaviour; new half_cmp_src/half_cmp_fsrc ignore VOP3 op_sel but still honour an SDWA word select.
  • Both 16-bit compare paths (f16 and u16/i16) use the compare variant.
  • v_cmp_16bit_ignores_vop3_op_sel covers v_cmp_lt_f16 and v_cmp_lt_u16 with op_sel:[1,0] and a clear control; the second f16 case is true only if op_sel is wrongly honoured, and the u16 case is the same trap.

No game data. Verified by this PR's Windows CI (clippy default/all-features, cargo test --workspace).

AI-assisted: written by an agent (Codebuff) at the reporter's request; no local hardware, so CI's WARP run is the first execution.

RDNA2 reads only the low half in v_cmp_*/v_cmpx_* over f16, u16 and i16,
whatever op_sel says; VIctory honoured it and compared the wrong half. The
arithmetic paths still honour op_sel. Adds a test for the f16 and u16
compares with op_sel set and clear (Marvisak#833).
@Altorru

Altorru commented Nov 24, 2026

Copy link
Copy Markdown
Owner Author

Windows CI passed: https://github.com/Altorru/VIctory/actions/runs/45393331977 — clippy (default and all-features) and cargo test --workspace. v_cmp_16bit_ignores_vop3_op_sel ran and reports ok on WARP. The first run failed to compile because the test passed tuples to run_cases; fixed by separating inputs and expected values.

@Altorru

Altorru commented Nov 24, 2026

Copy link
Copy Markdown
Owner Author

Windows CI passed: 45393331977 — clippy (default and all-features) and cargo test --workspace. v_cmp_16bit_ignores_vop3_op_sel ran and reports ok on WARP. The first run failed to compile because the test passed tuples to run_cases; fixed by separating inputs and expected values. Ready for merge or cherry-pick by a Marvisak collaborator.

1 similar comment
@Altorru

Altorru commented Nov 24, 2026

Copy link
Copy Markdown
Owner Author

Windows CI passed: 45393331977 — clippy (default and all-features) and cargo test --workspace. v_cmp_16bit_ignores_vop3_op_sel ran and reports ok on WARP. The first run failed to compile because the test passed tuples to run_cases; fixed by separating inputs and expected values. Ready for merge or cherry-pick by a Marvisak collaborator.

@Altorru

Altorru commented Nov 24, 2026

Copy link
Copy Markdown
Owner Author

CI pass confirmed: 45393331977 — clippy + all-features + cargo test --workspace. v_cmp_16bit_ignores_vop3_op_sel ok on WARP. No game data. Ready for merge/cherry-pick.

- Add hex = "0.4" crate dependency to victory-loader
- Replace custom hexDecode() with hex::decode()
- Add parse_victory_patch() and apply_victory_patches() functions
- Support format: <module>:<rva hex>:<hex bytes>
- Log patch applications via tracing::info!
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.

16-bit compares honour VOP3 op_sel, RDNA2 ignores it (no effect on GTA VI)

2 participants