GLAPI/glGetActiveSubroutineUniform: Difference between revisions

From OpenGL Wiki
Jump to navigation Jump to search
m Renaming category: 'GL 4 API Shader Program Query' to 'Core API Ref Shader Program Query'.
m Bot: Adding better formatting.
 
(6 intermediate revisions by 2 users not shown)
Line 9: Line 9:
== Function Definition ==
== Function Definition ==


   void '''glGetActiveSubroutineUniformiv'''(GLuint ''program'', GLenum ''shadertype'', GLuint ''index'', GLenum ''pname'', GLint *''values'');
   void '''glGetActiveSubroutineUniformiv'''(GLuint {{param|program}}, GLenum {{param|shadertype}}, GLuint {{param|index}}, GLenum {{param|pname}}, GLint *{{param|values}});


; program
; program
: Specifies the name of the program containing the subroutine.
: Specifies the name of the program containing the subroutine.
; shadertype
; shadertype
: Specifies the shader stage from which to query for the subroutine parameter. ''shadertype'' must be one of {{code|GL_VERTEX_SHADER}}, {{code|GL_TESS_CONTROL_SHADER}}, {{code|GL_TESS_EVALUATION_SHADER}}, {{code|GL_GEOMETRY_SHADER}} or {{code|GL_FRAGMENT_SHADER}}.
: Specifies the shader stage from which to query for the subroutine parameter. {{param|shadertype}} must be one of {{enum|GL_VERTEX_SHADER}}, {{enum|GL_TESS_CONTROL_SHADER}}, {{enum|GL_TESS_EVALUATION_SHADER}}, {{enum|GL_GEOMETRY_SHADER}}, {{enum|GL_FRAGMENT_SHADER}}, or {{enum|GL_COMPUTE_SHADER}}.
; index
; index
: Specifies the index of the shader subroutine uniform.
: Specifies the index of the shader subroutine uniform.
; pname
; pname
: Specifies the parameter of the shader subroutine uniform to query. ''pname'' must be {{code|GL_NUM_COMPATIBLE_SUBROUTINES}}, {{code|GL_COMPATIBLE_SUBROUTINES}}, {{code|GL_UNIFORM_SIZE}} or {{code|GL_UNIFORM_NAME_LENGTH}}.
: Specifies the parameter of the shader subroutine uniform to query. {{param|pname}} must be {{enum|GL_NUM_COMPATIBLE_SUBROUTINES}}, {{enum|GL_COMPATIBLE_SUBROUTINES}}, {{enum|GL_UNIFORM_SIZE}} or {{enum|GL_UNIFORM_NAME_LENGTH}}.
; values
; values
: Specifies the address of a into which the queried value or values will be placed.
: Specifies the address of a into which the queried value or values will be placed.
Line 24: Line 24:
== Description ==
== Description ==


'''glGetActiveSubroutineUniform''' queries a parameter of an active shader subroutine uniform. ''program'' contains the name of the program containing the uniform. ''shadertype'' specifies the stage which which the uniform location, given by ''index'', is valid. ''index'' must be between zero and the value of {{code|GL_ACTIVE_SUBROUTINE_UNIFORMS}} minus one for the shader stage.
'''glGetActiveSubroutineUniform''' queries a parameter of an active shader subroutine uniform. {{param|program}} contains the name of the program containing the uniform. {{param|shadertype}} specifies the stage which which the uniform location, given by {{param|index}}, is valid. {{param|index}} must be between zero and the value of {{enum|GL_ACTIVE_SUBROUTINE_UNIFORMS}} minus one for the shader stage.


If ''pname'' is {{code|GL_NUM_COMPATIBLE_SUBROUTINES}}, a single integer indicating the number of subroutines that can be assigned to the uniform is returned in ''values''.
If {{param|pname}} is {{enum|GL_NUM_COMPATIBLE_SUBROUTINES}}, a single integer indicating the number of subroutines that can be assigned to the uniform is returned in {{param|values}}.


If ''pname'' is {{code|GL_COMPATIBLE_SUBROUTINES}}, an array of integers is returned in ''values'', with each integer specifying the index of an active subroutine that can be assigned to the selected subroutine uniform. The number of integers returned is the same as the value returned for {{code|GL_NUM_COMPATIBLE_SUBROUTINES}}.
If {{param|pname}} is {{enum|GL_COMPATIBLE_SUBROUTINES}}, an array of integers is returned in {{param|values}}, with each integer specifying the index of an active subroutine that can be assigned to the selected subroutine uniform. The number of integers returned is the same as the value returned for {{enum|GL_NUM_COMPATIBLE_SUBROUTINES}}.


If ''pname'' is {{code|GL_UNIFORM_SIZE}}, a single integer is returned in ''values''. If the selected subroutine uniform is an array, the declared size of the array is returned; otherwise, one is returned.
If {{param|pname}} is {{enum|GL_UNIFORM_SIZE}}, a single integer is returned in {{param|values}}. If the selected subroutine uniform is an array, the declared size of the array is returned; otherwise, one is returned.


If ''pname'' is {{code|GL_UNIFORM_NAME_LENGTH}}, a single integer specifying the length of the subroutine uniform name (including the terminating null character) is returned in ''values''.
If {{param|pname}} is {{enum|GL_UNIFORM_NAME_LENGTH}}, a single integer specifying the length of the subroutine uniform name (including the terminating null character) is returned in {{param|values}}.


== Errors ==
== Errors ==


{{code|GL_INVALID_ENUM}} is generated if ''shadertype'' or ''pname'' is not one of the accepted values.
{{enum|GL_INVALID_ENUM}} is generated if {{param|shadertype}} or {{param|pname}} is not one of the accepted values.


{{code|GL_INVALID_VALUE}} is generated if ''index'' is greater than or equal to the value of {{code|GL_ACTIVE_SUBROUTINES}}.
{{enum|GL_INVALID_VALUE}} is generated if {{param|index}} is greater than or equal to the value of {{enum|GL_ACTIVE_SUBROUTINES}}.


{{code|GL_INVALID_VALUE}} is generated if ''program'' is not the name of an existing program object.
{{enum|GL_INVALID_VALUE}} is generated if {{param|program}} is not the name of an existing program object.


== Associated Gets ==
== Associated Gets ==


[[GLAPI/glGetProgramStage|glGetProgramStage]] with argument {{code|GL_ACTIVE_SUBROUTINE_UNIFORMS}}
{{apifunc|glGetProgramStage}} with argument {{enum|GL_ACTIVE_SUBROUTINE_UNIFORMS}}
 
{{apifunc|glGetProgramInterface}} with the interface set to  {{enum|GL_VERTEX_SUBROUTINE_UNIFORM}}, {{enum|​GL_TESS_CONTROL_SUBROUTINE_UNIFORM}}, {{enum|GL_TESS_EVALUATION_SUBROUTINE​_UNIFORM}}, {{enum|GL_GEOMETRY_SUBROUTINE_UNIFORM}}, {{enum|​GL_FRAGMENT_SUBROUTINE_UNIFORM​}}, or {{enum|GL_COMPUTE_SUBROUTINE​_UNIFORM}} as appropriate, and with {{enum|GL_ACTIVE_RESOURCES}}
 
{{apifunc|glGetSubroutineIndex}}
 
{{apifunc|glGetProgramResourceIndex}} with the interface set to  {{enum|GL_VERTEX_SUBROUTINE_UNIFORM}}, {{enum|​GL_TESS_CONTROL_SUBROUTINE_UNIFORM}}, {{enum|GL_TESS_EVALUATION_SUBROUTINE​_UNIFORM}}, {{enum|GL_GEOMETRY_SUBROUTINE_UNIFORM}}, {{enum|​GL_FRAGMENT_SUBROUTINE_UNIFORM​}}, or {{enum|GL_COMPUTE_SUBROUTINE​_UNIFORM}} as appropriate


== See Also ==
== See Also ==


[[GLAPI/glGetSubroutineIndex|glGetSubroutineIndex]], [[GLAPI/glGetActiveSubroutineUniformName|glGetActiveSubroutineUniformName]], [[GLAPI/glGetProgramStage|glGetProgramStage]]
{{apifunc|glGetActiveSubroutineUniformName}}, {{apifunc|glGetProgramResource}}, {{apifunc|glGetProgramResourceName}}


== Copyright ==
== Copyright ==
Line 54: Line 60:
Copyright © 2010 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/ http://opencontent.org/openpub/].
Copyright © 2010 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/ http://opencontent.org/openpub/].


[[Category:API Reference 4|GetActiveSubroutineUniform]]
[[Category:Core API Ref Shader Program Query|GetActiveSubroutineUniform]]
[[Category:Core API Ref Shader Program Query|GetActiveSubroutineUniform]]
[[Category:Core API Reference|GetActiveSubroutineUniform]]
[[Category:Program Object API State Functions|GetActiveSubroutineUniform]]

Latest revision as of 09:58, 15 August 2013

glGetActiveSubroutineUniform
Core in version 4.6
Core since version 4.0
Core ARB extension ARB_shader_subroutine

glGetActiveSubroutineUniform: query a property of an active shader subroutine uniform

Function Definition

 void glGetActiveSubroutineUniformiv(GLuint program​, GLenum shadertype​, GLuint index​, GLenum pname​, GLint *values​);
program
Specifies the name of the program containing the subroutine.
shadertype
Specifies the shader stage from which to query for the subroutine parameter. shadertype​ must be one of GL_VERTEX_SHADER, GL_TESS_CONTROL_SHADER, GL_TESS_EVALUATION_SHADER, GL_GEOMETRY_SHADER, GL_FRAGMENT_SHADER, or GL_COMPUTE_SHADER.
index
Specifies the index of the shader subroutine uniform.
pname
Specifies the parameter of the shader subroutine uniform to query. pname​ must be GL_NUM_COMPATIBLE_SUBROUTINES, GL_COMPATIBLE_SUBROUTINES, GL_UNIFORM_SIZE or GL_UNIFORM_NAME_LENGTH.
values
Specifies the address of a into which the queried value or values will be placed.

Description

glGetActiveSubroutineUniform queries a parameter of an active shader subroutine uniform. program​ contains the name of the program containing the uniform. shadertype​ specifies the stage which which the uniform location, given by index​, is valid. index​ must be between zero and the value of GL_ACTIVE_SUBROUTINE_UNIFORMS minus one for the shader stage.

If pname​ is GL_NUM_COMPATIBLE_SUBROUTINES, a single integer indicating the number of subroutines that can be assigned to the uniform is returned in values​.

If pname​ is GL_COMPATIBLE_SUBROUTINES, an array of integers is returned in values​, with each integer specifying the index of an active subroutine that can be assigned to the selected subroutine uniform. The number of integers returned is the same as the value returned for GL_NUM_COMPATIBLE_SUBROUTINES.

If pname​ is GL_UNIFORM_SIZE, a single integer is returned in values​. If the selected subroutine uniform is an array, the declared size of the array is returned; otherwise, one is returned.

If pname​ is GL_UNIFORM_NAME_LENGTH, a single integer specifying the length of the subroutine uniform name (including the terminating null character) is returned in values​.

Errors

GL_INVALID_ENUM is generated if shadertype​ or pname​ is not one of the accepted values.

GL_INVALID_VALUE is generated if index​ is greater than or equal to the value of GL_ACTIVE_SUBROUTINES.

GL_INVALID_VALUE is generated if program​ is not the name of an existing program object.

Associated Gets

glGetProgramStage with argument GL_ACTIVE_SUBROUTINE_UNIFORMS

glGetProgramInterface with the interface set to GL_VERTEX_SUBROUTINE_UNIFORM, ​GL_TESS_CONTROL_SUBROUTINE_UNIFORM, GL_TESS_EVALUATION_SUBROUTINE​_UNIFORM, GL_GEOMETRY_SUBROUTINE_UNIFORM, ​GL_FRAGMENT_SUBROUTINE_UNIFORM​, or GL_COMPUTE_SUBROUTINE​_UNIFORM as appropriate, and with GL_ACTIVE_RESOURCES

glGetSubroutineIndex

glGetProgramResourceIndex with the interface set to GL_VERTEX_SUBROUTINE_UNIFORM, ​GL_TESS_CONTROL_SUBROUTINE_UNIFORM, GL_TESS_EVALUATION_SUBROUTINE​_UNIFORM, GL_GEOMETRY_SUBROUTINE_UNIFORM, ​GL_FRAGMENT_SUBROUTINE_UNIFORM​, or GL_COMPUTE_SUBROUTINE​_UNIFORM as appropriate

See Also

glGetActiveSubroutineUniformName, glGetProgramResource, glGetProgramResourceName

Copyright

Copyright © 2010 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/.