Mainstream GPU Texture format

Source: Internet
Author: User

This article mainly introduces the mainstream mobile device GPU, and the supported compression formats

1.GPU classification

1.1 Imagination Technologies PowerVR SGX series

representative Model: PowerVR SGX 535, PowerVR SGX 540, PowerVR SGX 543MP, PowerVR SGX 554MP, etc.
Products: Apple iphone full line, ipad full line, Samsung I9000, P3100, etc.

1.2 Qualcomm (Qualcomm) Adreno series

Representative Model: Adreno 200, Adreno 205, Adreno 220, Adreno 320, etc.
Representative Products : HTC G10, G14,samsung glaxg s4,se Xperia, WP8, Xiaomi 1, 2, etc.

1.3 ARM's Mali series

Representative model: Mali-400, mali-t604, etc.
Representative Products : Samsung Galaxy SII, Galaxy SIII, Galaxy Note1, Galaxy Note2 (Asian edition), etc.

1.4 Nvidia's Tegra/geforce series

representative Model: Nvidia TEGRA2, nvidia TEGRA3, etc.
Representative Products : moto, Google Nexus 7,htc one X, Xiaomi3, TAGRA4, etc.

2. Compressed texture format

Common image file formats are: BMP, JPG, PNG, TGA, etc.

Common texture formats are: RGB-565, RGBA-4444, RGBA-5551, RGB-888, RGBA-8888, etc.

The file format is the encoding format used by the image for storage, which is a special encoding format saved on the hard disk, requires the CPU to read in, obtains the data through a specific decoding format, and then passes it on to the GPU.

The texture format is a pixel format that can be recognized by the GPU and can be quickly addressed for sampling.

2.1 Openes Supported texture formats

OpenGL ES 2.0 supports texture formats such as the r5g6b5,a4r4g4b4,a1r5g5b5,r8g8b8,a8r8g8b8 mentioned above, where R5g6b5,a4r4g4b4,a1r5g5b5 consumes 2 bytes per pixel (byte), R8g8b8 consumes 3 bytes per pixel, a8r8g8b8 4 bytes per pixel. As shown:



< Span style= "font-family: Arial" >    for a 512*512 texture, r5g6b5-formatted files take up to 512KB of capacity, A8R8G8B8-formatted files take up 1MB of capacity , if the texture of the 1024*1024, then each need 2M and 4M capacity, which can easily require dozens of, hundreds of or even more textures of the game, the G capacity of the game on the mobile platform is not easy to accept (of course, there are 1, 2G of the masterpiece, which contains thousands of images of the texture).

2.2 Commonly used compressed texture formats

The compression textures based on OpenGL ES are commonly implemented in the following ways:
1) ETC1 (Ericsson texture compression) does not support translucent
2) PVRTC (PowerVR texture compression)
3) ATITC (ATI texture compression)
4) S3TC (S3 texture compression)

ETC1:
The ETC1 format is part of the OpenGL ES graphics standard and is supported by all Android devices.
The extension is: gl_oes_compressed_etc1_rgb8_texture, which does not support transparent channels, so it can only be used for opaque textures.
When loading a compressed texture, the <internal format> parameter supports the following format:
Gl_etc1_rgb8_oes (RGB, 0.5 bytes per pixel)
Can be expanded to a semi-transparent way:

For more information, refer to this section.

There are two options to choose from, one is to select Create Atlas when generating the PKM file from the Mali tool, which creates a piece of texture that is stitched together. The upper part of the texture is the original image (no alpha information), and the lower half is the alpha information image. Render with special shader when rendering. This change is relatively small.

Another option is to create two separate pictures, the original and alpha images, respectively. The two textures are loaded at render time, and then the alpha image is passed as a parameter to the shader of the original picture.


PVRTC:
The supported GPUs are the PowerVR SGX series of the Imagination Technologies.
OpenGL es has a extension of: GL_IMG_TEXTURE_COMPRESSION_PVRTC.
The <internal format> parameter supports several formats when loading compressed textures:
Gl_compressed_rgb_pvrtc_4bppv1_img (RGB, 0.5 bytes per pixel)
Gl_compressed_rgb_pvrtc_2bppv1_img (RGB, 0.25 bytes per pixel)
Gl_compressed_rgba_pvrtc_4bppv1_img (RGBA, 0.5 bytes per pixel)
Gl_compressed_rgba_pvrtc_2bppv1_img (RGBA, 0.25 bytes per pixel)

ATITC:
The supported GPU is the Adreno family of Qualcomm.
The supported OpenGL ES extension is: GL_ATI_TEXTURE_COMPRESSION_ATITC.
The <internal format> parameter supports the following types of textures when loading compressed textures:
GL_ATC_RGB_AMD (RGB, 0.5 bytes per pixel)
GL_ATC_RGBA_EXPLICIT_ALPHA_AMD (RGBA, 1 bytes per pixel)
GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD (RGBA, 1 bytes per pixel)

S3tc
Also known as DXTC, it is widely used on PCs, but it is still a novelty on mobile devices. The supported GPUs are the NVIDIA Tegra series.
The OpenGL es extension is:
Gl_ext_texture_compression_dxt1 and GL_EXT_TEXTURE_COMPRESSION_S3TC.
When loading a compressed texture, the parameters of the <internal format> are in the following formats:
GL_COMPRESSED_RGB_S3TC_DXT1 (RGB, 0.5 bytes per pixel)
GL_COMPRESSED_RGBA_S3TC_DXT1 (RGBA, 0.5 bytes per pixel)
GL_COMPRESSED_RGBA_S3TC_DXT3 (RGBA, 1 bytes per pixel)
GL_COMPRESSED_RGBA_S3TC_DXT5 (RGBA, 1 bytes per pixel)

Thus, the Mali series GPU only supports compressed textures in the ETC1 format, and the texture does not support transparent channels and has some limitations.
The above compressed texture format per pixel size relative to the A8R8G8B8 format ratio, the maximum compression ratio is 16:1, the minimum compression ratio is 4:1, for reducing the texture of the data capacity has a significant effect, corresponding to the memory bandwidth also has a significant advantage, thereby improving the game's operating efficiency (this feature has no absolute value, varies depending on the usage and bottleneck point of each game).

2.3 OpenGL in related APIs

1) Get the model of the GPU

Glgetstring (Gl_renderer)

2) The manufacturer that obtains the GPU

Glgetstring (Gl_vendor);

3) Get what compression textures the GPU supports

String extensions = (const char*) glgetstring (gl_extensions);

A. Determining whether to support compressed textures in the ETC1 format

Return (Extensions.find ("gl_oes_compressed_etc1_rgb8_texture")! = String::npos);

B. Determine if compression textures are supported in DXT format

Return (Extensions.find ("Gl_ext_texture_compression_dxt1")! = String::npos | |

Extensions.find ("GL_EXT_TEXTURE_COMPRESSION_S3TC")! = String::npos);

C. Determining whether to support compressed textures in the PVRTC format

Return (Extensions.find ("GL_IMG_TEXTURE_COMPRESSION_PVRTC")! = String::npos);

D. Determining whether to support compressed textures in the ATITC format

Return (Extensions.find ("gl_amd_compressed_atc_texture")! = String::npos | |

Extensions.find ("GL_ATI_TEXTURE_COMPRESSION_ATITC")! = String::npos);

4) Fill compressed texture data

void Glcompressedteximage2d (

Glenum Target,

Glint level,

Glenum Internalformat,

Glsizei width,

Glsizei height,

Glint Border,

Glsizei ImageSize,

Const glvoid * data);

The parameters here are not explained in detail, where Internalformat is the type of the compressed texture format.



3. Use of the compressed texture tool
Each compression texture and the corresponding vendor provide a tool for compressing the textures, which are divided into two versions:
A. Visual conversion tool
B. Command-line conversion tool

The usage of each tool is described below.
3.1 Imagination Technologies PowerVR
Tools
Http://www.imgtec.com/powervr/insider/sdkdownloads/index.asp?installer=Windows%20Installer

Visual Conversion Interface

command line conversion scripts
For%%i in (*.TGA) do pvrtextool.exe-f pvrtc4-i%%i
(Convert all TGA files in this directory to a PVR file in "PVRTC4" encoded format without mipmap)
Detailed instructions for use: PvrTexTool.exe/?

3.2 Qualcomm Adreno
Tools
https://developer.qualcomm.com/mobile-development/mobile-technologies/gaming-graphics-optimization-adreno/ Tools-and-resources

Visual Conversion Interface


command line conversion scripts
For%%i in (*.TGA) do QCompressCmd.exe%%i%%i.ktx "ATC RGBA Explicit" Yes
(Convert all TGA files in this catalogue into KTX files in the "ATC RGBA Explicit" encoded format, with mipmap)
Detailed instructions for use: QCompressCmd.exe/?

3.3 ARM Mali
Tools
http://malideveloper.arm.com/develop-for-mali/mali-gpu-texture-compression-tool/

Visual Conversion Interface


command line conversion scripts
For%%i in (*.TGA) do pvrtextool.exe-f etc-i%%i
(Convert all TGA files in this directory into a PVR file in the "ETC" encoded format, without mipmap here or using the PVRTexTool.exe, you can also use QCompressCmd.exe)
Detailed instructions for use: PVRTexTool.exe/?

3.4 NVIDIA Tegra
Can be converted using the DirectX Texture tool that comes with the DirectX SDK
Visual Conversion Interface


command line conversion scripts
For%%i in (*.TGA) do texconv.exe-f DXT5%%i
(Convert all TGA files in this directory to DDS files in "DXT5" encoded format without mipmap)
Detailed instructions for use: TexConv.exe/?


Reference: http://www.cnblogs.com/luming1979/archive/2013/02/04/2891421.html

Mainstream GPU Texture format

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.