Make DDS loading code only check for R channel bitmask when loading grayscale images #80862
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 encountered this issue while working on another PR. Here's an MRP: dds_lumi_import.zip
The DDS loading code currently checks for all color channel masks to be set to 0xFF when loading grayscale/luminance images. However, many DDS grayscale images only set the R channel mask, meaning the engine fails to import them. Additionally, the official Microsoft DDS documentation states that only the R bitmask has to be set.
According to the documentation, an additional flag in the file should be specified to discern l8/l8a8 images from r8/r8g8 ones, however, Godot's DDS module currently does not support the latter. If there is demand to implement those formats in the future, we could add a check for that flag.
This PR removes the check for G and B bitmasks, making it possible to import all L8 and L8A8 files correctly. This change shouldn't have any impact on currently imported textures, so it doesn't break compatibility.