Skip to content

GPU: interpolate normalized rectangle vertex attributes - #1453

Merged
Marvisak merged 1 commit into
Marvisak:mainfrom
Luizbc2:fix/rectangle-normalized-vertices
Nov 25, 2026
Merged

Marvisak merged 1 commit into
Marvisak:mainfrom
Luizbc2:fix/rectangle-normalized-vertices

Conversation

@Luizbc2

@Luizbc2 Luizbc2 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

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.

Handle scalar and two-channel UNORM inputs and signed normalized inputs.
@acetonahard-code

Copy link
Copy Markdown

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.

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
mercuryVM added a commit to mercuryVM/VIctory that referenced this pull request Nov 24, 2026
…e vertex attributes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@mercuryVM mercuryVM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested 6f36cdf on Windows 11, RTX 5070, MSVC: builds, cargo test --workspace --no-fail-fast 644 passed, 0 failed (on our fork main), clippy -D warnings clean with and without --all-features. normalized_attributes_are_interpolated_in_their_own_range passes.

  • The format numbers are the right DXGI formats: 56 R16_UNORM, 49 R8G8_UNORM, 61 R8_UNORM, 13/37/58 R16G16B16A16/R16G16/R16_SNORM, and 31/51/63 R8G8B8A8/R8G8/R8_SNORM.
  • The SNORM decode clamps the most negative code (-128, -32768) to -1.0, as the D3D conversion rules require. The encode clamps to [-1, 1] and rounds.
  • The test's fourth corner (v0 + v2 - v1) checks the interpolation and both clamps, positive (UNORM8 at 255) and negative (SNORM at the minimum).

Merged into our fork's main.

AI-assisted (Claude Code).

@Marvisak
Marvisak merged commit 12ee4a1 into Marvisak:main Nov 25, 2026
mercuryVM added a commit to mercuryVM/VIctory that referenced this pull request Nov 25, 2026
…e upstream resync

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	crates/victory-gpu/src/host.rs
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