Skip to content

Transcode DDS BCn to ETC2 in case of missing hardware support for S3TC/BPTC - #7708

Open
Shivansps wants to merge 14 commits into
scp-fs2open:masterfrom
Shivansps:etc2-transcoding
Open

Transcode DDS BCn to ETC2 in case of missing hardware support for S3TC/BPTC#7708
Shivansps wants to merge 14 commits into
scp-fs2open:masterfrom
Shivansps:etc2-transcoding

Conversation

@Shivansps

@Shivansps Shivansps commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Mobile GPUs might not have S3TC or BPTC, while it has become more common on Adreno 800s and Mali V5 Valhall you can never be sure, and support on older gen gpus is rare.
The objective of this PR is to do transcoding when the bitmap data is requested, if ETC2 support is present. Impact on loading times, specially for missions with a lot of ships and weapons are noticeable, but usable. Additionally a transcoding cache is added so you will only transcode a texture once, unless it is evicted from cache due to size limitation.

This process is about the same used by the bcn_layer that pc games emulators for android uses. And has been optimised for transcode speed and smallest vram usage over quality.

Current Features:

  1. ETC2 transcode, using the 1024 MAX_SIZE ddsutils uses for software decoding.
  2. etcpak lib, a fast transcoding lib, was added to do the runtime transcoding. (This lib supports both ETC2 and BC encoding)
  3. DXT3, DXT5 and BC7 are all converted to RGBA8_ETC2_EAC. DXT1 are converted to ETC2_RGB. etcpak do not support ETC2 RGBA1 what is the direct equivalent of DXT1. I have not observed any anormal result.
  4. a cmdline argument "-no_transcode_cache" to disable caching
  5. Fix Vulkan S3TC/BC7 detection logic, it was assuming to be always present what is not true for mobile gpus
  6. Textures to be transcoded to ETC2 are always downsized by 50% or limited to the max of 1024x1024 as set in ddsutils.
  7. The fastest LZ4 compression is applied to the cache files, this has near no impact is transcode or read back times and reduces cache size by about 4 times... (2.3GB Icarus load uncompressed vs 536MB compressed).
  8. Added a configurable setting for the transcode cache size and a cache prune runs at every startup.
  9. The cache system was made to support both etc2 and bcn. Its intended to be used in a future PR to transcode ETC2 to BCn in ktxutils if GPU do not support ETC2 (none of the desktop gpus in Vulkan mode supports it)

@Shivansps
Shivansps marked this pull request as ready for review August 16, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant