Package org.lwjgl.opengl
Class ARBShaderSubroutine
- java.lang.Object
-
- org.lwjgl.opengl.ARBShaderSubroutine
-
public class ARBShaderSubroutine extends java.lang.Object
Native bindings to the ARB_shader_subroutine extension.This extension adds support to shaders for "indirect subroutine calls", where a single shader can include many subroutines and dynamically select through the API which subroutine is called from each call site. Switching subroutines dynamically in this fashion can avoid the cost of recompiling and managing multiple shaders, while still retaining most of the performance of specialized shaders.
Requires
ARB_gpu_shader5
. Promoted to core inOpenGL 4.0
.
-
-
Field Summary
Fields Modifier and Type Field and Description static int
GL_ACTIVE_SUBROUTINE_MAX_LENGTH
GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS
GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH
GL_ACTIVE_SUBROUTINE_UNIFORMS
GL_ACTIVE_SUBROUTINESAccepted by thepname
parameter of GetProgramStageiv.static int
GL_COMPATIBLE_SUBROUTINES
Accepted by thepname
parameter of GetActiveSubroutineUniformiv.static int
GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS
GL_MAX_SUBROUTINESAccepted by thepname
parameter of GetBooleanv, GetIntegerv, GetFloatv, GetDoublev, and GetInteger64v.static int
GL_NUM_COMPATIBLE_SUBROUTINES
Accepted by thepname
parameter of GetActiveSubroutineUniformiv.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static java.lang.String
glGetActiveSubroutineName(int program, int shadertype, int index)
Queries the name of an active shader subroutine.static java.lang.String
glGetActiveSubroutineName(int program, int shadertype, int index, int bufsize)
Queries the name of an active shader subroutine.static void
glGetActiveSubroutineName(int program, int shadertype, int index, int[] length, java.nio.ByteBuffer name)
Array version of:GetActiveSubroutineName
static void
glGetActiveSubroutineName(int program, int shadertype, int index, java.nio.IntBuffer length, java.nio.ByteBuffer name)
Queries the name of an active shader subroutine.static int
glGetActiveSubroutineUniformi(int program, int shadertype, int index, int pname)
Queries a property of an active shader subroutine uniform.static void
glGetActiveSubroutineUniformiv(int program, int shadertype, int index, int pname, int[] values)
Array version of:GetActiveSubroutineUniformiv
static void
glGetActiveSubroutineUniformiv(int program, int shadertype, int index, int pname, java.nio.IntBuffer values)
Queries a property of an active shader subroutine uniform.static java.lang.String
glGetActiveSubroutineUniformName(int program, int shadertype, int index)
Queries the name of an active shader subroutine uniform.static java.lang.String
glGetActiveSubroutineUniformName(int program, int shadertype, int index, int bufsize)
Queries the name of an active shader subroutine uniform.static void
glGetActiveSubroutineUniformName(int program, int shadertype, int index, int[] length, java.nio.ByteBuffer name)
Array version of:GetActiveSubroutineUniformName
static void
glGetActiveSubroutineUniformName(int program, int shadertype, int index, java.nio.IntBuffer length, java.nio.ByteBuffer name)
Queries the name of an active shader subroutine uniform.static int
glGetProgramStagei(int program, int shadertype, int pname)
Retrieves properties of a program object corresponding to a specified shader stage.static void
glGetProgramStageiv(int program, int shadertype, int pname, int[] values)
Array version of:GetProgramStageiv
static void
glGetProgramStageiv(int program, int shadertype, int pname, java.nio.IntBuffer values)
Retrieves properties of a program object corresponding to a specified shader stage.static int
glGetSubroutineIndex(int program, int shadertype, java.nio.ByteBuffer name)
Retrieves the index of a subroutine function of a given shader stage within a program.static int
glGetSubroutineIndex(int program, int shadertype, java.lang.CharSequence name)
Retrieves the index of a subroutine function of a given shader stage within a program.static int
glGetSubroutineUniformLocation(int program, int shadertype, java.nio.ByteBuffer name)
Retrieves the location of a subroutine uniform of a given shader stage within a program.static int
glGetSubroutineUniformLocation(int program, int shadertype, java.lang.CharSequence name)
Retrieves the location of a subroutine uniform of a given shader stage within a program.static int
glGetUniformSubroutineui(int shadertype, int location)
Retrieves the value of a subroutine uniform of a given shader stage of the current program.static void
glGetUniformSubroutineuiv(int shadertype, int location, int[] params)
Array version of:GetUniformSubroutineuiv
static void
glGetUniformSubroutineuiv(int shadertype, int location, java.nio.IntBuffer params)
Retrieves the value of a subroutine uniform of a given shader stage of the current program.static void
glUniformSubroutinesui(int shadertype, int index)
Loads active subroutine uniforms.static void
glUniformSubroutinesuiv(int shadertype, int[] indices)
Array version of:UniformSubroutinesuiv
static void
glUniformSubroutinesuiv(int shadertype, java.nio.IntBuffer indices)
Loads active subroutine uniforms.
-
-
-
Field Detail
-
GL_ACTIVE_SUBROUTINES, GL_ACTIVE_SUBROUTINE_UNIFORMS, GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS, GL_ACTIVE_SUBROUTINE_MAX_LENGTH, GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH
Accepted by thepname
parameter of GetProgramStageiv.
-
GL_MAX_SUBROUTINES, GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS
Accepted by thepname
parameter of GetBooleanv, GetIntegerv, GetFloatv, GetDoublev, and GetInteger64v.
-
GL_NUM_COMPATIBLE_SUBROUTINES, GL_COMPATIBLE_SUBROUTINES
Accepted by thepname
parameter of GetActiveSubroutineUniformiv.
-
-
Method Detail
-
glGetSubroutineUniformLocation
public static int glGetSubroutineUniformLocation(int program, int shadertype, java.nio.ByteBuffer name) public static int glGetSubroutineUniformLocation(int program, int shadertype, java.lang.CharSequence name)
Retrieves the location of a subroutine uniform of a given shader stage within a program.- Parameters:
program
- the name of the program containing shader stageshadertype
- the shader stage from which to query for subroutine uniform index. One of:VERTEX_SHADER
FRAGMENT_SHADER
GEOMETRY_SHADER
TESS_CONTROL_SHADER
TESS_EVALUATION_SHADER
name
- the name of the subroutine uniform whose index to query.
-
glGetSubroutineIndex
public static int glGetSubroutineIndex(int program, int shadertype, java.nio.ByteBuffer name) public static int glGetSubroutineIndex(int program, int shadertype, java.lang.CharSequence name)
Retrieves the index of a subroutine function of a given shader stage within a program.- Parameters:
program
- the name of the program containing shader stageshadertype
- the shader stage from which to query for subroutine function index. One of:VERTEX_SHADER
FRAGMENT_SHADER
GEOMETRY_SHADER
TESS_CONTROL_SHADER
TESS_EVALUATION_SHADER
name
- the name of the subroutine function whose index to query
-
glGetActiveSubroutineUniformiv
public static void glGetActiveSubroutineUniformiv(int program, int shadertype, int index, int pname, java.nio.IntBuffer values)
Queries a property of an active shader subroutine uniform.- Parameters:
program
- the name of the program containing the subroutineshadertype
- the shader stage from which to query for the subroutine parameter. One of:VERTEX_SHADER
FRAGMENT_SHADER
GEOMETRY_SHADER
TESS_CONTROL_SHADER
TESS_EVALUATION_SHADER
index
- the index of the shader subroutine uniformpname
- the parameter of the shader subroutine uniform to query. One of:NUM_COMPATIBLE_SUBROUTINES
COMPATIBLE_SUBROUTINES
UNIFORM_SIZE
UNIFORM_NAME_LENGTH
values
- the address of a buffer into which the queried value or values will be placed
-
glGetActiveSubroutineUniformi
public static int glGetActiveSubroutineUniformi(int program, int shadertype, int index, int pname)
Queries a property of an active shader subroutine uniform.- Parameters:
program
- the name of the program containing the subroutineshadertype
- the shader stage from which to query for the subroutine parameter. One of:VERTEX_SHADER
FRAGMENT_SHADER
GEOMETRY_SHADER
TESS_CONTROL_SHADER
TESS_EVALUATION_SHADER
index
- the index of the shader subroutine uniformpname
- the parameter of the shader subroutine uniform to query. One of:NUM_COMPATIBLE_SUBROUTINES
COMPATIBLE_SUBROUTINES
UNIFORM_SIZE
UNIFORM_NAME_LENGTH
-
glGetActiveSubroutineUniformName
public static void glGetActiveSubroutineUniformName(int program, int shadertype, int index, java.nio.IntBuffer length, java.nio.ByteBuffer name)
Queries the name of an active shader subroutine uniform.- Parameters:
program
- the name of the program containing the subroutineshadertype
- the shader stage from which to query for the subroutine parameter. One of:VERTEX_SHADER
FRAGMENT_SHADER
GEOMETRY_SHADER
TESS_CONTROL_SHADER
TESS_EVALUATION_SHADER
index
- the index of the shader subroutine uniformlength
- the address of a variable into which is written the number of characters copied intoname
name
- the address of a buffer that will receive the name of the specified shader subroutine uniform
-
glGetActiveSubroutineUniformName
public static java.lang.String glGetActiveSubroutineUniformName(int program, int shadertype, int index, int bufsize)
Queries the name of an active shader subroutine uniform.- Parameters:
program
- the name of the program containing the subroutineshadertype
- the shader stage from which to query for the subroutine parameter. One of:VERTEX_SHADER
FRAGMENT_SHADER
GEOMETRY_SHADER
TESS_CONTROL_SHADER
TESS_EVALUATION_SHADER
index
- the index of the shader subroutine uniformbufsize
- the size of the buffer whose address is given inname
-
glGetActiveSubroutineUniformName
public static java.lang.String glGetActiveSubroutineUniformName(int program, int shadertype, int index)
Queries the name of an active shader subroutine uniform.- Parameters:
program
- the name of the program containing the subroutineshadertype
- the shader stage from which to query for the subroutine parameter. One of:VERTEX_SHADER
FRAGMENT_SHADER
GEOMETRY_SHADER
TESS_CONTROL_SHADER
TESS_EVALUATION_SHADER
index
- the index of the shader subroutine uniform
-
glGetActiveSubroutineName
public static void glGetActiveSubroutineName(int program, int shadertype, int index, java.nio.IntBuffer length, java.nio.ByteBuffer name)
Queries the name of an active shader subroutine.- Parameters:
program
- the name of the program containing the subroutineshadertype
- the shader stage from which to query the subroutine name. One of:VERTEX_SHADER
FRAGMENT_SHADER
GEOMETRY_SHADER
TESS_CONTROL_SHADER
TESS_EVALUATION_SHADER
index
- the index of the shader subroutine uniformlength
- a variable which is to receive the length of the shader subroutine uniform namename
- an array into which the name of the shader subroutine uniform will be written
-
glGetActiveSubroutineName
public static java.lang.String glGetActiveSubroutineName(int program, int shadertype, int index, int bufsize)
Queries the name of an active shader subroutine.- Parameters:
program
- the name of the program containing the subroutineshadertype
- the shader stage from which to query the subroutine name. One of:VERTEX_SHADER
FRAGMENT_SHADER
GEOMETRY_SHADER
TESS_CONTROL_SHADER
TESS_EVALUATION_SHADER
index
- the index of the shader subroutine uniformbufsize
- the size of the buffer whose address is given inname
-
glGetActiveSubroutineName
public static java.lang.String glGetActiveSubroutineName(int program, int shadertype, int index)
Queries the name of an active shader subroutine.- Parameters:
program
- the name of the program containing the subroutineshadertype
- the shader stage from which to query the subroutine name. One of:VERTEX_SHADER
FRAGMENT_SHADER
GEOMETRY_SHADER
TESS_CONTROL_SHADER
TESS_EVALUATION_SHADER
index
- the index of the shader subroutine uniform
-
glUniformSubroutinesuiv
public static void glUniformSubroutinesuiv(int shadertype, java.nio.IntBuffer indices)
Loads active subroutine uniforms.- Parameters:
shadertype
- the shader stage to update. One of:VERTEX_SHADER
FRAGMENT_SHADER
GEOMETRY_SHADER
TESS_CONTROL_SHADER
TESS_EVALUATION_SHADER
indices
- an array holding the indices to load into the shader subroutine variables
-
glUniformSubroutinesui
public static void glUniformSubroutinesui(int shadertype, int index)
Loads active subroutine uniforms.- Parameters:
shadertype
- the shader stage to update. One of:VERTEX_SHADER
FRAGMENT_SHADER
GEOMETRY_SHADER
TESS_CONTROL_SHADER
TESS_EVALUATION_SHADER
-
glGetUniformSubroutineuiv
public static void glGetUniformSubroutineuiv(int shadertype, int location, java.nio.IntBuffer params)
Retrieves the value of a subroutine uniform of a given shader stage of the current program.- Parameters:
shadertype
- the shader stage from which to query for subroutine uniform index. One of:VERTEX_SHADER
FRAGMENT_SHADER
GEOMETRY_SHADER
TESS_CONTROL_SHADER
TESS_EVALUATION_SHADER
location
- the location of the subroutine uniformparams
- a variable to receive the value or values of the subroutine uniform
-
glGetUniformSubroutineui
public static int glGetUniformSubroutineui(int shadertype, int location)
Retrieves the value of a subroutine uniform of a given shader stage of the current program.- Parameters:
shadertype
- the shader stage from which to query for subroutine uniform index. One of:VERTEX_SHADER
FRAGMENT_SHADER
GEOMETRY_SHADER
TESS_CONTROL_SHADER
TESS_EVALUATION_SHADER
location
- the location of the subroutine uniform
-
glGetProgramStageiv
public static void glGetProgramStageiv(int program, int shadertype, int pname, java.nio.IntBuffer values)
Retrieves properties of a program object corresponding to a specified shader stage.- Parameters:
program
- the name of the program containing shader stageshadertype
- the shader stage from which to query for the subroutine parameter. One of:VERTEX_SHADER
FRAGMENT_SHADER
GEOMETRY_SHADER
TESS_CONTROL_SHADER
TESS_EVALUATION_SHADER
pname
- the parameter of the shader to query. One of:ACTIVE_SUBROUTINES
ACTIVE_SUBROUTINE_UNIFORMS
ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS
ACTIVE_SUBROUTINE_MAX_LENGTH
ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH
values
- a variable into which the queried value or values will be placed
-
glGetProgramStagei
public static int glGetProgramStagei(int program, int shadertype, int pname)
Retrieves properties of a program object corresponding to a specified shader stage.- Parameters:
program
- the name of the program containing shader stageshadertype
- the shader stage from which to query for the subroutine parameter. One of:VERTEX_SHADER
FRAGMENT_SHADER
GEOMETRY_SHADER
TESS_CONTROL_SHADER
TESS_EVALUATION_SHADER
pname
- the parameter of the shader to query. One of:ACTIVE_SUBROUTINES
ACTIVE_SUBROUTINE_UNIFORMS
ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS
ACTIVE_SUBROUTINE_MAX_LENGTH
ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH
-
glGetActiveSubroutineUniformiv
public static void glGetActiveSubroutineUniformiv(int program, int shadertype, int index, int pname, int[] values)
Array version of:GetActiveSubroutineUniformiv
-
glGetActiveSubroutineUniformName
public static void glGetActiveSubroutineUniformName(int program, int shadertype, int index, int[] length, java.nio.ByteBuffer name)
Array version of:GetActiveSubroutineUniformName
-
glGetActiveSubroutineName
public static void glGetActiveSubroutineName(int program, int shadertype, int index, int[] length, java.nio.ByteBuffer name)
Array version of:GetActiveSubroutineName
-
glUniformSubroutinesuiv
public static void glUniformSubroutinesuiv(int shadertype, int[] indices)
Array version of:UniformSubroutinesuiv
-
glGetUniformSubroutineuiv
public static void glGetUniformSubroutineuiv(int shadertype, int location, int[] params)
Array version of:GetUniformSubroutineuiv
-
glGetProgramStageiv
public static void glGetProgramStageiv(int program, int shadertype, int pname, int[] values)
Array version of:GetProgramStageiv
-
-