Class ARBShaderSubroutine

java.lang.Object
org.lwjgl.opengl.ARBShaderSubroutine

public class ARBShaderSubroutine extends 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 Details

    • GL_ACTIVE_SUBROUTINES

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

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

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

      public static final int GL_ACTIVE_SUBROUTINE_MAX_LENGTH
      Accepted by the pname parameter of GetProgramStageiv.
      See Also:
    • 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:
    • GL_MAX_SUBROUTINES

      public static final int GL_MAX_SUBROUTINES
      Accepted by the pname parameter of GetBooleanv, GetIntegerv, GetFloatv, GetDoublev, and GetInteger64v.
      See Also:
    • 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:
    • GL_NUM_COMPATIBLE_SUBROUTINES

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

      public static final int GL_COMPATIBLE_SUBROUTINES
      Accepted by the pname parameter of GetActiveSubroutineUniformiv.
      See Also:
  • Method Details

    • nglGetSubroutineUniformLocation

      public static int nglGetSubroutineUniformLocation(int program, int shadertype, long name)
      Unsafe version of: GetSubroutineUniformLocation
    • glGetSubroutineUniformLocation

      public static int glGetSubroutineUniformLocation(int program, int shadertype, 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, 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.
    • nglGetSubroutineIndex

      public static int nglGetSubroutineIndex(int program, int shadertype, long name)
      Unsafe version of: GetSubroutineIndex
    • glGetSubroutineIndex

      public static int glGetSubroutineIndex(int program, int shadertype, 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, 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
    • nglGetActiveSubroutineUniformiv

      public static void nglGetActiveSubroutineUniformiv(int program, int shadertype, int index, int pname, long values)
      Unsafe version of: GetActiveSubroutineUniformiv
    • glGetActiveSubroutineUniformiv

      public static void glGetActiveSubroutineUniformiv(int program, int shadertype, int index, int pname, IntBuffer values)
      Queries a property 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
      pname - the parameter of the shader subroutine uniform to query. One of:
      NUM_COMPATIBLE_SUBROUTINESCOMPATIBLE_SUBROUTINESUNIFORM_SIZEUNIFORM_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 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
      pname - the parameter of the shader subroutine uniform to query. One of:
      NUM_COMPATIBLE_SUBROUTINESCOMPATIBLE_SUBROUTINESUNIFORM_SIZEUNIFORM_NAME_LENGTH
    • nglGetActiveSubroutineUniformName

      public static void nglGetActiveSubroutineUniformName(int program, int shadertype, int index, int bufsize, long length, long name)
      Parameters:
      bufsize - the size of the buffer whose address is given in name
    • glGetActiveSubroutineUniformName

      public static void glGetActiveSubroutineUniformName(int program, int shadertype, int index, @Nullable IntBuffer length, 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 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 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
    • nglGetActiveSubroutineName

      public static void nglGetActiveSubroutineName(int program, int shadertype, int index, int bufsize, long length, long name)
      Unsafe version of: GetActiveSubroutineName
      Parameters:
      bufsize - the size of the buffer whose address is given in name
    • glGetActiveSubroutineName

      public static void glGetActiveSubroutineName(int program, int shadertype, int index, @Nullable IntBuffer length, 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 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 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
    • nglUniformSubroutinesuiv

      public static void nglUniformSubroutinesuiv(int shadertype, int count, long indices)
      Unsafe version of: UniformSubroutinesuiv
      Parameters:
      count - the number of uniform indices stored in indices
    • glUniformSubroutinesuiv

      public static void glUniformSubroutinesuiv(int shadertype, IntBuffer indices)
      Loads active subroutine uniforms.
      Parameters:
      shadertype - the shader stage to update. One of:
      VERTEX_SHADERFRAGMENT_SHADERGEOMETRY_SHADERTESS_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_SHADERFRAGMENT_SHADERGEOMETRY_SHADERTESS_CONTROL_SHADER
      TESS_EVALUATION_SHADER
    • nglGetUniformSubroutineuiv

      public static void nglGetUniformSubroutineuiv(int shadertype, int location, long params)
      Unsafe version of: GetUniformSubroutineuiv
    • glGetUniformSubroutineuiv

      public static void glGetUniformSubroutineuiv(int shadertype, int location, 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
    • nglGetProgramStageiv

      public static void nglGetProgramStageiv(int program, int shadertype, int pname, long values)
      Unsafe version of: GetProgramStageiv
    • glGetProgramStageiv

      public static void glGetProgramStageiv(int program, int shadertype, int pname, IntBuffer values)
      Retrieves properties of a program object corresponding to a specified shader stage.
      Parameters:
      program - the name of the program containing shader stage
      shadertype - the shader stage from which to query for the subroutine parameter. One of:
      VERTEX_SHADERFRAGMENT_SHADERGEOMETRY_SHADERTESS_CONTROL_SHADER
      TESS_EVALUATION_SHADER
      pname - the parameter of the shader to query. One of:
      ACTIVE_SUBROUTINESACTIVE_SUBROUTINE_UNIFORMS
      ACTIVE_SUBROUTINE_UNIFORM_LOCATIONSACTIVE_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 stage
      shadertype - the shader stage from which to query for the subroutine parameter. One of:
      VERTEX_SHADERFRAGMENT_SHADERGEOMETRY_SHADERTESS_CONTROL_SHADER
      TESS_EVALUATION_SHADER
      pname - the parameter of the shader to query. One of:
      ACTIVE_SUBROUTINESACTIVE_SUBROUTINE_UNIFORMS
      ACTIVE_SUBROUTINE_UNIFORM_LOCATIONSACTIVE_SUBROUTINE_MAX_LENGTH
      ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH
    • 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, @Nullable int[] length, ByteBuffer name)
    • glGetActiveSubroutineName

      public static void glGetActiveSubroutineName(int program, int shadertype, int index, @Nullable int[] length, 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