GLAPI/glGetInternalformat

From OpenGL.org
< GLAPI(Redirected from GlGetInternalformat)
Jump to: navigation, search
glGetInternalformativ
Core in version 4.4
Core since version 4.2
Core ARB extension ARB_internalformat_query

glGetInternalformativ: retrieve information about implementation-dependent support for internal formats

Function Definition

 void glGetInternalformativ(GLenum target​, GLenum internalformat​, GLenum pname​, GLsizei bufSize​, GLint *params​);
 void glGetInternalformati64v(GLenum target​, GLenum internalformat​, GLenum pname​, GLsizei bufSize​, GLint64 *params​);
target
Indicates the usage of the internal format. target​ must be GL_TEXTURE_1D​, GL_TEXTURE_1D_ARRAY​, GL_TEXTURE_2D​, GL_TEXTURE_2D_ARRAY​, GL_TEXTURE_3D​, GL_TEXTURE_CUBE_MAP​, GL_TEXTURE_CUBE_MAP_ARRAY​, GL_TEXTURE_RECTANGLE​, GL_TEXTURE_BUFFER​, GL_RENDERBUFFER​, GL_TEXTURE_2D_MULTISAMPLE​ or GL_TEXTURE_2D_MULTISAMPLE_ARRAY​.
internalformat
Specifies the internal format about which to retrieve information.
pname
Specifies the type of information to query.
bufSize
Specifies the maximum number of basic machine units that may be written to params​ by the function.
params
Specifies the address of a variable into which to write the retrieved information.

Description

glGetInternalformativ and glGetInternalformati64v retrieve information about implementation-dependent support for internal formats. target​ indicates the target with which the internal format will be used and must be one of GL_RENDERBUFFER​, GL_TEXTURE_2D_MULTISAMPLE​, or GL_TEXTURE_2D_MULTISAMPLE_ARRAY​, corresponding to usage as a renderbuffer, two-dimensional multisample texture or two-dimensional multisample array texture, respectively.

internalformat​ specifies the internal format about which to retrieve information and must be a color-renderable, depth-renderable or stencil-renderable format.

The information retrieved will be written to memory addressed by the pointer specified in params​. No more than bufSize​ basic machine units will be written to this memory.

The possible values for pname​, and the associated value(s) copied into params​ are:

GL_NUM_SAMPLE_COUNTS​
The number of sample counts that would be returned by querying GL_SAMPLES​.
GL_SAMPLES​
The sample counts supported for internalformat​ and target​ are written into params​ in descending numeric order. Only positive values are returned. Querying GL_SAMPLES​ with bufSize​ of one will return just the maximum supported number of samples for this format. The maximum value in GL_SAMPLES​ is guaranteed to be at least the lowest of the following: * The value of GL_MAX_INTEGER_SAMPLES​ if internalformat​ is a signed or unsigned integer format.* The value of GL_MAX_DEPTH_TEXTURE_SAMPLES​ if internalformat​ is a depth- or stencil-renderable format and target​ is GL_TEXTURE_2D_MULTISAMPLE​, GL_TEXTURE_2D_MULTISAMPLE_ARRAY​.* The value of GL_MAX_COLOR_TEXTURE_SAMPLES​ if internalformat​ is a color-renderable format and target​ is GL_TEXTURE_2D_MULTISAMPLE​ or GL_TEXTURE_2D_MULTISAMPLE_ARRAY​.* The value of GL_MAX_SAMPLES​.
GL_INTERNALFORMAT_SUPPORTED​
GL_TRUE​ if internalFormat​ is a supported internal format for target​ and to GL_FALSE​ otherwise. "Supported" in this case only means that the internal format is one of the sized internal formats. It has nothing to do with hardware support.
GL_INTERNALFORMAT_PREFERRED​
The internal format that the implementation will actually use when given internalformat​.
GL_INTERNALFORMAT_RED_SIZE​, GL_INTERNALFORMAT_GREEN_SIZE​, GL_INTERNALFORMAT_BLUE_SIZE​, GL_INTERNALFORMAT_ALPHA_SIZE​, GL_INTERNALFORMAT_DEPTH_SIZE​, GL_INTERNALFORMAT_STENCIL_SIZE​, or GL_INTERNALFORMAT_SHARED_SIZE​
The actual resolutions that would be used for storing image array components for the resource for the red, green, blue, alpha, depth, stencil and shared channels respectively. If internalFormat​ is a compressed internal format, then params​ is set to the component resolution of an uncompressed internal format that produces an image of roughly the same quality as the compressed algorithm. If the internal format is unsupported, or if a particular component is not present in the format, 0 is written to params​.
GL_INTERNALFORMAT_RED_TYPE​, GL_INTERNALFORMAT_GREEN_TYPE​, GL_INTERNALFORMAT_BLUE_TYPE​, GL_INTERNALFORMAT_ALPHA_TYPE​, GL_INTERNALFORMAT_DEPTH_TYPE​, or GL_INTERNALFORMAT_STENCIL_TYPE​
A token identifying the data type used to store the respective component. If the internalFormat​ represents a compressed internal format then the types returned specify how components are interpreted after decompression.
GL_MAX_WIDTH​, GL_MAX_HEIGHT​, GL_MAX_DEPTH​, or GL_MAX_LAYERS​
The maximum width, height, depth or layer count, for textures with internal format internalFormat​, respectively.
GL_MAX_COMBINED_DIMENSIONS​
The maximum combined dimensions for the internal format. The combined dimensions is the product of the individual dimensions of the resource. For multisampled surfaces the number of samples is considered an additional dimension. Note that the value returned can be >= 2^32 and should be queried with the 64-bit query. This value should be considered a recommendations for applications. There may be system-dependant reasons why allocations larger than this size may fail, even if there might appear to be sufficient memory available when queried via some other means. This also does not provide a guarantee that allocations smaller than this will succeed because this value is not affected by existing resource allocations.
GL_COLOR_COMPONENTS​
GL_TRUE​ if the internal format contains any color component (i.e., red, green, blue or alpha) and to GL_FALSE​ otherwise.
GL_DEPTH_COMPONENTS​ or GL_STENCIL_COMPONENTS​
GL_TRUE​ if the internal format contains a depth or stencil component, respectively, and to GL_FALSE​ otherwise.
GL_COLOR_RENDERABLE​, GL_DEPTH_RENDERABLE​ or GL_STENCIL_RENDERABLE​
GL_TRUE​ if the specified internal format is color, depth or stencil renderable, respectively, and to GL_FALSE​ otherwise.
GL_FRAMEBUFFER_RENDERABLE​ or GL_FRAMEBUFFER_RENDERABLE_LAYERED​
GL_FULL_SUPPORT​, GL_CAVEAT_SUPPORT​ or GL_NONE​ to indicate that framebuffer attachments (layered attachments in the case of GL_FRAMEBUFFER_RENDERABLE_LAYERED​) with that internal format are either renderable with no restrictions, renderable with some restrictions or not renderable at all.
GL_FRAMEBUFFER_BLEND​
GL_TRUE​ to indicate that the internal format is supported for blending operations when attached to a framebuffer, and to GL_FALSE​ otherwise.
GL_READ_PIXELS​
GL_FULL_SUPPORT​, GL_CAVEAT_SUPPORT​ or GL_NONE​ to that either full support, limited support or no support at all is supplied for reading pixels from framebuffer attachments in the specified internal format.
GL_READ_PIXELS_FORMAT​ or GL_READ_PIXELS_TYPE​
the implementation-recommended format or type to be used in calls to glReadPixels. For GL_READ_PIXELS_FORMAT​, the value returned in params​ is a token that is accepted for the format​ argument to glReadPixels. For GL_READ_PIXELS_TYPE​, the value returned in params​ is a token that is accepted for the type​ argument to glReadPixels.
GL_TEXTURE_IMAGE_FORMAT​ or GL_TEXTURE_IMAGE_TYPE​
The implementation-recommended format or type to be used in calls to glTexImage2D and other similar functions. For GL_TEXTURE_IMAGE_FORMAT​, params​ is filled with a token suitable for use as the format​ argument to glTexImage2D. For GL_TEXTURE_IMAGE_TYPE​, params​ is filled with a token suitable for use as the type​ argument to glTexImage2D.
GL_GET_TEXTURE_IMAGE_FORMAT​ or GL_GET_TEXTURE_IMAGE_TYPE​
The implementation-recommended format or type to be used in calls to glGetTexImage and other similar functions. For GL_GET_TEXTURE_IMAGE_FORMAT​, params​ is filled with a token suitable for use as the format​ argument to glGetTexImage. For GL_GET_TEXTURE_IMAGE_TYPE​, params​ is filled with a token suitable for use as the type​ argument to glGetTexImage.
GL_MIPMAP​
GL_TRUE​ if the specified internal format supports mipmaps and to GL_FALSE​ otherwise.
GL_MANUAL_GENERATE_MIPMAP​
The level of support for manual generation for the specified internal format, respectively. Returned values may be one of GL_FULL_SUPPORT​, GL_CAVEAT_SUPPORT​ and GL_NONE​ to indicate either full support, limited support or no support at all.
GL_AUTO_GENERATE_MIPMAP​
Returns GL_NONE​, because core profile OpenGL does not support auto-generated mipmaps.
GL_COLOR_ENCODING​
The color encoding for the resource. Possible values for color buffers are GL_LINEAR​ or GL_SRGB​, for linear or sRGB-encoded color components, respectively. For non-color formats (such as depth or stencil), or for unsupported resources, the value GL_NONE​ is returned.
GL_SRGB_READ​, or GL_SRGB_WRITE​
The level of support for reading and writing to sRGB encoded images, respectively. For GL_SRGB_READ​, support for converting from sRGB colorspace on read operations is returned in params​ and for GL_SRGB_WRITE​, support for converting to sRGB colorspace on write operations to the resource is returned in params​. params​ may be set to GL_FULL_SUPPORT​, GL_CAVEAT_SUPPORT​, or GL_NONE​ to indicate full support, limited support or no support at all, respectively.
GL_FILTER​
GL_TRUE​ or GL_FALSE​ to indicate support or lack thereof for filter modes other than GL_NEAREST​ or GL_NEAREST_MIPMAP​ for the specified internal format.
GL_VERTEX_TEXTURE​, GL_TESS_CONTROL_TEXTURE​, GL_TESS_EVALUATION_TEXTURE​, GL_GEOMETRY_TEXTURE​, GL_FRAGMENT_TEXTURE​, or GL_COMPUTE_TEXTURE​
The level of support for use of the resource as a source of texturing in the vertex, tessellation control, tessellation evaluation, geometry, fragment and compute shader stages, respectively. params​ may be set to GL_FULL_SUPPORT​, GL_CAVEAT_SUPPORT​ or GL_NONE​ to indicate full support, limited support or no support at all, respectively.
GL_TEXTURE_SHADOW​, GL_TEXTURE_GATHER​ or GL_TEXTURE_GATHER_SHADOW​
The level of support for using the resource with a shadow sampler, in gather operations or as a shadow sampler in gather operations, respectively. Returned values may be GL_FULL_SUPPORT​, GL_CAVEAT_SUPPORT​ or GL_NONE​ to indicate full support, limited support or no support at all, respectively.
GL_SHADER_IMAGE_LOAD​, GL_SHADER_IMAGE_STORE​ or GL_SHADER_IMAGE_ATOMIC​
The level of support for image loads, stores and atomics for resources of the specified internal format. Returned values may be GL_FULL_SUPPORT​, GL_CAVEAT_SUPPORT​ or GL_NONE​ to indicate full support, limited support or no support at all, respectively.
GL_IMAGE_TEXEL_SIZE​
The size of a texel when the resource when used as an image texture. If the resource is not supported for image textures zero is returned.
GL_IMAGE_COMPATIBILITY_CLASS​
The compatibility class of the resource when used as an image texture. The possible values returned are GL_IMAGE_CLASS_4_X_32​, GL_IMAGE_CLASS_2_X_32​, GL_IMAGE_CLASS_1_X_32​, GL_IMAGE_CLASS_4_X_16​, GL_IMAGE_CLASS_2_X_16​, GL_IMAGE_CLASS_1_X_16​, GL_IMAGE_CLASS_4_X_8​, GL_IMAGE_CLASS_2_X_8​, GL_IMAGE_CLASS_1_X_8​, GL_IMAGE_CLASS_11_11_10​, and GL_IMAGE_CLASS_10_10_10_2​, which correspond to the 4x32, 2x32, 1x32, 4x16, 2x16, 1x16, 4x8, 2x8, 1x8, the class (a) 11/11/10 packed floating-point format, and the class (b) 10/10/10/2 packed formats, respectively. If the resource is not supported for image textures, GL_NONE​ is returned.
GL_IMAGE_PIXEL_FORMAT​ or GL_IMAGE_PIXEL_TYPE​
The pixel format or type of the resource respectively when used as an image texture. In either case, if the resource is not supported for image textures, GL_NONE​ is returned.
GL_IMAGE_FORMAT_COMPATIBILITY_TYPE​
The matching criteria use for the resource when used as an image textures. Possible values are GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE​ or GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS​. If the resource is not supported for image textures, GL_NONE​ is returned.
GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST​ or GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST​
Support for using the resource both as a source for texture sampling while it is bound as a buffer for depth or stencil test, respectively. Possible values returned are GL_FULL_SUPPORT​, GL_CAVEAT_SUPPORT​, or GL_NONE​ to indicate full support, limited support or no support at all. If the resource or operation is not supported, GL_NONE​ is returned.
GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE​ or GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE​
Support for using the resource both as a source for texture sampling while performing depth or stencil writes to the resources, respectively. Possible values returned are GL_FULL_SUPPORT​, GL_CAVEAT_SUPPORT​, or GL_NONE​ to indicate full support, limited support or no support at all. If the resource or operation is not supported, GL_NONE​ is returned.
GL_TEXTURE_COMPRESSED​
GL_TRUE​ if internalformat​ is a compressed internal format. GL_FALSE​ otherwise.
GL_TEXTURE_COMPRESSED_BLOCK_WIDTH​, GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT​ or GL_TEXTURE_COMPRESSED_BLOCK_SIZE​
The width, height or total size, respectively of a block (in basic machine units). If the internal format is not compressed, or the resource is not supported, 0 is returned.
GL_CLEAR_BUFFER​
The level of support for using the resource with glClearBufferData and glClearBufferSubData. Possible values returned are GL_FULL_SUPPORT​, GL_CAVEAT_SUPPORT​, or GL_NONE​ to indicate full support, limited support or no support at all, respectively. If the resource or operation is not supported, GL_NONE​ is returned.
GL_TEXTURE_VIEW​
The level of support for using the resource with the glTextureView command. Possible values returned are GL_FULL_SUPPORT​, GL_CAVEAT_SUPPORT​, or GL_NONE​ to indicate full support, limited support or no support at all, respectively. If the resource or operation is not supported, GL_NONE​ is returned.
GL_VIEW_COMPATIBILITY_CLASS​
the compatibility class of the resource when used as a texture view. The possible values returned are GL_VIEW_CLASS_128_BITS​, GL_VIEW_CLASS_96_BITS​, GL_VIEW_CLASS_64_BITS​, GL_VIEW_CLASS_48_BITS​, GL_VIEW_CLASS_32_BITS​, GL_VIEW_CLASS_24_BITS​, GL_VIEW_CLASS_16_BITS​, GL_VIEW_CLASS_8_BITS​, GL_VIEW_CLASS_S3TC_DXT1_RGB​, GL_VIEW_CLASS_S3TC_DXT1_RGBA​, GL_VIEW_CLASS_S3TC_DXT3_RGBA​, GL_VIEW_CLASS_S3TC_DXT5_RGBA​, GL_VIEW_CLASS_RGTC1_RED​, GL_VIEW_CLASS_RGTC2_RG​, GL_VIEW_CLASS_BPTC_UNORM​, and GL_VIEW_CLASS_BPTC_FLOAT​.

If pname​ is GL_CLEAR_TEXTURE​ then the presence of support for using the glClearTexImage and glClearTexSubImage commands with the resource is written to params​. Possible values written are GL_FULL_SUPPORT​, GL_CAVEAT_SUPPORT​, or GL_NONE​ to indicate full support, limited support or no support at all, respectively. If the resource or operation is not supported, GL_NONE​ is returned.

Notes

glGetInternalformativ is available only if the GL version is 4.2 or higher.

The tokens GL_INTERNALFORMAT_SUPPORTED​, GL_INTERNALFORMAT_PREFERRED​, GL_INTERNALFORMAT_RED_SIZE​, GL_INTERNALFORMAT_GREEN_SIZE​, GL_INTERNALFORMAT_BLUE_SIZE​, GL_INTERNALFORMAT_ALPHA_SIZE​, GL_INTERNALFORMAT_DEPTH_SIZE​, GL_INTERNALFORMAT_STENCIL_SIZE​, GL_INTERNALFORMAT_SHARED_SIZE​, GL_INTERNALFORMAT_RED_TYPE​, GL_INTERNALFORMAT_GREEN_TYPE​, GL_INTERNALFORMAT_BLUE_TYPE​, GL_INTERNALFORMAT_ALPHA_TYPE​, GL_INTERNALFORMAT_DEPTH_TYPE​, GL_INTERNALFORMAT_STENCIL_TYPE​, GL_MAX_WIDTH​, GL_MAX_HEIGHT​, GL_MAX_DEPTH​, GL_MAX_LAYERS​, GL_MAX_COMBINED_DIMENSIONS​, GL_COLOR_COMPONENTS​, GL_DEPTH_COMPONENTS​, GL_STENCIL_COMPONENTS​, GL_COLOR_RENDERABLE​, GL_DEPTH_RENDERABLE​, GL_STENCIL_RENDERABLE​, GL_FRAMEBUFFER_RENDERABLE​, GL_FRAMEBUFFER_RENDERABLE_LAYERED​, GL_FRAMEBUFFER_BLEND​, GL_READ_PIXELS​, GL_READ_PIXELS_FORMAT​, GL_READ_PIXELS_TYPE​, GL_TEXTURE_IMAGE_FORMAT​, GL_TEXTURE_IMAGE_TYPE​, GL_GET_TEXTURE_IMAGE_FORMAT​, GL_GET_TEXTURE_IMAGE_TYPE​, GL_MIPMAP​, GL_GENERATE_MIPMAP​, GL_AUTO_GENERATE_MIPMAP​, GL_COLOR_ENCODING​, GL_SRGB_READ​, GL_SRGB_WRITE​, GL_SRGB_DECODE_ARB​, GL_FILTER​, GL_VERTEX_TEXTURE​, GL_TESS_CONTROL_TEXTURE​, GL_TESS_EVALUATION_TEXTURE​, GL_GEOMETRY_TEXTURE​, GL_FRAGMENT_TEXTURE​, GL_COMPUTE_TEXTURE​, GL_TEXTURE_SHADOW​, GL_TEXTURE_GATHER​, GL_TEXTURE_GATHER_SHADOW​, GL_SHADER_IMAGE_LOAD​, GL_SHADER_IMAGE_STORE​, GL_SHADER_IMAGE_ATOMIC​, GL_IMAGE_TEXEL_SIZE​, GL_IMAGE_COMPATIBILITY_CLASS​, GL_IMAGE_PIXEL_FORMAT​, GL_IMAGE_PIXEL_TYPE​, GL_IMAGE_FORMAT_COMPATIBILITY_TYPE​, GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST​, GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST​, GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE​, GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE​, GL_TEXTURE_COMPRESSED​, GL_TEXTURE_COMPRESSED_BLOCK_WIDTH​, GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT​, GL_TEXTURE_COMPRESSED_BLOCK_SIZE​, GL_CLEAR_BUFFER​, GL_TEXTURE_VIEW​, and GL_VIEW_COMPATIBILITY_CLASS​ are supported only if the GL version is 4.3 or higher.

The GL_CLEAR_TEXTURE​ token is accepted for pname​ only if the GL version is 4.4 or higher.

Errors

GL_INVALID_VALUE​ is generated if bufSize​ is negative.

GL_INVALID_ENUM​ is generated if pname​ is not GL_SAMPLES​ or GL_NUM_SAMPLE_COUNTS​.

GL_INVALID_ENUM​ is generated if internalformat​ is not color-, depth-, or stencil-renderable.

GL_INVALID_ENUM​ is generated if target​ is not one of GL_TEXTURE_2D_MULTISAMPLE​, GL_TEXTURE_2D_MULTISAMPLE_ARRAY​ or GL_RENDERBUFFER​.

See Also

glGet

Copyright

Copyright © 2011-2013 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.