Skip to content

Shaders: lower v_mad_{u16,i16} and saturating clamp on 16-bit integer ops (#1211) - #69

Merged
LAKSHYA-cmd-tech merged 1 commit into
integrate/gta6-world-and-shader-fixesfrom
feature/valu16-mad-clamp
Nov 24, 2026
Merged

LAKSHYA-cmd-tech merged 1 commit into
integrate/gta6-world-and-shader-fixesfrom
feature/valu16-mad-clamp

Conversation

@LAKSHYA-cmd-tech

Copy link
Copy Markdown
Owner

Backports PR Marvisak#1211:

  • Add v_mad_u16 and v_mad_i16 to valu16/valu16_op in crates/victory-shader/src/emit/lower.rs, preserving untouched destination half via write_half.
  • Allow saturating v.clamp on v_add_nc_u16, v_sub_nc_u16, v_subrev_nc_u16, v_mad_u16, and v_mad_i16.
  • Add emit::valu_tests::v_mad_16_and_int16_clamp_match_rdna2.

… ops

AI-generated & verified with Gemini 4 Neon (High Mode) — not written by a human engineer.

- Add `v_mad_u16` (VOP3 0x340) and `v_mad_i16` (VOP3 0x35e) to `valu16` / `valu16_op`
  in `crates/victory-shader/src/emit/lower.rs`, preserving the untouched half
  of the destination VGPR via `write_half`.
- Allow saturating `v.clamp` on `v_add_nc_u16`, `v_sub_nc_u16`, `v_subrev_nc_u16`,
  `v_mad_u16`, and `v_mad_i16` (clamping to `[0, 65535]` for unsigned and
  `[-32768, 32767]` for signed in 32-bit intermediate precision). Non-saturating
  16-bit integer ops continue to reject `v.clamp`.

Verified with synthetic GPU + WARP + dxil.dll tests in `valu_tests.rs` on
NVIDIA GeForce RTX 3060 Ti (Windows 11, Rust 1.98.1). No game data used.

Co-Authored-By: Gemini 4 Neon (High Mode) <noreply@google.com>
@LAKSHYA-cmd-tech
LAKSHYA-cmd-tech merged commit 96e2108 into integrate/gta6-world-and-shader-fixes Nov 24, 2026
@coderabbitai

coderabbitai Bot commented Nov 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ff893a94-179e-4b1b-96df-53d86a5f7dca

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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.

2 participants