Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.opengl;
import java.nio.*;
import org.lwjgl.system.*;
import static org.lwjgl.system.Checks.*;
import static org.lwjgl.system.JNI.*;
import static org.lwjgl.system.MemoryStack.*;
import static org.lwjgl.system.MemoryUtil.*;
/**
* 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 {@link ARBGPUShader5 ARB_gpu_shader5}. Promoted to core in {@link GL40 OpenGL 4.0}.
*/
public class ARBShaderSubroutine {
/** Accepted by the {@code pname} parameter of GetProgramStageiv. */
public static final int
GL_ACTIVE_SUBROUTINES = 0x8DE5,
GL_ACTIVE_SUBROUTINE_UNIFORMS = 0x8DE6,
GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS = 0x8E47,
GL_ACTIVE_SUBROUTINE_MAX_LENGTH = 0x8E48,
GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH = 0x8E49;
/** Accepted by the {@code pname} parameter of GetBooleanv, GetIntegerv, GetFloatv, GetDoublev, and GetInteger64v. */
public static final int
GL_MAX_SUBROUTINES = 0x8DE7,
GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS = 0x8DE8;
/** Accepted by the {@code pname} parameter of GetActiveSubroutineUniformiv. */
public static final int
GL_NUM_COMPATIBLE_SUBROUTINES = 0x8E4A,
GL_COMPATIBLE_SUBROUTINES = 0x8E4B;
static { GL.initialize(); }
protected ARBShaderSubroutine() {
throw new UnsupportedOperationException();
}
static boolean isAvailable(GLCapabilities caps) {
return checkFunctions(
caps.glGetSubroutineUniformLocation, caps.glGetSubroutineIndex, caps.glGetActiveSubroutineUniformiv, caps.glGetActiveSubroutineUniformName,
caps.glGetActiveSubroutineName, caps.glUniformSubroutinesuiv, caps.glGetUniformSubroutineuiv, caps.glGetProgramStageiv
);
}
// --- [ glGetSubroutineUniformLocation ] ---
/** Unsafe version of: {@link #glGetSubroutineUniformLocation GetSubroutineUniformLocation} */
public static native int nglGetSubroutineUniformLocation(int program, int shadertype, long name);
/**
* Retrieves the location of a subroutine uniform of a given shader stage within a program.
*
* @param program the name of the program containing shader stage
* @param shadertype the shader stage from which to query for subroutine uniform index. One of:
* @param name the name of the subroutine uniform whose index to query.
*/
@NativeType("GLint")
public static int glGetSubroutineUniformLocation(@NativeType("GLuint") int program, @NativeType("GLenum") int shadertype, @NativeType("const GLchar *") ByteBuffer name) {
if (CHECKS) {
checkNT1(name);
}
return nglGetSubroutineUniformLocation(program, shadertype, memAddress(name));
}
/**
* Retrieves the location of a subroutine uniform of a given shader stage within a program.
*
* @param program the name of the program containing shader stage
* @param shadertype the shader stage from which to query for subroutine uniform index. One of:
* @param name the name of the subroutine uniform whose index to query.
*/
@NativeType("GLint")
public static int glGetSubroutineUniformLocation(@NativeType("GLuint") int program, @NativeType("GLenum") int shadertype, @NativeType("const GLchar *") CharSequence name) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
ByteBuffer nameEncoded = stack.ASCII(name);
return nglGetSubroutineUniformLocation(program, shadertype, memAddress(nameEncoded));
} finally {
stack.setPointer(stackPointer);
}
}
// --- [ glGetSubroutineIndex ] ---
/** Unsafe version of: {@link #glGetSubroutineIndex GetSubroutineIndex} */
public static native int nglGetSubroutineIndex(int program, int shadertype, long name);
/**
* Retrieves the index of a subroutine function of a given shader stage within a program.
*
* @param program the name of the program containing shader stage
* @param shadertype the shader stage from which to query for subroutine function index. One of:
* @param name the name of the subroutine function whose index to query
*/
@NativeType("GLuint")
public static int glGetSubroutineIndex(@NativeType("GLuint") int program, @NativeType("GLenum") int shadertype, @NativeType("const GLchar *") ByteBuffer name) {
if (CHECKS) {
checkNT1(name);
}
return nglGetSubroutineIndex(program, shadertype, memAddress(name));
}
/**
* Retrieves the index of a subroutine function of a given shader stage within a program.
*
* @param program the name of the program containing shader stage
* @param shadertype the shader stage from which to query for subroutine function index. One of:
* @param name the name of the subroutine function whose index to query
*/
@NativeType("GLuint")
public static int glGetSubroutineIndex(@NativeType("GLuint") int program, @NativeType("GLenum") int shadertype, @NativeType("const GLchar *") CharSequence name) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
ByteBuffer nameEncoded = stack.ASCII(name);
return nglGetSubroutineIndex(program, shadertype, memAddress(nameEncoded));
} finally {
stack.setPointer(stackPointer);
}
}
// --- [ glGetActiveSubroutineUniformiv ] ---
/** Unsafe version of: {@link #glGetActiveSubroutineUniformiv GetActiveSubroutineUniformiv} */
public static native void nglGetActiveSubroutineUniformiv(int program, int shadertype, int index, int pname, long values);
/**
* Queries a property of an active shader subroutine uniform.
*
* @param program the name of the program containing the subroutine
* @param shadertype the shader stage from which to query for the subroutine parameter. One of:
* @param values the address of a buffer into which the queried value or values will be placed
*/
public static void glGetActiveSubroutineUniformiv(@NativeType("GLuint") int program, @NativeType("GLenum") int shadertype, @NativeType("GLuint") int index, @NativeType("GLenum") int pname, @NativeType("GLint *") IntBuffer values) {
if (CHECKS) {
check(values, 1);
}
nglGetActiveSubroutineUniformiv(program, shadertype, index, pname, memAddress(values));
}
/**
* Queries a property of an active shader subroutine uniform.
*
* @param program the name of the program containing the subroutine
* @param shadertype the shader stage from which to query for the subroutine parameter. One of:
*/
@NativeType("void")
public static int glGetActiveSubroutineUniformi(@NativeType("GLuint") int program, @NativeType("GLenum") int shadertype, @NativeType("GLuint") int index, @NativeType("GLenum") int pname) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
IntBuffer values = stack.callocInt(1);
nglGetActiveSubroutineUniformiv(program, shadertype, index, pname, memAddress(values));
return values.get(0);
} finally {
stack.setPointer(stackPointer);
}
}
// --- [ glGetActiveSubroutineUniformName ] ---
/**
* Unsafe version of: {@link #glGetActiveSubroutineUniformName GetActiveSubroutineUniformName}
*
* @param bufsize the size of the buffer whose address is given in {@code name}
*/
public static native void nglGetActiveSubroutineUniformName(int program, int shadertype, int index, int bufsize, long length, long name);
/**
* Queries the name of an active shader subroutine uniform.
*
* @param program the name of the program containing the subroutine
* @param shadertype the shader stage from which to query for the subroutine parameter. One of:
* @param index the index of the shader subroutine uniform
* @param length the address of a variable into which is written the number of characters copied into {@code name}
* @param name the address of a buffer that will receive the name of the specified shader subroutine uniform
*/
public static void glGetActiveSubroutineUniformName(@NativeType("GLuint") int program, @NativeType("GLenum") int shadertype, @NativeType("GLuint") int index, @NativeType("GLsizei *") IntBuffer length, @NativeType("GLchar *") ByteBuffer name) {
if (CHECKS) {
checkSafe(length, 1);
}
nglGetActiveSubroutineUniformName(program, shadertype, index, name.remaining(), memAddressSafe(length), memAddress(name));
}
/**
* Queries the name of an active shader subroutine uniform.
*
* @param program the name of the program containing the subroutine
* @param shadertype the shader stage from which to query for the subroutine parameter. One of:
* @param index the index of the shader subroutine uniform
* @param bufsize the size of the buffer whose address is given in {@code name}
*/
@NativeType("void")
public static String glGetActiveSubroutineUniformName(@NativeType("GLuint") int program, @NativeType("GLenum") int shadertype, @NativeType("GLuint") int index, @NativeType("GLsizei") int bufsize) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
IntBuffer length = stack.ints(0);
ByteBuffer name = stack.malloc(bufsize);
nglGetActiveSubroutineUniformName(program, shadertype, index, bufsize, memAddress(length), memAddress(name));
return memASCII(name, length.get(0));
} finally {
stack.setPointer(stackPointer);
}
}
/**
* Queries the name of an active shader subroutine uniform.
*
* @param program the name of the program containing the subroutine
* @param shadertype the shader stage from which to query for the subroutine parameter. One of:
* @param index the index of the shader subroutine uniform
*/
@NativeType("void")
public static String glGetActiveSubroutineUniformName(@NativeType("GLuint") int program, @NativeType("GLenum") int shadertype, @NativeType("GLuint") int index) {
return glGetActiveSubroutineUniformName(program, shadertype, index, glGetActiveSubroutineUniformi(program, shadertype, index, GL31.GL_UNIFORM_NAME_LENGTH));
}
// --- [ glGetActiveSubroutineName ] ---
/**
* Unsafe version of: {@link #glGetActiveSubroutineName GetActiveSubroutineName}
*
* @param bufsize the size of the buffer whose address is given in {@code name}
*/
public static native void nglGetActiveSubroutineName(int program, int shadertype, int index, int bufsize, long length, long name);
/**
* Queries the name of an active shader subroutine.
*
* @param program the name of the program containing the subroutine
* @param shadertype the shader stage from which to query the subroutine name. One of:
* @param index the index of the shader subroutine uniform
* @param length a variable which is to receive the length of the shader subroutine uniform name
* @param name an array into which the name of the shader subroutine uniform will be written
*/
public static void glGetActiveSubroutineName(@NativeType("GLuint") int program, @NativeType("GLenum") int shadertype, @NativeType("GLuint") int index, @NativeType("GLsizei *") IntBuffer length, @NativeType("GLchar *") ByteBuffer name) {
if (CHECKS) {
checkSafe(length, 1);
}
nglGetActiveSubroutineName(program, shadertype, index, name.remaining(), memAddressSafe(length), memAddress(name));
}
/**
* Queries the name of an active shader subroutine.
*
* @param program the name of the program containing the subroutine
* @param shadertype the shader stage from which to query the subroutine name. One of:
* @param index the index of the shader subroutine uniform
* @param bufsize the size of the buffer whose address is given in {@code name}
*/
@NativeType("void")
public static String glGetActiveSubroutineName(@NativeType("GLuint") int program, @NativeType("GLenum") int shadertype, @NativeType("GLuint") int index, @NativeType("GLsizei") int bufsize) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
IntBuffer length = stack.ints(0);
ByteBuffer name = stack.malloc(bufsize);
nglGetActiveSubroutineName(program, shadertype, index, bufsize, memAddress(length), memAddress(name));
return memASCII(name, length.get(0));
} finally {
stack.setPointer(stackPointer);
}
}
/**
* Queries the name of an active shader subroutine.
*
* @param program the name of the program containing the subroutine
* @param shadertype the shader stage from which to query the subroutine name. One of:
* @param index the index of the shader subroutine uniform
*/
@NativeType("void")
public static String glGetActiveSubroutineName(@NativeType("GLuint") int program, @NativeType("GLenum") int shadertype, @NativeType("GLuint") int index) {
return glGetActiveSubroutineName(program, shadertype, index, glGetProgramStagei(program, shadertype, GL_ACTIVE_SUBROUTINE_MAX_LENGTH));
}
// --- [ glUniformSubroutinesuiv ] ---
/**
* Unsafe version of: {@link #glUniformSubroutinesuiv UniformSubroutinesuiv}
*
* @param count the number of uniform indices stored in {@code indices}
*/
public static native void nglUniformSubroutinesuiv(int shadertype, int count, long indices);
/**
* Loads active subroutine uniforms.
*
* @param shadertype the shader stage to update. One of:
* @param indices an array holding the indices to load into the shader subroutine variables
*/
public static void glUniformSubroutinesuiv(@NativeType("GLenum") int shadertype, @NativeType("const GLuint *") IntBuffer indices) {
nglUniformSubroutinesuiv(shadertype, indices.remaining(), memAddress(indices));
}
/**
* Loads active subroutine uniforms.
*
* @param shadertype the shader stage to update. One of:
*/
public static void glUniformSubroutinesui(@NativeType("GLenum") int shadertype, @NativeType("const GLuint *") int index) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
IntBuffer indices = stack.ints(index);
nglUniformSubroutinesuiv(shadertype, 1, memAddress(indices));
} finally {
stack.setPointer(stackPointer);
}
}
// --- [ glGetUniformSubroutineuiv ] ---
/** Unsafe version of: {@link #glGetUniformSubroutineuiv GetUniformSubroutineuiv} */
public static native void nglGetUniformSubroutineuiv(int shadertype, int location, long params);
/**
* Retrieves the value of a subroutine uniform of a given shader stage of the current program.
*
* @param shadertype the shader stage from which to query for subroutine uniform index. One of:
* @param location the location of the subroutine uniform
* @param params a variable to receive the value or values of the subroutine uniform
*/
public static void glGetUniformSubroutineuiv(@NativeType("GLenum") int shadertype, @NativeType("GLint") int location, @NativeType("GLuint *") IntBuffer params) {
if (CHECKS) {
check(params, 1);
}
nglGetUniformSubroutineuiv(shadertype, location, memAddress(params));
}
/**
* Retrieves the value of a subroutine uniform of a given shader stage of the current program.
*
* @param shadertype the shader stage from which to query for subroutine uniform index. One of:
* @param location the location of the subroutine uniform
*/
@NativeType("void")
public static int glGetUniformSubroutineui(@NativeType("GLenum") int shadertype, @NativeType("GLint") int location) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
try {
IntBuffer params = stack.callocInt(1);
nglGetUniformSubroutineuiv(shadertype, location, memAddress(params));
return params.get(0);
} finally {
stack.setPointer(stackPointer);
}
}
// --- [ glGetProgramStageiv ] ---
/** Unsafe version of: {@link #glGetProgramStageiv GetProgramStageiv} */
public static native void nglGetProgramStageiv(int program, int shadertype, int pname, long values);
/**
* Retrieves properties of a program object corresponding to a specified shader stage.
*
* @param program the name of the program containing shader stage
* @param shadertype the shader stage from which to query for the subroutine parameter. One of:
* @param values a variable into which the queried value or values will be placed
*/
public static void glGetProgramStageiv(@NativeType("GLuint") int program, @NativeType("GLenum") int shadertype, @NativeType("GLenum") int pname, @NativeType("GLint *") IntBuffer values) {
if (CHECKS) {
check(values, 1);
}
nglGetProgramStageiv(program, shadertype, pname, memAddress(values));
}
/**
* Retrieves properties of a program object corresponding to a specified shader stage.
*
* @param program the name of the program containing shader stage
* @param shadertype the shader stage from which to query for the subroutine parameter. One of: