Skip to content

GPU: expand packed rectangle colors from the selected corner - #3646

Open
andrewpozdnakov7-jpg wants to merge 1 commit into
Marvisak:mainfrom
andrewpozdnakov7-jpg:codex2/packed-rectangle-selected-corner
Open

andrewpozdnakov7-jpg wants to merge 1 commit into
Marvisak:mainfrom
andrewpozdnakov7-jpg:codex2/packed-rectangle-selected-corner

Conversation

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

The CPU rectangle fallback leaves R10G10B10A2_UNORM at the copied corner’s value. Reconstruct the fourth color from the two adjacent vertices and the right-angle vertex already selected from the position. Clamp RGB to 10 bits and alpha to 2 bits.

This replaces the closed #2243. Its review identified that the packed calculation assumed the second vertex was the right angle. The new regression supplies a float2 position and packed color in the same vertex and exercises all six orders. The fourth position and all four color channels match the expected values for every order.

The same regression fails on 63bcca43. All ten primitive tests passed with the fix when compiling the exact module and its unchanged right-angle helper with rustc --test. The local test exercises CPU expansion. DXGI input-assembler format support.

AI-assisted with OpenAI Codex.

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor Author

Verified 187d1c29a5789d923f028312fb37904927dccf56 against 63bcca43c6a00a758510398fa43096ce7e4f7df0. The new rectangle test fails on main and passes for all six orders with the fix. The fourth vertex has position (2, 1) and packed color (1023, 270, 0, 3), including saturation in the red, blue, and alpha channels.

All ten primitive tests passed using the exact source and unchanged right-angle helper. Git merged this head cleanly with #2729 at 857f394ebe5a7f8d1b4100979cd801eb4ac4deb8. The same ten tests passed from the merged primitive source. Asset policy passed for 191 files. These runs used generated CPU vertex data.

Please preserve the Git author if cherry-picking or rebasing, or include this trailer if folding the change into another commit.

Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com>

@Dukestar69 Dukestar69 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.

LGTM — verified on Windows:

  • cargo test -p victory-gpu --lib primitive:: passed (10/10, including packed_unorm_uses_the_position_corner_in_each_vertex_order)
  • cargo clippy -p victory-gpu --all-targets -- -D warnings passed with 0 warnings
  • cargo xtask policy passed (191 files ok)

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor Author

I checked #3653 with the current 187d1c29 head. Combined commit 89e04d8 preserves both PR heads.

All ten existing rectangle tests, including the packed-color test for every vertex order, passed on both revisions. I also expanded 4,096 generated rectangles with float positions and packed R10G10B10A2, UNORM8, SNORM8 and UNORM16 in one vertex. The full output buffers matched byte for byte. A second fixture compared 51,511,296 reconstructed normalized codes. These checks ran the exact rectangle expansion source on CPU and the asset policy passed.

Please retain the Git authors on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com> if folding the normalized arithmetic into another commit.

AI-assisted with OpenAI Codex.

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