Skip to content

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

Merged
walbourn merged 1 commit intomainfrom
r8unormbitbias
Feb 18, 2026
Merged

Added bit bias when storing R8_UNORM to be consistent with other 8bpp#671
walbourn merged 1 commit intomainfrom
r8unormbitbias

Conversation

@walbourn
Copy link
Member

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 walbourn added the bug label Feb 12, 2026
@walbourn walbourn self-assigned this Feb 12, 2026
@walbourn
Copy link
Member Author

Test updates

walbourn/directxtextest#69

Copy link

Copilot AI left a comment

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 walbourn merged commit 9b5e5d6 into main Feb 18, 2026
144 of 148 checks passed
@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