What is the ETC2 compressed texture block size?

What is the size of the texture block GL_COMPRESSED_RGB8_ETC2 and GL_COMPRESSED_RGBA8_ETC2_EAC ?

I used ((w+3)/4)*((h+3)/4)* 8 for GL_ETC1_RGB8_OES , but can't find anything about ETC2 (Khronos documentation is not very clear).

+4
source share
4 answers

The OpenGL ES 3.0 specification includes the instruction: A texture compressed using any of the ETC texture image formats is described as a number of 4 x 4 pixel blocks in the C.1 ETC Compressed Texture Image Formats section.

+1
source

FWIW ETC2 extends ETC1 by using some otherwise unused bit patterns, as described by Strom et al in "Compressing Textures Using Invalid Combinations ". (See Also Graphic Equipment Slide Presentation ):

Therefore, the block sizes are the same.

+1
source

Block sizes are described here: http://www.khronos.org/opengles/sdk/docs/man3/html/glCompressedTexImage2D.xhtml

In particular:

  • GL_COMPRESSED_RGB8_ETC2 = ceil (width / 4) * ceil (height / 4) * 8
  • GL_COMPRESSED_RGBA8_ETC2_EAC = ceil (width / 4) * ceil (height / 4) * 16
+1
source
  // ETC1 { 4, 4, 8, COMPRESSED_ETC1_RGB8_OES }, // ETC2 / EAC { 4, 4, 8, COMPRESSED_R11_EAC }, { 4, 4, 8, COMPRESSED_SIGNED_R11_EAC }, { 4, 4, 16, COMPRESSED_RG11_EAC }, { 4, 4, 16, COMPRESSED_SIGNED_RG11_EAC }, { 4, 4, 8, COMPRESSED_RGB_ETC2 }, { 4, 4, 8, COMPRESSED_SRGB8_ETC2 }, { 4, 4, 8, COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 }, { 4, 4, 8, COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 }, { 4, 4, 16, COMPRESSED_RGBA8_ETC2_EAC }, { 4, 4, 16, COMPRESSED_SRGB8_ALPHA8_ETC2_EAC }, 

The first two values ​​are the block size (for example, 4x4), the third value is BytesPerBlock. The fourth value is compression mode. This is from the table that I use to handle all compressed formats that exist.

I removed values ​​that are not useful for this answer (compression and decompression function pointers and preferred pixel formats for source / target data, sRGB, etc.).

+1
source

Source: https://habr.com/ru/post/1493847/


All Articles