GPU: round rectangle half-float attributes to even #316

Open
github-bot wants to merge 1 commit from github-bot/gh-316 into main AGit
Owner

@⁠avt0m4t48 on GitHub · 2026-11-24 23:30 UTC · original
avt0m4t48:fix/rectangle-half-rounding → main · +41 −10 · 1 files · 1 commits · open

Fixes #245.

The CPU rectangle fallback converts the generated fourth vertex's half-float attributes back to binary16. Round halfway values to the nearest even mantissa in both the normal and subnormal paths. Keep NaNs quiet and preserve their sign and the payload bits that fit in binary16.

Verification

  • Source-built R16_FLOAT rectangle tests reproduced both reports on 2119b0e. The midpoint above 1.0 rounded upward, and a quiet NaN became infinity. All six standalone primitive.rs tests passed with the patch.
  • An optimized differential against GCC _Float16 checked 353,946 binary32 inputs, including signed finite binary16 values, adjacent midpoints and their neighbors, and generated binary32 bit patterns. Numeric conversions matched. NaNs passed the separate quiet/sign checks.
  • rustfmt --check and git diff --check passed.

This verifies the CPU fallback. No native D3D12 or application run was performed.

**@⁠avt0m4t48** on GitHub · 2026-11-24 23:30 UTC · [original](https://github.com/fxceless/victory-fork/pull/316) `avt0m4t48:fix/rectangle-half-rounding` → `main` · +41 −10 · 1 files · 1 commits · open Fixes #245. The CPU rectangle fallback converts the generated fourth vertex's half-float attributes back to binary16. Round halfway values to the nearest even mantissa in both the normal and subnormal paths. Keep NaNs quiet and preserve their sign and the payload bits that fit in binary16. ## Verification - Source-built `R16_FLOAT` rectangle tests reproduced both reports on `2119b0e`. The midpoint above 1.0 rounded upward, and a quiet NaN became infinity. All six standalone `primitive.rs` tests passed with the patch. - An optimized differential against GCC `_Float16` checked 353,946 binary32 inputs, including signed finite binary16 values, adjacent midpoints and their neighbors, and generated binary32 bit patterns. Numeric conversions matched. NaNs passed the separate quiet/sign checks. - `rustfmt --check` and `git diff --check` passed. This verifies the CPU fallback. No native D3D12 or application run was performed.
Preserve NaN classification and representable payload bits when expanding an R16_FLOAT corner on the CPU. Use the same ties-to-even rounding in the normal and subnormal conversion paths.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:40:34 +00:00
Author
Owner

@⁠kaayzouee on GitHub · 2026-11-25 00:59 UTC · original

Duplicate of #315?

**@⁠kaayzouee** on GitHub · 2026-11-25 00:59 UTC · [original](https://github.com/fxceless/victory-fork/pull/316#issuecomment-7149088967) Duplicate of #315?
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/316/head:github-bot/gh-316'
git switch 'github-bot/gh-316'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-316'
git switch 'github-bot/gh-316'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-316'
git switch 'github-bot/gh-316'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-316'
git switch 'main'
git merge --squash 'github-bot/gh-316'
git switch 'main'
git merge --ff-only 'github-bot/gh-316'
git switch 'main'
git merge 'github-bot/gh-316'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.