Graphics Reference
In-Depth Information
Immutable Textures
Another feature introduced in OpenGL ES 3.0 to help improve application
performance is immutable textures . As discussed earlier in this chapter, an
application specifies each mipmap level of a texture independently using
functions such as glTexImage2D and glTexImage3D . The problem this
creates for the OpenGL ES driver is that it cannot determine until draw time
whether a texture has been fully specified. That is, it has to check whether
each mipmap level or subimage has matching formats, whether each level has
the correct dimensions, and whether there is sufficient memory. This draw
time check can be costly and can be avoided by using immutable textures.
The idea behind immutable textures is simple: The application specifies the
format and size of a texture before loading it with data. In doing so, the
texture format becomes immutable and the OpenGL ES driver can perform
all consistency and memory checks up-front. Once a texture has become
immutable, its format and dimensions cannot change. However, the
application can still load it with image data by using glTexSubImage2D ,
glTexSubImage3D , or glGenerateMipMap , or by rendering to the texture.
To create an immutable texture, an application would bind the texture
using glBindTexture and then allocate its immutable storage using
glTexStorage2D or glTexStorage3D .
void glTexStorage2D (GLenum target, GLsizei levels,
GLenum internalFormat, GLsizei width,
GLsizei height )
void glTexStorage3D (GLenum target, GLsizei levels,
GLenum internalFormat, GLsizei width,
GLsizei height, GLsizei depth )
target specifies the texture target, either GL_TEXTURE_2D or
one of the cubemap face targets
(GL_TEXTURE_CUBE_MAP_POSITIVE_X ,
GL_TEXTURE_CUBE_MAP_NEGATIVE_X, and so on ) for
glTexStorage2D , or GL_TEXTURE_3D or
GL_TEXTURE_2D_ARRAY for glTexStorage3D
levels specifies the number of mipmap levels
internalFormat the sized internal format for the texture storage;
the full list of valid internalFormat values is the
same as the valid sized internalFormat values for
glTexImage2D provided in the Texture Objects and
Loading Textures section earlier in this chapter.
 
 
 
Search WWH ::




Custom Search