Class 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 in OpenGL 4.0.

    • Field Detail

      • GL_ACTIVE_SUBROUTINES

        public static final int GL_ACTIVE_SUBROUTINES
        Accepted by the pname parameter of GetProgramStageiv.
        See Also:
        Constant Field Values
      • GL_ACTIVE_SUBROUTINE_UNIFORMS

        public static final int GL_ACTIVE_SUBROUTINE_UNIFORMS
        Accepted by the pname parameter of GetProgramStageiv.
        See Also:
        Constant Field Values
      • GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS

        public static final int GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS
        Accepted by the pname parameter of GetProgramStageiv.
        See Also:
        Constant Field Values
      • GL_ACTIVE_SUBROUTINE_MAX_LENGTH

        public static final int GL_ACTIVE_SUBROUTINE_MAX_LENGTH
        Accepted by the pname parameter of GetProgramStageiv.
        See Also:
        Constant Field Values
      • GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH

        public static final int GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH
        Accepted by the pname parameter of GetProgramStageiv.
        See Also:
        Constant Field Values
      • GL_MAX_SUBROUTINES

        public static final int GL_MAX_SUBROUTINES
        Accepted by the pname parameter of GetBooleanv, GetIntegerv, GetFloatv, GetDoublev, and GetInteger64v.
        See Also:
        Constant Field Values
      • GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS

        public static final int GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS
        Accepted by the pname parameter of GetBooleanv, GetIntegerv, GetFloatv, GetDoublev, and GetInteger64v.
        See Also:
        Constant Field Values
      • GL_NUM_COMPATIBLE_SUBROUTINES

        public static final int GL_NUM_COMPATIBLE_SUBROUTINES
        Accepted by the pname parameter of GetActiveSubroutineUniformiv.
        See Also:
        Constant Field Values
      • GL_COMPATIBLE_SUBROUTINES

        public static final int GL_COMPATIBLE_SUBROUTINES
        Accepted by the pname parameter of GetActiveSubroutineUniformiv.
        See Also:
        Constant Field Values
    • Method Detail

      • glGetSubroutineUniformLocation

        public 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.
        Parameters:
        program - the name of the program containing shader stage
        shadertype - the shader stage from which to query for subroutine uniform index. One of:
        VERTEX_SHADERFRAGMENT_SHADERGEOMETRY_SHADERTESS_CONTROL_SHADER
        TESS_EVALUATION_SHADER
        name - the name of the subroutine uniform whose index to query.
      • glGetSubroutineUniformLocation

        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 stage
        shadertype - the shader stage from which to query for subroutine uniform index. One of:
        VERTEX_SHADERFRAGMENT_SHADERGEOMETRY_SHADERTESS_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)
        Retrieves the index of a subroutine function of a given shader stage within a program.
        Parameters:
        program - the name of the program containing shader stage
        shadertype - the shader stage from which to query for subroutine function index. One of:
        VERTEX_SHADERFRAGMENT_SHADERGEOMETRY_SHADERTESS_CONTROL_SHADER
        TESS_EVALUATION_SHADER
        name - the name of the subroutine function whose index to query
      • glGetSubroutineIndex

        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 stage
        shadertype - the shader stage from which to query for subroutine function index. One of:
        VERTEX_SHADERFRAGMENT_SHADERGEOMETRY_SHADERTESS_CONTROL_SHADER
        TESS_EVALUATION_SHADER
        name - the name of the subroutine function whose index to query
      • 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 subroutine
        shadertype - the shader stage from which to query for the subroutine parameter. One of:
        VERTEX_SHADERFRAGMENT_SHADERGEOMETRY_SHADERTESS_CONTROL_SHADER
        TESS_EVALUATION_SHADER
        index - the index of the shader subroutine uniform
        length - the address of a variable into which is written the number of characters copied into name
        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 subroutine
        shadertype - the shader stage from which to query for the subroutine parameter. One of:
        VERTEX_SHADERFRAGMENT_SHADERGEOMETRY_SHADERTESS_CONTROL_SHADER
        TESS_EVALUATION_SHADER
        index - the index of the shader subroutine uniform
        bufsize - the size of the buffer whose address is given in name
      • 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 subroutine
        shadertype - the shader stage from which to query for the subroutine parameter. One of:
        VERTEX_SHADERFRAGMENT_SHADERGEOMETRY_SHADERTESS_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 subroutine
        shadertype - the shader stage from which to query the subroutine name. One of:
        VERTEX_SHADERFRAGMENT_SHADERGEOMETRY_SHADERTESS_CONTROL_SHADER
        TESS_EVALUATION_SHADER
        index - the index of the shader subroutine uniform
        length - a variable which is to receive the length of the shader subroutine uniform name
        name - 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 subroutine
        shadertype - the shader stage from which to query the subroutine name. One of:
        VERTEX_SHADERFRAGMENT_SHADERGEOMETRY_SHADERTESS_CONTROL_SHADER
        TESS_EVALUATION_SHADER
        index - the index of the shader subroutine uniform
        bufsize - the size of the buffer whose address is given in name
      • 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 subroutine
        shadertype - the shader stage from which to query the subroutine name. One of:
        VERTEX_SHADERFRAGMENT_SHADERGEOMETRY_SHADERTESS_CONTROL_SHADER
        TESS_EVALUATION_SHADER
        index - the index of the shader subroutine uniform
      • 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_SHADERFRAGMENT_SHADERGEOMETRY_SHADERTESS_CONTROL_SHADER
        TESS_EVALUATION_SHADER
        location - the location of the subroutine uniform
        params - 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_SHADERFRAGMENT_SHADERGEOMETRY_SHADERTESS_CONTROL_SHADER
        TESS_EVALUATION_SHADER
        location - the location of the subroutine uniform
      • glGetActiveSubroutineUniformiv

        public static void glGetActiveSubroutineUniformiv(int program,
                                                          int shadertype,
                                                          int index,
                                                          int pname,
                                                          int[] values)
      • glGetActiveSubroutineUniformName

        public static void glGetActiveSubroutineUniformName(int program,
                                                            int shadertype,
                                                            int index,
                                                            int[] length,
                                                            java.nio.ByteBuffer name)
      • 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