Skip to content

GPU: reconstruct normalized rectangle attributes in storage units - #3653

Open
andrewpozdnakov7-jpg wants to merge 1 commit into
Marvisak:mainfrom
andrewpozdnakov7-jpg:codex2/rectangle-normalized-storage
Open

andrewpozdnakov7-jpg wants to merge 1 commit into
Marvisak:mainfrom
andrewpozdnakov7-jpg:codex2/rectangle-normalized-storage

Conversation

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

Change

The CPU rectangle fallback completes the fourth corner as a + b - right. For UNORM and SNORM attributes, perform that arithmetic in storage units and clamp once when writing the result. The integer codes and their intermediate sums fit exactly in f32. Both signed encodings of the negative endpoint still decode to the same value.

Verification

  • Compared 51,511,296 reconstructed codes with 63bcca43. This covers every triple for UNORM8 and SNORM8, plus all 16-bit codes for one corner against endpoint neighborhoods for the other two and generated 16-bit triples.
  • All nine existing primitive tests passed on each source revision. Generated full vertex buffers matched byte for byte, including incomplete tails.
  • On Windows x64, Rust 1.98.1, Intel Core i7-870, the exact candidate's median CPU expansion speed was 1.30–1.45× for float positions with RGBA8 color, and 1.58–1.73× for mixed UNORM and SNORM. The float-only control ranged from 0.97–1.04×. Each size used 19 alternating pairs, from 1 to 4,096 rectangles. These timings cover the CPU expansion routine.
  • Asset policy passed for 191 files.

AI-assisted with OpenAI Codex.

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor Author

Verified 9e21c05a0111f247de3752506626090f8b2f95b0 on Windows CI. Both Clippy stages and the workspace test stage passed.

The local exact-source harness matched all 51,511,296 generated component results against 63bcca43, and both revisions passed their nine rectangle tests. The median CPU speedup was 1.30–1.45× for float positions with RGBA8 color and 1.58–1.73× for mixed normalized attributes, across 19 alternating pairs per size. The float-only control ranged from 0.97–1.04×. Compatibility check with packed colors

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

AI-assisted with OpenAI Codex.

@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor Author

I tested #3705 together with this head. Combined commit 298ba6f preserves both heads. Git combined them cleanly.

The normalized-attribute results matched byte for byte on 4,096 generated rectangles in each of five layouts, including the incomplete buffer tails. Nine primitive tests, strict GPU Clippy and the asset policy passed. In the optimized CPU test, the added layout lookup change improved eight of the ten layout-and-batch combinations. The other two were within 2.3% of this branch alone.

The next step is maintainer review. Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <andrewpozdnakov7-jpg@users.noreply.github.com> if folding the changes 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.

1 participant