Add flag to write BGRX DDS content using R8G8B8 24bpp legacy DX9 #641
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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_R8G8B8content.The implementation requires:
The image data must be
DXGI_FORMAT_B8G8R8X8which 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_EXTandDDS_FLAGS_FORCE_DX10_EXT_MISC2must 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_LEGACYis 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.