fs2open.github.com
fs2open.github.com copied to clipboard
add support for decompression of DDS textures
Adds bcdec lib to convert compressed DDS textures to RGBA based on what the system supports. BC7 if BPTC extension not supported, DXT? if S3TC extension not supported.
Should support cubemaps and volume textures but those were not tested.
Addtional changes:
- remove indexed DDS support since it had bugs but didn't work anyway (R8 should be used instead)
- fix issues with volume textures (nothing to test with)
- remove old compression support flags as they are now obsolete
Fixes #4920
As a memory optimization this does resize the de-compressed textures using mimaps. After testing a max size of 1024x1024 was chosen. Without this the game can easily become unusable due to the size of textures in use by some mods.
As an example, the Triton from the MVPS. Uncompressed at full size the complete set of textures with mipmaps requires ~1.5 GB of VRAM. After the "resize" it's down to a more manageable 24 MB.
Thank you for all your time with creating this PR, it will be fantastic to finally have BC7 textures finally not just be black on MACs
This worked great on my Mac with the test mission I had received previously that used a BC7 planet texture. I did notice a couple of issues in the logs that were probably not related to this change, but wanted to document here and figured you could look into later if they sound worth any investigation, or decide they aren't a problem:
./fs2_open_24_1_0_arm64-DEBUG.app/Contents/MacOS/fs2_open_24_1_0_arm64-DEBUG -mod fotg -window
2024-03-25 16:17:35.582 fs2_open_24_1_0_arm64-DEBUG[53262:14339740] WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:.
UNSUPPORTED (log once): POSSIBLE ISSUE: unit 0 GLD_TEXTURE_INDEX_2D_ARRAY is unloadable and bound to sampler type (Float) - using zero texture because texture unloadable
The first warning appears to be new as I only noticed it showing up recently. Are you on 14.4+ by any chance? It was after the update that I noticed it and I don't recall seeing it on earlier versions, but I could be wrong. Either way it's on my todo list.
That second warning (the GLD_TEXTURE_INDEX_2D_ARRAY one) has been there a while and I'm really not sure where it's coming from. I've tried debugging it several times but haven't figured it out. Nothing is obviously broken as far as I can tell so I've just decided to ignore it until proven otherwise.
I'm apparently on 14.3.1, didn't know 14.4 was out yet. It isn't offering me any updates in Settings yet. 2021 Macbook M1 Pro.