I ran into these errors in a build of no signal:
ERROR: Cannot generate mipmaps in compressed or custom image formats.
at: generate_mipmaps (core/io/image.cpp:1821)
ERROR: Cannot convert to <-> from compressed formats. Use compress() and decompress() instead.
at: convert (core/io/image.cpp:525)
We do call decompress
before calling generate_mipmaps
and convert
, but it appears that in the build, the decompress function returns ERR_UNAVAILABLE
. This is why the Image
is still compressed when we attempt to call these functions.
The textures I have use BPTC compression, which should be supported by the decompress
function:
Error decompress()
Decompresses the image if it is VRAM compressed in a supported format. Returns
@GlobalScope.OK
if the format is supported, otherwise@GlobalScope.ERR_UNAVAILABLE
.Note: The following formats can be decompressed: DXT, RGTC, BPTC. The formats ETC1 and ETC2 are not supported.
But, as it turns out, the decompress function might still return ERR_UNAVAILABLE
anyway because not all of the image compression and decompression libraries are included in export builds:
Looks like most of the image compression/decompression libraries aren’t included in export builds.
In the past I know that we avoided including any image saving/loading libraries in the export builds, but I know that has been slowly opening up.
I guess the discussion here should be whether we want to enable the compression libraries for export builds. It would be helpful to do a build size analysis to see what the realistic cost for enabling them is.
With some experimentation, it appears that of the compression options available for Godot’s compress
function, only COMPRESS_S3TC
can be decompressed at runtime by decompress
with the default export template.