In the OpenGL 4.6 specification under section 22.3, a command named glGetInternalformat is described which can be used to gather implementation dependent information about internal formats.
The command have the following signatures listed in the specification:
void GetInternalformativ( enum target, enum internalformat, enum pname, sizei count, int *params );
void GetInternalformati64v( enum target, enum internalformat, enum pname, sizei count, int64 *params );
The valid values for pname according to the specification are:
// Supported operations
GL_CLEAR_BUFFER
GL_CLEAR_TEXTURE
GL_COMPUTE_TEXTURE
GL_FILTER
GL_FRAGMENT_TEXTURE
GL_FRAMEBUFFER_BLEND
GL_FRAMEBUFFER_RENDERABLE
GL_FRAMEBUFFER_RENDERABLE_LAYERED
GL_GEOMETRY_TEXTURE
GL_MANUAL_GENERATE_MIPMAP
GL_READ_PIXELS
GL_SHADER_IMAGE_ATOMIC
GL_SHADER_IMAGE_LOAD
GL_SHADER_IMAGE_STORE
GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST
GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE
GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST
GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE
GL_SRGB_READ
GL_SRGB_WRITE
GL_TESS_CONTROL_TEXTURE
GL_TESS_EVALUATION_TEXTURE
GL_TEXTURE_GATHER
GL_TEXTURE_GATHER_SHADOW
GL_TEXTURE_SHADOW
GL_TEXTURE_VIEW
GL_VERTEX_TEXTURE
// Other
GL_COLOR_COMPONENTS
GL_COLOR_ENCODING
GL_COLOR_RENDERABLE
GL_DEPTH_COMPONENTS
GL_DEPTH_RENDERABLE
GL_GET_TEXTURE_IMAGE_FORMAT
GL_GET_TEXTURE_IMAGE_TYPE
GL_IMAGE_COMPATIBILITY_CLASS
GL_IMAGE_FORMAT_COMPATIBILITY_TYPE
GL_IMAGE_PIXEL_FORMAT
GL_IMAGE_PIXEL_TYPE
GL_IMAGE_TEXEL_SIZE
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_INTERNALFORMAT_SUPPORTED
GL_MAX_COMBINED_DIMENSIONS
GL_MAX_DEPTH
GL_MAX_HEIGHT
GL_MAX_LAYERS
GL_MAX_WIDTH
GL_MIPMAP
GL_NUM_SAMPLE_COUNTS
GL_READ_PIXELS_FORMAT
GL_READ_PIXELS_TYPE
GL_SAMPLES
GL_STENCIL_COMPONENTS
GL_STENCIL_RENDERABLE
GL_TEXTURE_COMPRESSED
GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT
GL_TEXTURE_COMPRESSED_BLOCK_SIZE
GL_TEXTURE_COMPRESSED_BLOCK_WIDTH
GL_TEXTURE_IMAGE_FORMAT
GL_TEXTURE_IMAGE_TYPE
GL_VIEW_COMPATIBILITY_CLASS
My question is if for all those pname values that can be queried, do any of them not require both the target and internalformat parameters? Are there some pnames that will result in the same returned value regardless of which target is used and are there any pnames that return the same value regardless of internalformat? The specification is not clear on this.
The reason I am asking this is because some pnames seems to be information about the internalformat and has nothing to do with the target. I assume that the people behind opengl did not want to create a seperate set of commands for pnames that do not require both target and internalformat and instead used a single set of commands for all cases.
If a list of the pname values for which the target do not matter and a list of pname values for which the internalformat do not matter (if there are any) could be created and these lists are guaranteed to be the same on all platforms, then one could simply wrap the command and hard code a constant value for those arguments and remove the need for those parameters. This would simplify the gathering of information on internalformats and targets (if there are any target specific information).
The standard makes it pretty clear which things care about the target
and which do not. It describes how each pname
query works and it uses specific keywords in those descriptions. Specifically, it says this up-front:
In the following descriptions, the term resource is used to generically refer to an object of the appropriate type that has been created with internalformat and target.
So, if the description for a query does not use the words "target" or "resource", then it doesn't care about them.