GLAPI/glGetActiveSubroutineUniformName: Difference between revisions

From OpenGL Wiki
Jump to navigation Jump to search
m Bot: Adding better formatting.
m Bot: Adding better formatting.
Line 14: Line 14:
: 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. {{param|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}} or {{enum|GL_FRAGMENT_SHADER}}.
; index
; index
: Specifies the index of the shader subroutine uniform.
: Specifies the index of the shader subroutine uniform.
Line 26: Line 26:
== Description ==
== Description ==


'''glGetActiveSubroutineUniformName''' retrieves the name of an active shader subroutine uniform. {{param|program}} contains the name of the program containing the uniform. {{param|shadertype}} specifies the stage for which which the uniform location, given by {{param|index}}, is valid. {{param|index}} must be between zero and the value of {{code|GL_ACTIVE_SUBROUTINE_UNIFORMS}} minus one for the shader stage.
'''glGetActiveSubroutineUniformName''' retrieves the name of an active shader subroutine uniform. {{param|program}} contains the name of the program containing the uniform. {{param|shadertype}} specifies the stage for 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.


The uniform name is returned as a null-terminated string in {{param|name}}. The actual number of characters written into {{param|name}}, excluding the null terminator is returned in {{param|length}}. If {{param|length}} is {{code|NULL}}, no length is returned. The maximum number of characters that may be written into {{param|name}}, including the null terminator, is specified by {{param|bufsize}}. The length of the longest subroutine uniform name in {{param|program}} and {{param|shadertype}} is given by the value of {{code|GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH}}, which can be queried with {{apifunc|glGetProgramStage}}.
The uniform name is returned as a null-terminated string in {{param|name}}. The actual number of characters written into {{param|name}}, excluding the null terminator is returned in {{param|length}}. If {{param|length}} is {{code|NULL}}, no length is returned. The maximum number of characters that may be written into {{param|name}}, including the null terminator, is specified by {{param|bufsize}}. The length of the longest subroutine uniform name in {{param|program}} and {{param|shadertype}} is given by the value of {{enum|GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH}}, which can be queried with {{apifunc|glGetProgramStage}}.


== Errors ==
== Errors ==


{{code|GL_INVALID_ENUM}} is generated if {{param|shadertype}} or {{param|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 {{param|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 {{param|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 ==


{{apifunc|glGetProgramStage}} with argument {{code|GL_ACTIVE_SUBROUTINE_UNIFORMS}}
{{apifunc|glGetProgramStage}} with argument {{enum|GL_ACTIVE_SUBROUTINE_UNIFORMS}}


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

Revision as of 17:22, 29 April 2012

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

glGetActiveSubroutineUniformName: query the name of an active shader subroutine uniform

Function Definition

 void glGetActiveSubroutineUniformName(GLuint program​, GLenum shadertype​, GLuint index​, GLsizei bufsize​, GLsizei *length​, GLchar *name​);
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 or GL_FRAGMENT_SHADER.
index
Specifies the index of the shader subroutine uniform.
bufsize
Specifies the size of the buffer whose address is given in name​.
length
Specifies the address of a variable into which is written the number of characters copied into name​.
name
Specifies the address of a buffer that will receive the name of the specified shader subroutine uniform.

Description

glGetActiveSubroutineUniformName retrieves the name of an active shader subroutine uniform. program​ contains the name of the program containing the uniform. shadertype​ specifies the stage for 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.

The uniform name is returned as a null-terminated string in name​. The actual number of characters written into name​, excluding the null terminator is returned in length​. If length​ is NULL, no length is returned. The maximum number of characters that may be written into name​, including the null terminator, is specified by bufsize​. The length of the longest subroutine uniform name in program​ and shadertype​ is given by the value of GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH, which can be queried with glGetProgramStage.

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

See Also

glGetSubroutineIndex, glGetActiveSubroutineUniform, glGetProgramStage

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/.