GPU: interpolate normalized rectangle vertex attributes #1453

Manually merged
github merged 1 commit from gh-pr/1453/head into gh-pr/1453/base 2026-11-26 04:32:26 +00:00
Owner

@⁠Luizbc2 on GitHub · 2026-11-24 18:06 UTC · original
Luizbc2:fix/rectangle-normalized-vertices → main · +46 −2 · 1 files · 1 commits · merged 2026-11-25 00:14 UTC

Summary

The rectangle-list expansion leaves attributes in several ordinary normalized vertex formats at the first vertex’s value. Add the remaining one- and two-component UNORM8 forms, scalar UNORM16, and the one-, two-, and four-component SNORM8/SNORM16 forms so they use the existing fourth-corner interpolation. Clamp the signed minimum on decode and clamp the interpolated result to the representable range before encoding.

Reproduction and testing

The new normalized_attributes_are_interpolated_in_their_own_range test expands one synthetic rectangle. On ffe310e it finds the first vertex’s bytes at the fourth vertex. With the patch, it verifies the interpolated attributes and positive and negative clamping. All five primitive.rs tests passed on Windows with the pinned Rust toolchain.

Reference: DXGI format definitions. AI-assisted with Codex.

**@⁠Luizbc2** on GitHub · 2026-11-24 18:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/1453) `Luizbc2:fix/rectangle-normalized-vertices` → `main` · +46 −2 · 1 files · 1 commits · merged 2026-11-25 00:14 UTC ## Summary The rectangle-list expansion leaves attributes in several ordinary normalized vertex formats at the first vertex’s value. Add the remaining one- and two-component UNORM8 forms, scalar UNORM16, and the one-, two-, and four-component SNORM8/SNORM16 forms so they use the existing fourth-corner interpolation. Clamp the signed minimum on decode and clamp the interpolated result to the representable range before encoding. ## Reproduction and testing The new `normalized_attributes_are_interpolated_in_their_own_range` test expands one synthetic rectangle. On `ffe310e` it finds the first vertex’s bytes at the fourth vertex. With the patch, it verifies the interpolated attributes and positive and negative clamping. All five `primitive.rs` tests passed on Windows with the pinned Rust toolchain. Reference: [DXGI format definitions](https://learn.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format). AI-assisted with Codex.
Handle scalar and two-channel UNORM inputs and signed normalized inputs.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:32:24 +00:00
github manually merged commit 6f36cdf982 into gh-pr/1453/base 2026-11-26 04:32:26 +00:00
Author
Owner

@⁠acetonahard-code on GitHub · 2026-11-24 20:59 UTC · original

For reference: #1311 added the same normalized/SNORM entries to components, and its author closed it today, so this looks like the one to keep.

Tested on Windows 11, RTX 4070 SUPER (driver 621.14), with the repo toolchain, merged into current main (ffe310e):

cargo test -p victory-gpu passed failed ignored
main 50 0 1
main + this PR 51 0 1
main, --all-features 53 0 -
main + this PR, --all-features 54 0 -
  • The new test passes.
  • No GPU test skipped for lack of a device.
  • cargo clippy --all-targets -- -D warnings, with and without --all-features: clean.

I didn't test with game data.


Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.

**@⁠acetonahard-code** on GitHub · 2026-11-24 20:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/1453#issuecomment-7144336070) For reference: #1311 added the same normalized/SNORM entries to `components`, and its author closed it today, so this looks like the one to keep. Tested on Windows 11, RTX 4070 SUPER (driver 621.14), with the repo toolchain, merged into current `main` (ffe310e): | `cargo test -p victory-gpu` | passed | failed | ignored | |---|---|---|---| | `main` | 50 | 0 | 1 | | `main` + this PR | 51 | 0 | 1 | | `main`, `--all-features` | 53 | 0 | - | | `main` + this PR, `--all-features` | 54 | 0 | - | - The new test passes. - No GPU test skipped for lack of a device. - `cargo clippy --all-targets -- -D warnings`, with and without `--all-features`: clean. I didn't test with game data. --- <sub>Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.</sub>
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!1453
No description provided.