name, or the name of an existing primitive query object previously bound to the <constant>GL_PRIMITIVES_GENERATED</constant> query binding.
When <function>glBeginQueryIndexed</function> is executed, the query object's primitives-generated counter is reset to 0. Subsequent
rendering will increment the counter once for every vertex that is emitted from the geometry shader to the stream given by <parameter>index</parameter>,
or from the vertex shader if <parameter>index</parameter> is zero and no geometry shader is present.
When <function>glEndQueryIndexed</function> is executed, the primitives-generated counter for stream <parameter>index</parameter> is assigned to
the query object's result value. This value can be queried by calling <citerefentry><refentrytitle>glGetQueryObject</refentrytitle></citerefentry>
with <parameter>pname</parameter><constant>GL_QUERY_RESULT</constant>.
When <parameter>target</parameter> is <constant>GL_PRIMITIVES_GENERATED</constant>, <parameter>index</parameter> must be
less than the value of <constant>GL_MAX_VERTEX_STREAMS</constant>.
an unused name, or the name of an existing primitive query object previously bound to the <constant>GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN</constant>
query binding. When <function>glBeginQueryIndexed</function> is executed, the query object's primitives-written counter for the stream specified by
<parameter>index</parameter> is reset to 0. Subsequent rendering will increment the counter once for every vertex that is written into the bound
transform feedback buffer(s) for stream <parameter>index</parameter>. If transform feedback
mode is not activated between the call to <function>glBeginQueryIndexed</function> and <function>glEndQueryIndexed</function>, the counter will not be
incremented. When <function>glEndQueryIndexed</function> is executed, the primitives-written counter for stream <parameter>index</parameter> is assigned to
the query object's result value. This value can be queried by calling <citerefentry><refentrytitle>glGetQueryObject</refentrytitle></citerefentry> with <parameter>pname</parameter>
<constant>GL_QUERY_RESULT</constant>.
When <parameter>target</parameter> is <constant>GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN</constant>, <parameter>index</parameter> must be
less than the value of <constant>GL_MAX_VERTEX_STREAMS</constant>.
an unused name, or the name of an existing timer query object previously bound to the <constant>GL_TIME_ELAPSED</constant>
query binding. When <function>glBeginQueryIndexed</function> is executed, the query object's time counter is reset to 0. When <function>glEndQueryIndexed</function>
is executed, the elapsed server time that has passed since the call to <function>glBeginQueryIndexed</function> is written into the query object's
time counter. This value can be queried by calling <citerefentry><refentrytitle>glGetQueryObject</refentrytitle></citerefentry> with <parameter>pname</parameter>
<constant>GL_QUERY_RESULT</constant>.
When <parameter>target</parameter> is <constant>GL_TIME_ELAPSED</constant>, <parameter>index</parameter> must be zero.
</para>
<para>
Querying the <constant>GL_QUERY_RESULT</constant> implicitly flushes the GL pipeline until the rendering delimited by the
query object has completed and the result is available. <constant>GL_QUERY_RESULT_AVAILABLE</constant> can be queried to
determine if the result is immediately available or if the rendering is not yet complete.
</para>
</refsect1>
<refsect1id="notes"><title>Notes</title>
<para>
If the query target's count exceeds the maximum value representable in the number of available bits, as reported by
<citerefentry><refentrytitle>glGetQueryiv</refentrytitle></citerefentry> with <parameter>target</parameter> set to the
appropriate query target and <parameter>pname</parameter>
<constant>GL_QUERY_COUNTER_BITS</constant>, the count becomes undefined.
</para>
<para>
An implementation may support 0 bits in its counter, in which case query results are always undefined
and essentially useless.
</para>
<para>
When <constant>GL_SAMPLE_BUFFERS</constant> is 0, the samples-passed counter of an occlusion query will increment once for each
fragment that passes the depth test. When <constant>GL_SAMPLE_BUFFERS</constant> is 1, an implementation may either increment
the samples-passed counter individually for each sample of a fragment that passes the depth test, or it may choose to increment
the counter for all samples of a fragment if any one of them passes the depth test.
</para>
<para>
Calling <citerefentry><refentrytitle>glBeginQuery</refentrytitle></citerefentry> or
<citerefentry><refentrytitle>glEndQuery</refentrytitle></citerefentry> is equivalent to
calling <citerefentry><refentrytitle>glBeginQueryIndexed</refentrytitle></citerefentry> or
<citerefentry><refentrytitle>glEndQueryIndexed</refentrytitle></citerefentry> with
<parameter>index</parameter> set to zero, respectively.
</para>
</refsect1>
<refsect1id="errors"><title>Errors</title>
<para>
<constant>GL_INVALID_ENUM</constant> is generated if <parameter>target</parameter> is not one of the accepted tokens.
</para>
<para>
<constant>GL_INVALID_VALUE</constant> is generated if <parameter>index</parameter> is greater than the
query target-specific maximum.
</para>
<para>
<constant>GL_INVALID_OPERATION</constant> is generated if <function>glBeginQueryIndexed</function> is executed while
a query object of the same <parameter>target</parameter> is already active.
</para>
<para>
<constant>GL_INVALID_OPERATION</constant> is generated if <citerefentry><refentrytitle>glEndQueryIndexed</refentrytitle></citerefentry>
is executed when a query object of the same <parameter>target</parameter> is not active.
</para>
<para>
<constant>GL_INVALID_OPERATION</constant> is generated if <parameter>id</parameter> is 0.
</para>
<para>
<constant>GL_INVALID_OPERATION</constant> is generated if <parameter>id</parameter> is the name of an already active query object.
</para>
<para>
<constant>GL_INVALID_OPERATION</constant> is generated if <parameter>id</parameter> refers to an existing query object whose type
does not does not match <parameter>target</parameter>.