table of contents
GLGETPROGRAMRESOURCE(3G) | OpenGL Manual | GLGETPROGRAMRESOURCE(3G) |
NAME¶
glGetProgramResource - retrieve values for multiple properties of a single active resource within a program object
C SPECIFICATION¶
void glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const Glenum * props, GLsizei bufSize, GLsizei * length, GLint * params);
PARAMETERS¶
program
programInterface
DESCRIPTION¶
glGetProgramResourceiv returns values for multiple properties of a single active resource with an index of index in the interface programInterface of program object program. For each resource, values for propCount properties specified by the array props are returned. propCount may not be zero. An error is generated if any value in props is not one of the properties described immediately belowor if any value in props is not allowed for programInterface. The set of allowed programInterface values for each property can be found in the following table:
Property | Supported Interfaces |
GL_NAME_LENGTH | Any except GL_ATOMIC_COUNTER_BUFFER |
GL_TYPE | GL_UNIFORM, GL_PROGRAM_INPUT, GL_PROGRAM_OUTPUT, GL_TRANSFORM_FEEDBACK_VARYING, GL_BUFFER_VARIABLE |
GL_ARRAY_SIZE | GL_UNIFORM, GL_BUFFER_VARIABLE, GL_PROGRAM_INPUT, GL_PROGRAM_OUTPUT, VERTEX_SUBROUTINE_UNIFORM, GL_TESS_CONTROL_SUBROUTINE_UNIFORM, GL_TESS_EVALUATION_SUBROUTINE_UNIFORM, GL_GEOMETRY_SUBROUTINE_UNIFORM, GL_FRAGMENT_SUBROUTINE_UNIFORM, GL_COMPUTE_SUBROUTINE_UNIFORM, GL_TRANSFORM_FEEDBACK_VARYING |
GL_OFFSET | GL_UNIFORM, GL_BUFFER_VARIABLE |
GL_BLOCK_INDEX | GL_UNIFORM, GL_BUFFER_VARIABLE |
GL_ARRAY_STRIDE | GL_UNIFORM, GL_BUFFER_VARIABLE |
GL_MATRIX_STRIDE | GL_UNIFORM, GL_BUFFER_VARIABLE |
GL_IS_ROW_MAJOR | GL_UNIFORM, GL_BUFFER_VARIABLE |
GL_ATOMIC_COUNTER_BUFFER_INDEX | GL_UNIFORM |
GL_TEXTURE_BUFFER | <emph>none</emph> |
GL_BUFFER_BINDING | GL_UNIFORM_BLOCK, GL_ATOMIC_COUNTER_BUFFER, GL_SHADER_STORAGE_BLOCK |
GL_BUFFER_DATA_SIZE | GL_UNIFORM_BLOCK, GL_ATOMIC_COUNTER_BUFFER, GL_SHADER_STORAGE_BLOCK |
GL_NUM_ACTIVE_VARIABLES | GL_UNIFORM_BLOCK, GL_ATOMIC_COUNTER_BUFFER, GL_SHADER_STORAGE_BLOCK |
GL_ACTIVE_VARIABLES | GL_UNIFORM_BLOCK, GL_ATOMIC_COUNTER_BUFFER, GL_SHADER_STORAGE_BLOCK |
GL_REFERENCED_BY_VERTEX_SHADER | GL_UNIFORM, GL_UNIFORM_BLOCK, GL_ATOMIC_COUNTER_SHADER, GL_BUFFER, GL_SHADER_STORAGE_BLOCK, GL_BUFFER_VARIABLE, GL_PROGRAM_INPUT, GL_PROGRAM_OUTPUT |
GL_REFERENCED_BY_TESS_CONTROL_SHADER | GL_UNIFORM, GL_UNIFORM_BLOCK, GL_ATOMIC_COUNTER_SHADER, GL_BUFFER, GL_SHADER_STORAGE_BLOCK, GL_BUFFER_VARIABLE, GL_PROGRAM_INPUT, GL_PROGRAM_OUTPUT |
GL_REFERENCED_BY_TESS_EVALUATION_SHADER | GL_UNIFORM, GL_UNIFORM_BLOCK, GL_ATOMIC_COUNTER_SHADER, GL_BUFFER, GL_SHADER_STORAGE_BLOCK, GL_BUFFER_VARIABLE, GL_PROGRAM_INPUT, GL_PROGRAM_OUTPUT |
GL_REFERENCED_BY_GEOMETRY_SHADER | GL_UNIFORM, GL_UNIFORM_BLOCK, GL_ATOMIC_COUNTER_SHADER, GL_BUFFER, GL_SHADER_STORAGE_BLOCK, GL_BUFFER_VARIABLE, GL_PROGRAM_INPUT, GL_PROGRAM_OUTPUT |
GL_REFERENCED_BY_FRAGMENT_SHADER | GL_UNIFORM, GL_UNIFORM_BLOCK, GL_ATOMIC_COUNTER_SHADER, GL_BUFFER, GL_SHADER_STORAGE_BLOCK, GL_BUFFER_VARIABLE, GL_PROGRAM_INPUT, GL_PROGRAM_OUTPUT |
GL_REFERENCED_BY_COMPUTE_SHADER | GL_UNIFORM, GL_UNIFORM_BLOCK, GL_ATOMIC_COUNTER_SHADER, GL_BUFFER, GL_SHADER_STORAGE_BLOCK, GL_BUFFER_VARIABLE, GL_PROGRAM_INPUT, GL_PROGRAM_OUTPUT |
GL_NUM_COMPATIBLE_SUBROUTINES | GL_VERTEX_SUBROUTINE_UNIFORM, GL_TESS_CONTROL_SUBROUTINE_UNIFORM, GL_TESS_EVALUATION_SUBROUTINE_UNIFORM, GL_GEOMETRY_SUBROUTINE_UNIFORM, GL_FRAGMENT_SUBROUTINE_UNIFORM, GL_COMPUTE_SUBROUTINE_UNIFORM |
GL_COMPATIBLE_SUBROUTINES | GL_VERTEX_SUBROUTINE_UNIFORM, GL_TESS_CONTROL_SUBROUTINE_UNIFORM, GL_TESS_EVALUATION_SUBROUTINE_UNIFORM, GL_GEOMETRY_SUBROUTINE_UNIFORM, GL_FRAGMENT_SUBROUTINE_UNIFORM, GL_COMPUTE_SUBROUTINE_UNIFORM |
GL_TOP_LEVEL_ARRAY_SIZE | GL_BUFFER_VARIABLE |
GL_TOP_LEVEL_ARRAY_STRIDE | GL_BUFFER_VARIABLE |
GL_LOCATION | GL_UNIFORM, GL_PROGRAM_INPUT, GL_PROGRAM_OUTPUT, GL_VERTEX_SUBROUTINE_UNIFORM, GL_TESS_CONTROL_SUBROUTINE_UNIFORM, GL_TESS_EVALUATION_SUBROUTINE_UNIFORM, GL_GEOMETRY_SUBROUTINE_UNIFORM, GL_FRAGMENT_SUBROUTINE_UNIFORM, GL_COMPUTE_SUBROUTINE_UNIFORM |
GL_LOCATION_INDEX | GL_PROGRAM_OUTPUT |
GL_IS_PER_PATCH | GL_PROGRAM_INPUT, GL_PROGRAM_OUTPUT |
For the property GL_NAME_LENGTH, a single integer identifying the length of the name string associated with an active variable, interface block, or subroutine is written to params. The name length includes a terminating null character. For the property GL_TYPE, a single integer identifying the type of an active variable is written to params. The integer returned is one of the values found in table 2.16. For the property GL_ARRAY_SIZE, a single integer identifying the number of active array elements of an active variable is written to params. The array size returned is in units of the type associated with the property TYPE. For active variables not corresponding to an array of basic types, the value zero is written to params. For the property GL_BLOCK_INDEX, a single integer identifying the index of the active interface block containing an active variable is written to params. If the variable is not the member of an interface block, the value -1 is written to params. For the property GL_OFFSET, a single integer identifying the offset of an active variable is written to params. For active variables backed by a buffer object, the value written is the offset, in basic machine units, relative to the base of buffer range holding the values of the variable. For active variables not backed by a buffer object, an offset of -1 is written to params. For the property GL_ARRAY_STRIDE, a single integer identifying the stride between array elements in an active variable is written to params. For active variables declared as an array of basic types, the value written is the difference, in basic machine units, between the offsets of consecutive elements in an array. For active variables not declared as an array of basic types, zero is written to params. For active variables not backed by a buffer object, -1 is written to params, regardless of the variable type. For the property GL_MATRIX_STRIDE, a single integer identifying the stride between columns of a column-major matrix or rows of a row-major matrix is written to params. For active variables declared a single matrix or array of matrices, the value written is the difference, in basic machine units, between the offsets of consecutive columns or rows in each matrix. For active variables not declared as a matrix or array of matrices, zero is written to params. For active variables not backed by a buffer object, -1 is written to params, regardless of the variable type. For the property GL_IS_ROW_MAJOR, a single integer identifying whether an active variable is a row-major matrix is written to params. For active variables backed by a buffer object, declared as a single matrix or array of matrices, and stored in row-major order, one is written to params. For all other active variables, zero is written to params. For the property GL_ATOMIC_COUNTER_BUFFER_INDEX, a single integer identifying the index of the active atomic counter buffer containing an active variable is written to params. If the variable is not an atomic counter uniform, the value -1 is written to params. For the property GL_BUFFER_BINDING, to index of the buffer binding point associated with the active uniform block, shader storage block, or atomic counter buffer is written to params. For the property GL_BUFFER_DATA_SIZE, then the implementation-dependent minimum total buffer object size, in basic machine units, required to hold all active variables associated with an active uniform block, shader storage block, or atomic counter buffer is written to params. If the final member of an active shader storage block is array with no declared size, the minimum buffer size is computed assuming the array was declared as an array with one element. For the property GL_NUM_ACTIVE_VARIABLES, the number of active variables associated with an active uniform block, shader storage block, or atomic counter buffer is written to params. For the property GL_of ACTIVE_VARIABLES, an array of active variable indices associated with an active uniform block, shader storage block, or atomic counter buffer is written to params. The number of values written to params for an active resource is given by the value of the property GL_NUM_ACTIVE_VARIABLES for the resource. For the properties GL_REFERENCED_BY_VERTEX_SHADER, GL_REFERENCED_BY_TESS_CONTROL_SHADER, GL_REFERENCED_BY_TESS_EVALUATION_SHADER, GL_REFERENCED_BY_GEOMETRY_SHADER, GL_REFERENCED_BY_FRAGMENT_SHADER, and GL_REFERENCED_BY_COMPUTE_SHADER, a single integer is written to params, identifying whether the active resource is referenced by the vertex, tessellation control, tessellation evaluation, geometry, or fragment shaders, respectively, in the program object. The value one is written to params if an active variable is referenced by the corresponding shader, or if an active uniform block, shader storage block, or atomic counter buffer contains at least one variable referenced by the corresponding shader. Otherwise, the value zero is written to params. For the property GL_TOP_LEVEL_ARRAY_SIZE, a single integer identifying the number of active array elements of the top-level shader storage block member containing to the active variable is written to params. If the top-level block member is not declared as an array, the value one is written to params. If the top-level block member is an array with no declared size, the value zero is written to params. For the property GL_TOP_LEVEL_ARRAY_STRIDE, a single integer identifying the stride between array elements of the top-level shader storage block member containing the active variable is written to params. For top-level block members declared as arrays, the value written is the difference, in basic machine units, between the offsets of the active variable for consecutive elements in the top-level array. For top-level block members not declared as an array, zero is written to params. For the property GL_LOCATION, a single integer identifying the assigned location for an active uniform, input, output, or subroutine uniform variable is written to params. For input, output, or uniform variables with locations specified by a layout qualifier, the specified location is used. For vertex shader input or fragment shader output variables without a layout qualifier, the location assigned when a program is linked is written to params. For all other input and output variables, the value -1 is written to params. For uniforms in uniform blocks, the value -1 is written to params. For the property GL_LOCATION_INDEX, a single integer identifying the fragment color index of an active fragment shader output variable is written to params. If the active variable is an output for a non-fragment shader, the value -1 will be written to params. For the property GL_IS_PER_PATCH, a single integer identifying whether the input or output is a per-patch attribute. If the active variable is a per-patch attribute (declared with the patch qualifier), the value one is written to params; otherwise, the value zero is written to params.
ERRORS¶
GL_INVALID_VALUE is generated if program is not the name of an existing program object.
GL_INVALID_VALUE is generated if propCount is zero.
GL_INVALID_ENUM is generated if programInterface is not one of the accepted interface types.
GL_INVLALID_ENUM is generated if any value in props is not one of the accepted tokens for the interface programInterface
SEE ALSO¶
glGetProgramResourceName(), glGetGetProgramResourceIndex(), glGetProgramResourceLocation(), glGetProgramResourceLocationIndex().
COPYRIGHT¶
Copyright © 2012 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/.
AUTHORS¶
opengl.org
05/02/2014 | opengl.org |