<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
<!-- saved from url=(0013)about:internet -->
<?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="stylesheet" type="text/css" href="opengl-man.css" /><title>glGetProgramResource - OpenGL 4 Reference Pages</title><meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glGetProgramResource"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glGetProgramResource — retrieve values for multiple properties of a single active resource within a program object</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glGetProgramResourceiv</b>(</code></td><td>GLuint  </td><td><var class="pdparam">program</var>, </td></tr><tr><td> </td><td>GLenum  </td><td><var class="pdparam">programInterface</var>, </td></tr><tr><td> </td><td>GLuint  </td><td><var class="pdparam">index</var>, </td></tr><tr><td> </td><td>GLsizei  </td><td><var class="pdparam">propCount</var>, </td></tr><tr><td> </td><td>const Glenum *  </td><td><var class="pdparam">props</var>, </td></tr><tr><td> </td><td>GLsizei  </td><td><var class="pdparam">bufSize</var>, </td></tr><tr><td> </td><td>GLsizei *  </td><td><var class="pdparam">length</var>, </td></tr><tr><td> </td><td>GLint *  </td><td><var class="pdparam">params</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>program</code></em></span></dt><dd><p>
                    The name of a program object whose resources to query.
                </p></dd><dt><span class="term"><em class="parameter"><code>programInterface</code></em></span></dt><dd><p>
                    A token identifying the interface within <em class="parameter"><code>program</code></em> containing the resource named <em class="parameter"><code>name</code></em>.
                </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
            <code class="function">glGetProgramResourceiv</code> returns values for multiple properties of a single active resource with an
            index of <em class="parameter"><code>index</code></em> in the interface <em class="parameter"><code>programInterface</code></em> of program object
            <em class="parameter"><code>program</code></em>.  For each resource, values for <em class="parameter"><code>propCount</code></em> properties specified
            by the array <em class="parameter"><code>props</code></em> are returned.  <em class="parameter"><code>propCount</code></em> may not be zero.
            An error is generated if any value
            in <em class="parameter"><code>props</code></em> is not one of the properties described immediately belowor if any value in <em class="parameter"><code>props</code></em> is not
            allowed for <em class="parameter"><code>programInterface</code></em>.  The set of allowed <em class="parameter"><code>programInterface</code></em>
            values for each property can be found in the following table:
        </p><div class="informaltable"><table border="1"><colgroup><col align="left" /><col align="left" /></colgroup><thead><tr><th rowspan="2" align="center">Property</th><th rowspan="2" align="center">Supported Interfaces</th></tr></thead><tbody><tr><td align="left"><code class="constant">GL_NAME_LENGTH</code></td><td align="left">Any except <code class="constant">GL_ATOMIC_COUNTER_BUFFER</code></td></tr><tr><td align="left"><code class="constant">GL_TYPE</code></td><td align="left"><code class="constant">GL_UNIFORM</code>, <code class="constant">GL_PROGRAM_INPUT</code>, <code class="constant">GL_PROGRAM_OUTPUT</code>, <code class="constant">GL_TRANSFORM_FEEDBACK_VARYING</code>, <code class="constant">GL_BUFFER_VARIABLE</code></td></tr><tr><td align="left"><code class="constant">GL_ARRAY_SIZE</code></td><td align="left"><code class="constant">GL_UNIFORM</code>, <code class="constant">GL_BUFFER_VARIABLE</code>, <code class="constant">GL_PROGRAM_INPUT</code>,
                                            <code class="constant">GL_PROGRAM_OUTPUT, VERTEX_SUBROUTINE_UNIFORM</code>, <code class="constant">GL_TESS_CONTROL_SUBROUTINE_UNIFORM</code>,
                                            <code class="constant">GL_TESS_EVALUATION_SUBROUTINE_UNIFORM</code>, <code class="constant">GL_GEOMETRY_SUBROUTINE_UNIFORM</code>,
                                            <code class="constant">GL_FRAGMENT_SUBROUTINE_UNIFORM</code>, <code class="constant">GL_COMPUTE_SUBROUTINE_UNIFORM</code>, <code class="constant">GL_TRANSFORM_FEEDBACK_VARYING</code></td></tr><tr><td align="left"><code class="constant">GL_OFFSET</code></td><td align="left"><code class="constant">GL_UNIFORM</code>, <code class="constant">GL_BUFFER_VARIABLE</code></td></tr><tr><td align="left"><code class="constant">GL_BLOCK_INDEX</code></td><td align="left"><code class="constant">GL_UNIFORM</code>, <code class="constant">GL_BUFFER_VARIABLE</code></td></tr><tr><td align="left"><code class="constant">GL_ARRAY_STRIDE</code></td><td align="left"><code class="constant">GL_UNIFORM</code>, <code class="constant">GL_BUFFER_VARIABLE</code></td></tr><tr><td align="left"><code class="constant">GL_MATRIX_STRIDE</code></td><td align="left"><code class="constant">GL_UNIFORM</code>, <code class="constant">GL_BUFFER_VARIABLE</code></td></tr><tr><td align="left"><code class="constant">GL_IS_ROW_MAJOR</code></td><td align="left"><code class="constant">GL_UNIFORM</code>, <code class="constant">GL_BUFFER_VARIABLE</code></td></tr><tr><td align="left"><code class="constant">GL_ATOMIC_COUNTER_BUFFER_INDEX</code></td><td align="left"><code class="constant">GL_UNIFORM</code></td></tr><tr><td align="left"><code class="constant">GL_TEXTURE_BUFFER</code></td><td align="left"><span class="ERROR">&lt;emph&gt;none&lt;/emph&gt;</span></td></tr><tr><td align="left"><code class="constant">GL_BUFFER_BINDING</code></td><td align="left"><code class="constant">GL_UNIFORM_BLOCK</code>, <code class="constant">GL_ATOMIC_COUNTER_BUFFER</code>, <code class="constant">GL_SHADER_STORAGE_BLOCK</code></td></tr><tr><td align="left"><code class="constant">GL_BUFFER_DATA_SIZE</code></td><td align="left"><code class="constant">GL_UNIFORM_BLOCK</code>, <code class="constant">GL_ATOMIC_COUNTER_BUFFER</code>, <code class="constant">GL_SHADER_STORAGE_BLOCK</code></td></tr><tr><td align="left"><code class="constant">GL_NUM_ACTIVE_VARIABLES</code></td><td align="left"><code class="constant">GL_UNIFORM_BLOCK</code>, <code class="constant">GL_ATOMIC_COUNTER_BUFFER</code>, <code class="constant">GL_SHADER_STORAGE_BLOCK</code></td></tr><tr><td align="left"><code class="constant">GL_ACTIVE_VARIABLES</code></td><td align="left"><code class="constant">GL_UNIFORM_BLOCK</code>, <code class="constant">GL_ATOMIC_COUNTER_BUFFER</code>, <code class="constant">GL_SHADER_STORAGE_BLOCK</code></td></tr><tr><td align="left"><code class="constant">GL_REFERENCED_BY_VERTEX_SHADER</code></td><td align="left"><code class="constant">GL_UNIFORM</code>, <code class="constant">GL_UNIFORM_BLOCK</code>, <code class="constant">GL_ATOMIC_COUNTER_SHADER</code>,
                                            <code class="constant">GL_BUFFER</code>, <code class="constant">GL_SHADER_STORAGE_BLOCK</code>, <code class="constant">GL_BUFFER_VARIABLE</code>,
                                            <code class="constant">GL_PROGRAM_INPUT</code>, <code class="constant">GL_PROGRAM_OUTPUT</code></td></tr><tr><td align="left"><code class="constant">GL_REFERENCED_BY_TESS_CONTROL_SHADER</code></td><td align="left"><code class="constant">GL_UNIFORM</code>, <code class="constant">GL_UNIFORM_BLOCK</code>, <code class="constant">GL_ATOMIC_COUNTER_SHADER</code>,
                                            <code class="constant">GL_BUFFER</code>, <code class="constant">GL_SHADER_STORAGE_BLOCK</code>, <code class="constant">GL_BUFFER_VARIABLE</code>,
                                            <code class="constant">GL_PROGRAM_INPUT</code>, <code class="constant">GL_PROGRAM_OUTPUT</code></td></tr><tr><td align="left"><code class="constant">GL_REFERENCED_BY_TESS_EVALUATION_SHADER</code></td><td align="left"><code class="constant">GL_UNIFORM</code>, <code class="constant">GL_UNIFORM_BLOCK</code>, <code class="constant">GL_ATOMIC_COUNTER_SHADER</code>,
                                            <code class="constant">GL_BUFFER</code>, <code class="constant">GL_SHADER_STORAGE_BLOCK</code>, <code class="constant">GL_BUFFER_VARIABLE</code>,
                                            <code class="constant">GL_PROGRAM_INPUT</code>, <code class="constant">GL_PROGRAM_OUTPUT</code></td></tr><tr><td align="left"><code class="constant">GL_REFERENCED_BY_GEOMETRY_SHADER</code></td><td align="left"><code class="constant">GL_UNIFORM</code>, <code class="constant">GL_UNIFORM_BLOCK</code>, <code class="constant">GL_ATOMIC_COUNTER_SHADER</code>,
                                            <code class="constant">GL_BUFFER</code>, <code class="constant">GL_SHADER_STORAGE_BLOCK</code>, <code class="constant">GL_BUFFER_VARIABLE</code>,
                                            <code class="constant">GL_PROGRAM_INPUT</code>, <code class="constant">GL_PROGRAM_OUTPUT</code></td></tr><tr><td align="left"><code class="constant">GL_REFERENCED_BY_FRAGMENT_SHADER</code></td><td align="left"><code class="constant">GL_UNIFORM</code>, <code class="constant">GL_UNIFORM_BLOCK</code>, <code class="constant">GL_ATOMIC_COUNTER_SHADER</code>,
                                            <code class="constant">GL_BUFFER</code>, <code class="constant">GL_SHADER_STORAGE_BLOCK</code>, <code class="constant">GL_BUFFER_VARIABLE</code>,
                                            <code class="constant">GL_PROGRAM_INPUT</code>, <code class="constant">GL_PROGRAM_OUTPUT</code></td></tr><tr><td align="left"><code class="constant">GL_REFERENCED_BY_COMPUTE_SHADER</code></td><td align="left"><code class="constant">GL_UNIFORM</code>, <code class="constant">GL_UNIFORM_BLOCK</code>, <code class="constant">GL_ATOMIC_COUNTER_SHADER</code>,
                                            <code class="constant">GL_BUFFER</code>, <code class="constant">GL_SHADER_STORAGE_BLOCK</code>, <code class="constant">GL_BUFFER_VARIABLE</code>,
                                            <code class="constant">GL_PROGRAM_INPUT</code>, <code class="constant">GL_PROGRAM_OUTPUT</code></td></tr><tr><td align="left"><code class="constant">GL_NUM_COMPATIBLE_SUBROUTINES</code></td><td align="left"><code class="constant">GL_VERTEX_SUBROUTINE_UNIFORM</code>, <code class="constant">GL_TESS_CONTROL_SUBROUTINE_UNIFORM</code>,
                                            <code class="constant">GL_TESS_EVALUATION_SUBROUTINE_UNIFORM</code>, <code class="constant">GL_GEOMETRY_SUBROUTINE_UNIFORM</code>,
                                            <code class="constant">GL_FRAGMENT_SUBROUTINE_UNIFORM</code>, <code class="constant">GL_COMPUTE_SUBROUTINE_UNIFORM</code></td></tr><tr><td align="left"><code class="constant">GL_COMPATIBLE_SUBROUTINES</code></td><td align="left"><code class="constant">GL_VERTEX_SUBROUTINE_UNIFORM</code>, <code class="constant">GL_TESS_CONTROL_SUBROUTINE_UNIFORM</code>,
                                            <code class="constant">GL_TESS_EVALUATION_SUBROUTINE_UNIFORM</code>, <code class="constant">GL_GEOMETRY_SUBROUTINE_UNIFORM</code>,
                                            <code class="constant">GL_FRAGMENT_SUBROUTINE_UNIFORM</code>, <code class="constant">GL_COMPUTE_SUBROUTINE_UNIFORM</code></td></tr><tr><td align="left"><code class="constant">GL_TOP_LEVEL_ARRAY_SIZE</code></td><td align="left"><code class="constant">GL_BUFFER_VARIABLE</code></td></tr><tr><td align="left"><code class="constant">GL_TOP_LEVEL_ARRAY_STRIDE</code></td><td align="left"><code class="constant">GL_BUFFER_VARIABLE</code></td></tr><tr><td align="left"><code class="constant">GL_LOCATION</code></td><td align="left"><code class="constant">GL_UNIFORM</code>, <code class="constant">GL_PROGRAM_INPUT</code>, <code class="constant">GL_PROGRAM_OUTPUT</code>,
                                            <code class="constant">GL_VERTEX_SUBROUTINE_UNIFORM</code>, <code class="constant">GL_TESS_CONTROL_SUBROUTINE_UNIFORM</code>,
                                            <code class="constant">GL_TESS_EVALUATION_SUBROUTINE_UNIFORM</code>, <code class="constant">GL_GEOMETRY_SUBROUTINE_UNIFORM</code>,
                                            <code class="constant">GL_FRAGMENT_SUBROUTINE_UNIFORM</code>, <code class="constant">GL_COMPUTE_SUBROUTINE_UNIFORM</code></td></tr><tr><td align="left"><code class="constant">GL_LOCATION_INDEX</code></td><td align="left"><code class="constant">GL_PROGRAM_OUTPUT</code></td></tr><tr><td align="left"><code class="constant">GL_IS_PER_PATCH</code></td><td align="left"><code class="constant">GL_PROGRAM_INPUT</code>, <code class="constant">GL_PROGRAM_OUTPUT</code></td></tr></tbody></table></div><p>
            For the property <code class="constant">GL_NAME_LENGTH</code>, a single integer identifying the length of
            the name string associated with an active variable, interface block, or
            subroutine is written to <em class="parameter"><code>params</code></em>.  The name length includes a terminating
            null character.

            For the property <code class="constant">GL_TYPE</code>, a single integer identifying the type of an active
            variable is written to <em class="parameter"><code>params</code></em>.  The integer returned is one of the
            values found in table 2.16.

            For the property <code class="constant">GL_ARRAY_SIZE</code>, a single integer identifying the number of
            active array elements of an active variable is written to <em class="parameter"><code>params</code></em>.  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 <em class="parameter"><code>params</code></em>.

            For the property <code class="constant">GL_BLOCK_INDEX</code>, a single integer identifying the index of
            the active interface block containing an active variable is written to
            <em class="parameter"><code>params</code></em>.  If the variable is not the member of an interface block, the
            value -1 is written to <em class="parameter"><code>params</code></em>.

            For the property <code class="constant">GL_OFFSET</code>, a single integer identifying the offset of an
            active variable is written to <em class="parameter"><code>params</code></em>.  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 <em class="parameter"><code>params</code></em>.

            For the property <code class="constant">GL_ARRAY_STRIDE</code>, a single integer identifying the stride
            between array elements in an active variable is written to <em class="parameter"><code>params</code></em>.  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 <em class="parameter"><code>params</code></em>.  For active variables not backed
            by a buffer object, -1 is written to <em class="parameter"><code>params</code></em>, regardless of the variable
            type.

            For the property <code class="constant">GL_MATRIX_STRIDE</code>, a single integer identifying the stride
            between columns of a column-major matrix or rows of a row-major matrix is
            written to <em class="parameter"><code>params</code></em>.  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 <em class="parameter"><code>params</code></em>.  For active variables not backed by a buffer
            object, -1 is written to <em class="parameter"><code>params</code></em>, regardless of the variable type.

            For the property <code class="constant">GL_IS_ROW_MAJOR</code>, a single integer identifying whether an
            active variable is a row-major matrix is written to <em class="parameter"><code>params</code></em>.  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 <em class="parameter"><code>params</code></em>.
            For all other active variables, zero is written to <em class="parameter"><code>params</code></em>.

            For the property <code class="constant">GL_ATOMIC_COUNTER_BUFFER_INDEX</code>, a single integer identifying
            the index of the active atomic counter buffer containing an active
            variable is written to <em class="parameter"><code>params</code></em>.  If the variable is not an atomic counter
            uniform, the value -1 is written to <em class="parameter"><code>params</code></em>.

            For the property <code class="constant">GL_BUFFER_BINDING</code>, to index of the buffer binding point
            associated with the active uniform block, shader storage block, or atomic
            counter buffer is written to <em class="parameter"><code>params</code></em>.

            For the property <code class="constant">GL_BUFFER_DATA_SIZE</code>, 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 <em class="parameter"><code>params</code></em>.  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 <code class="constant">GL_NUM_ACTIVE_VARIABLES</code>, the number of active variables
            associated with an active uniform block, shader storage block, or atomic
            counter buffer is written to <em class="parameter"><code>params</code></em>.

            For the property <code class="constant">GL_of ACTIVE_VARIABLES</code>, an array of active variable indices
            associated with an active uniform block, shader storage block, or atomic
            counter buffer is written to <em class="parameter"><code>params</code></em>.  The number of values written to
            <em class="parameter"><code>params</code></em> for an active resource is given by the value of the property
            <code class="constant">GL_NUM_ACTIVE_VARIABLES</code> for the resource.

            For the properties <code class="constant">GL_REFERENCED_BY_VERTEX_SHADER</code>,
            <code class="constant">GL_REFERENCED_BY_TESS_CONTROL_SHADER</code>, <code class="constant">GL_REFERENCED_BY_TESS_EVALUATION_SHADER</code>,
            <code class="constant">GL_REFERENCED_BY_GEOMETRY_SHADER</code>, <code class="constant">GL_REFERENCED_BY_FRAGMENT_SHADER</code>, and
            <code class="constant">GL_REFERENCED_BY_COMPUTE_SHADER</code>, a single integer is written to <em class="parameter"><code>params</code></em>,
            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
            <em class="parameter"><code>params</code></em> 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 <em class="parameter"><code>params</code></em>.

            For the property <code class="constant">GL_TOP_LEVEL_ARRAY_SIZE</code>, 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 <em class="parameter"><code>params</code></em>.  If the
            top-level block member is not declared as an array, the value one is
            written to <em class="parameter"><code>params</code></em>.  If the top-level block member is an array with no
            declared size, the value zero is written to <em class="parameter"><code>params</code></em>.

            For the property <code class="constant">GL_TOP_LEVEL_ARRAY_STRIDE</code>, a single integer identifying the
            stride between array elements of the top-level shader storage block member
            containing the active variable is written to <em class="parameter"><code>params</code></em>.  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 <em class="parameter"><code>params</code></em>.

            For the property <code class="constant">GL_LOCATION</code>, a single integer identifying the assigned
            location for an active uniform, input, output, or subroutine uniform
            variable is written to <em class="parameter"><code>params</code></em>.  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 <em class="parameter"><code>params</code></em>.  For all other input and output variables, the value
            -1 is written to <em class="parameter"><code>params</code></em>.  For uniforms in uniform blocks, the value -1
            is written to <em class="parameter"><code>params</code></em>.

            For the property <code class="constant">GL_LOCATION_INDEX</code>, a single integer identifying the fragment
            color index of an active fragment shader output variable is written to
            <em class="parameter"><code>params</code></em>.  If the active variable is an output for a non-fragment shader,
            the value -1 will be written to <em class="parameter"><code>params</code></em>.

            For the property <code class="constant">GL_IS_PER_PATCH</code>, 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 <code class="code">patch</code> qualifier), the value one
            is written to <em class="parameter"><code>params</code></em>; otherwise, the value zero is written to <em class="parameter"><code>params</code></em>.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
            <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>program</code></em> is
            not the name of an existing program object.
        </p><p>
            <code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>propCount</code></em> is
            zero.
        </p><p>
            <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>programInterface</code></em>
            is not one of the accepted interface types.
        </p><p>
            <code class="constant">GL_INVLALID_ENUM</code> is generated if any value in <em class="parameter"><code>props</code></em>
            is not one of the accepted tokens for the interface <em class="parameter"><code>programInterface</code></em>
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
            <a href="glGetProgramResourceName.xml"><span class="citerefentry"><span class="refentrytitle">glGetProgramResourceName</span></span></a>,
            <a href="glGetGetProgramResourceIndex.xml"><span class="citerefentry"><span class="refentrytitle">glGetGetProgramResourceIndex</span></span></a>,
            <a href="glGetProgramResourceLocation.xml"><span class="citerefentry"><span class="refentrytitle">glGetProgramResourceLocation</span></span></a>,
            <a href="glGetProgramResourceLocationIndex.xml"><span class="citerefentry"><span class="refentrytitle">glGetProgramResourceLocationIndex</span></span></a>.
        </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p>
            Copyright <span class="trademark"></span>© 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.
            <a href="http://opencontent.org/openpub/" target="_top">http://opencontent.org/openpub/</a>.
        </p></div></div></body></html>
