Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support compressed texture uploads to GPU #1033

Open
guilt opened this Issue Apr 3, 2019 · 4 comments

Comments

Projects
None yet
3 participants
@guilt
Copy link
Contributor

guilt commented Apr 3, 2019

Essentially, this is the matrix of popular, most used texture compression. This means that we may not be able to support all operations on these compressed textures/bitmaps, but they'd be much faster to upload to the GPU, and give us plenty headroom. It is quite helpful on mobile devices and such.

  • iOS: PVRTC
  • tvOS: ASTC
  • Android: ETC1, ETC2, ATC
  • Mac/PC/Linux: DXT1, DXT5, BC7, BC6H (HDR)
@guilt

This comment has been minimized.

Copy link
Contributor Author

guilt commented Apr 3, 2019

Also see #559

@beoran

This comment has been minimized.

Copy link
Contributor

beoran commented Apr 3, 2019

We already have some support for DDS files with textures compressed in the DXT1, DXT3 and DXT5 formats. If the other formats are unencumbered by patent, then we could also implement those. See e.g.
https://github.com/liballeg/allegro5/blob/5.2.4/addons/image/dds.c for more information.

@SiegeLord

This comment has been minimized.

Copy link
Member

SiegeLord commented Apr 3, 2019

Yeah, we already have some support for (blocked) compressed textures. See al_lock_bitmap_blocked for the method to convert to GPU. For OpenGL this uses glCompressedTexSubImage2D under the hood. We'll have to think how to support non-blocked compressed textures and things like ASTC which have variable block size.

@guilt

This comment has been minimized.

Copy link
Contributor Author

guilt commented Apr 3, 2019

ASTC offers varying block sizes, but the block size is still fixed within a file; Just that the total number of bytes per block is a constant = 16 bytes. So, the bits per pixel are different.

Source: https://arm-software.github.io/opengl-es-sdk-for-android/astc_textures.html

ETC1 offers a fixed block size per 4 x 4 pixel block, but varying bit per block (5-5-5+3-3-3) or (4-4-4+4-4-4).

The usecase for this ticket / something like this is to just allow the entire bitmap data to be uploaded as-is compressed into the GPU, and not assumed to be efficient for user modification; This may be like using glCompressedTexImage2D for uploading the texture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.