gl4es icon indicating copy to clipboard operation
gl4es copied to clipboard

S3tc hardware support

Open Sisah2 opened this issue 2 years ago • 7 comments

Hello, please can you subscribe steps/parts of code to disable dxt texture decompression and use extensions for hardware support (i think its really matter of just disabling some code) I got device with GL_EXT_texture_compression_s3tc_srgb GL_EXT_texture_compression_dxt1 GL_ANGLE_texture_compression_dxt3 GL_ANGLE_texture_compression_dxt5 I tried commenting out code in gl4es_glCompressedTexImage2D gl4es_glCompressedTexSubImage2D gl4es_glGetCompressedTexImage And just call their gles variants here (in app im using it seems to call only gl4es_glCompressedTexImage2D from those three) does it need also some changes in texture.c ?

Sisah2 avatar May 15 '22 08:05 Sisah2

This too is supported on some devices: GL_EXT_texture_compression_s3tc

AbduSharif avatar May 17 '22 05:05 AbduSharif

Currently ram is big problem in openmw on android, textures taking too much of it (i expect they are converted to uncompresed format) enabling this extension where available with fallback to reconpression to some different format will help a lot. LIBGL_SHRINK options make really big diferences in ram usage.

Sisah2 avatar Mar 21 '23 14:03 Sisah2

Yeah, I should add support for hardware S3TC extension, that should help on a lot of harware that should support this now.

ptitSeb avatar Mar 21 '23 15:03 ptitSeb

That would be awesome. Not sure about mali, but xclipse support those angle extensions and snapdragon 8gen2 (not sure about older) have regular GL_EXT_texture_compression_s3tc_srgb and GL_EXT_texture_compression_s3tc.

Sisah2 avatar Mar 22 '23 16:03 Sisah2

Actually just revert this check here and dxt textures get loaded. https://github.com/Sisah2/gl4es/blob/b32fcfd2a379c508209a8d16567a56de3883b1df/src/gl/texture_compressed.c#L208 But without mipmaps, i guess it would need to resize those compressed data and upload them manually (or decompress->resize->compress back) any clue on doing this? Need resizeDxtData() function or at least way to compress uncompressed data to dxt.

Sisah2 avatar Apr 10 '24 07:04 Sisah2

Ended up with this, it work but use small hack in osg to tell gl4es at which point to generate mipmaps (if(level == bound->max_level)) mostly work, but there were few textures for which it didnt (they request hardware mipmap generation it seems) using bound->mipmap_auto worked for those, which is weird (its not supposed to work with compressed textures right?) Memory is happier, loading times faster, and if not using mipmaps even framerate is much better, but for some reason when mipmaps are used there is basically no framerate gain. https://github.com/Sisah2/gl4es/commit/8b6c0418dabe3410fc53918b66285588cde9a7e7

Sisah2 avatar May 04 '24 06:05 Sisah2

You could make a PR with this. I see it's optionnal so I'll gladly accept it. Just missing a bit of doc maybe.

ptitSeb avatar May 04 '24 07:05 ptitSeb