Skip to content

Conversation

@walbourn
Copy link
Member

@walbourn walbourn commented Oct 27, 2025

I've never offered support for writing 24bpp data before because there is no DXGI equivalent format defined. The DDS reader has supported reading and expanding this format, but I've always written the result out using a 32bpp format. A customer has requested the ability to output 24bpp legacy format data for use with older codebases that can only work with D3DFMT_R8G8B8 content.

The implementation requires:

  • The image data must be DXGI_FORMAT_B8G8R8X8 which is the DXGI format closest in 24bpp (BGR no alpha).

  • The write must use the flag DDS_FLAGS_FORCE_24BPP_RGB.

  • The flags DDS_FLAGS_FORCE_DX10_EXT and DDS_FLAGS_FORCE_DX10_EXT_MISC2 must not be set or it will ignore the request since these both force the use of the 'DX10' extended header that only has DXGI_FORMAT values.

  • The flag DDS_FLAGS_FORCE_DX9_LEGACY is recommended but not required so you get failures attempting to write any resource that can't be written using legacy pixel formats such as texture arrays. Otherwise it is going to write such content using the DXGI format B8G8R8X8 via the "DX10" header.

  • The texconv tool supports this output via -dx9 -f RGB24.

@walbourn walbourn self-assigned this Oct 27, 2025
@walbourn walbourn added the dds DirectDraw Surface (DDS) label Oct 27, 2025
@walbourn walbourn linked an issue Oct 27, 2025 that may be closed by this pull request
@walbourn
Copy link
Member Author

Test suite updates walbourn/directxtextest#66

@walbourn walbourn merged commit f180374 into main Oct 27, 2025
113 checks passed
@walbourn walbourn deleted the dds24bpp branch October 27, 2025 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dds DirectDraw Surface (DDS)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

B8G8R8_UNORM

3 participants