Skip to content

Added bit bias when storing R8_UNORM to be consistent with other 8bpp - #671

Merged
Chuck Walbourn (walbourn) merged 1 commit into
mainfrom
r8unormbitbias
Feb 18, 2026
Merged

Chuck Walbourn (walbourn) merged 1 commit into
mainfrom
r8unormbitbias

Conversation

@walbourn

Copy link
Copy Markdown
Collaborator

Adds a bias in StoreScanline when converting the float values to 8bpp channel specifically for DXGI_FORMAT_R8_UNORM and DXGI_FORMAT_A8_UNORM. This makes it consistent with other 8bpp formats.

@walbourn

Copy link
Copy Markdown
Collaborator Author

Test updates

walbourn/directxtextest#69

Copilot AI 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.

Pull request overview

This PR updates StoreScanline’s float-to-8bpp UNORM conversion to apply a consistent rounding bias for single-channel 8-bit formats (DXGI_FORMAT_R8_UNORM and DXGI_FORMAT_A8_UNORM), aligning their behavior with other 8bpp paths that already apply an 8-bit bias.

Changes:

  • Refactors the existing 8-bit bias constant into a scalar constexpr float plus an XMVECTORF32 variant for vectorized paths.
  • Adds the 8-bit rounding bias when storing scanlines for DXGI_FORMAT_R8_UNORM and DXGI_FORMAT_A8_UNORM.
  • Updates existing vectorized 8bpp conversions to use the renamed bias vector constant.

@walbourn
Chuck Walbourn (walbourn) merged commit 9b5e5d6 into main Feb 18, 2026
144 of 148 checks passed
@walbourn
Chuck Walbourn (walbourn) deleted the r8unormbitbias branch February 18, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent results between R8_UNORM and RGBA

4 participants