org.lwjgl.opengl.ARBMultiDrawIndirect Maven / Gradle / Ivy
Show all versions of lwjgl-opengl Show documentation
/*
* 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.MemoryUtil.*;
/**
* Native bindings to the ARB_multi_draw_indirect extension.
*
* The {@link ARBDrawIndirect ARB_draw_indirect} extension (included in OpenGL 4.0) introduced mechanisms whereby the parameters for a draw function may be provided in a
* structure contained in a buffer object rather than as parameters to the drawing procedure. This is known as an indirect draw and is exposed as two new
* functions, {@link ARBDrawIndirect#glDrawArraysIndirect DrawArraysIndirect} and {@link ARBDrawIndirect#glDrawElementsIndirect DrawElementsIndirect}. Each of these functions generates a single batch of
* primitives.
*
* This extension builds on this functionality by providing procedures to invoke multiple draws from a single procedure call. This allows large batches of
* drawing commands to be assembled in server memory (via a buffer object) which may then be dispatched through a single function call.
*
* Requires {@link GL40 OpenGL 4.0} or {@link ARBDrawIndirect ARB_draw_indirect}. Promoted to core in {@link GL43 OpenGL 4.3}.
*/
public class ARBMultiDrawIndirect {
static { GL.initialize(); }
protected ARBMultiDrawIndirect() {
throw new UnsupportedOperationException();
}
static boolean isAvailable(GLCapabilities caps) {
return checkFunctions(
caps.glMultiDrawArraysIndirect, caps.glMultiDrawElementsIndirect
);
}
// --- [ glMultiDrawArraysIndirect ] ---
/** Unsafe version of: {@link #glMultiDrawArraysIndirect MultiDrawArraysIndirect} */
public static native void nglMultiDrawArraysIndirect(int mode, long indirect, int primcount, int stride);
/**
* Renders multiple sets of primitives from array data, taking parameters from memory.
*
* The parameters addressed by {@code indirect} are packed into an array of structures, each element of which takes the form (in C):
*
*
* typedef struct {
* uint count;
* uint primCount;
* uint first;
* uint baseInstance;
* } DrawArraysIndirectCommand;
*
* A single call to {@code glMultiDrawArraysIndirect} is equivalent, assuming no errors are generated to:
*
*
* const ubyte *ptr = (const ubyte *)indirect;
* for ( i = 0; i < primcount; i++ ) {
* DrawArraysIndirect(mode, (DrawArraysIndirectCommand*)ptr);
* if ( stride == 0 )
* ptr += sizeof(DrawArraysIndirectCommand);
* else
* ptr += stride;
* }
*
* @param mode what kind of primitives to render. One of:
{@link GL11#GL_POINTS POINTS} {@link GL11#GL_LINE_STRIP LINE_STRIP} {@link GL11#GL_LINE_LOOP LINE_LOOP} {@link GL11#GL_LINES LINES} {@link GL11#GL_POLYGON POLYGON} {@link GL11#GL_TRIANGLE_STRIP TRIANGLE_STRIP} {@link GL11#GL_TRIANGLE_FAN TRIANGLE_FAN} {@link GL11#GL_TRIANGLES TRIANGLES} {@link GL11#GL_QUAD_STRIP QUAD_STRIP} {@link GL11#GL_QUADS QUADS} {@link GL32#GL_LINES_ADJACENCY LINES_ADJACENCY} {@link GL32#GL_LINE_STRIP_ADJACENCY LINE_STRIP_ADJACENCY} {@link GL32#GL_TRIANGLES_ADJACENCY TRIANGLES_ADJACENCY} {@link GL32#GL_TRIANGLE_STRIP_ADJACENCY TRIANGLE_STRIP_ADJACENCY} {@link GL40#GL_PATCHES PATCHES}
* @param indirect an array of structures containing the draw parameters
* @param primcount the number of elements in the array of draw parameter structures
* @param stride the distance in basic machine units between elements of the draw parameter array
*/
public static void glMultiDrawArraysIndirect(@NativeType("GLenum") int mode, @NativeType("const void *") ByteBuffer indirect, @NativeType("GLsizei") int primcount, @NativeType("GLsizei") int stride) {
if (CHECKS) {
check(indirect, primcount * (stride == 0 ? (4 * 4) : stride));
}
nglMultiDrawArraysIndirect(mode, memAddress(indirect), primcount, stride);
}
/**
* Renders multiple sets of primitives from array data, taking parameters from memory.
*
* The parameters addressed by {@code indirect} are packed into an array of structures, each element of which takes the form (in C):
*
*
* typedef struct {
* uint count;
* uint primCount;
* uint first;
* uint baseInstance;
* } DrawArraysIndirectCommand;
*
* A single call to {@code glMultiDrawArraysIndirect} is equivalent, assuming no errors are generated to:
*
*
* const ubyte *ptr = (const ubyte *)indirect;
* for ( i = 0; i < primcount; i++ ) {
* DrawArraysIndirect(mode, (DrawArraysIndirectCommand*)ptr);
* if ( stride == 0 )
* ptr += sizeof(DrawArraysIndirectCommand);
* else
* ptr += stride;
* }
*
* @param mode what kind of primitives to render. One of:
{@link GL11#GL_POINTS POINTS} {@link GL11#GL_LINE_STRIP LINE_STRIP} {@link GL11#GL_LINE_LOOP LINE_LOOP} {@link GL11#GL_LINES LINES} {@link GL11#GL_POLYGON POLYGON} {@link GL11#GL_TRIANGLE_STRIP TRIANGLE_STRIP} {@link GL11#GL_TRIANGLE_FAN TRIANGLE_FAN} {@link GL11#GL_TRIANGLES TRIANGLES} {@link GL11#GL_QUAD_STRIP QUAD_STRIP} {@link GL11#GL_QUADS QUADS} {@link GL32#GL_LINES_ADJACENCY LINES_ADJACENCY} {@link GL32#GL_LINE_STRIP_ADJACENCY LINE_STRIP_ADJACENCY} {@link GL32#GL_TRIANGLES_ADJACENCY TRIANGLES_ADJACENCY} {@link GL32#GL_TRIANGLE_STRIP_ADJACENCY TRIANGLE_STRIP_ADJACENCY} {@link GL40#GL_PATCHES PATCHES}
* @param indirect an array of structures containing the draw parameters
* @param primcount the number of elements in the array of draw parameter structures
* @param stride the distance in basic machine units between elements of the draw parameter array
*/
public static void glMultiDrawArraysIndirect(@NativeType("GLenum") int mode, @NativeType("const void *") long indirect, @NativeType("GLsizei") int primcount, @NativeType("GLsizei") int stride) {
nglMultiDrawArraysIndirect(mode, indirect, primcount, stride);
}
/**
* Renders multiple sets of primitives from array data, taking parameters from memory.
*
* The parameters addressed by {@code indirect} are packed into an array of structures, each element of which takes the form (in C):
*
*
* typedef struct {
* uint count;
* uint primCount;
* uint first;
* uint baseInstance;
* } DrawArraysIndirectCommand;
*
* A single call to {@code glMultiDrawArraysIndirect} is equivalent, assuming no errors are generated to:
*
*
* const ubyte *ptr = (const ubyte *)indirect;
* for ( i = 0; i < primcount; i++ ) {
* DrawArraysIndirect(mode, (DrawArraysIndirectCommand*)ptr);
* if ( stride == 0 )
* ptr += sizeof(DrawArraysIndirectCommand);
* else
* ptr += stride;
* }
*
* @param mode what kind of primitives to render. One of:
{@link GL11#GL_POINTS POINTS} {@link GL11#GL_LINE_STRIP LINE_STRIP} {@link GL11#GL_LINE_LOOP LINE_LOOP} {@link GL11#GL_LINES LINES} {@link GL11#GL_POLYGON POLYGON} {@link GL11#GL_TRIANGLE_STRIP TRIANGLE_STRIP} {@link GL11#GL_TRIANGLE_FAN TRIANGLE_FAN} {@link GL11#GL_TRIANGLES TRIANGLES} {@link GL11#GL_QUAD_STRIP QUAD_STRIP} {@link GL11#GL_QUADS QUADS} {@link GL32#GL_LINES_ADJACENCY LINES_ADJACENCY} {@link GL32#GL_LINE_STRIP_ADJACENCY LINE_STRIP_ADJACENCY} {@link GL32#GL_TRIANGLES_ADJACENCY TRIANGLES_ADJACENCY} {@link GL32#GL_TRIANGLE_STRIP_ADJACENCY TRIANGLE_STRIP_ADJACENCY} {@link GL40#GL_PATCHES PATCHES}
* @param indirect an array of structures containing the draw parameters
* @param primcount the number of elements in the array of draw parameter structures
* @param stride the distance in basic machine units between elements of the draw parameter array
*/
public static void glMultiDrawArraysIndirect(@NativeType("GLenum") int mode, @NativeType("const void *") IntBuffer indirect, @NativeType("GLsizei") int primcount, @NativeType("GLsizei") int stride) {
if (CHECKS) {
check(indirect, (primcount * (stride == 0 ? (4 * 4) : stride)) >> 2);
}
nglMultiDrawArraysIndirect(mode, memAddress(indirect), primcount, stride);
}
// --- [ glMultiDrawElementsIndirect ] ---
/** Unsafe version of: {@link #glMultiDrawElementsIndirect MultiDrawElementsIndirect} */
public static native void nglMultiDrawElementsIndirect(int mode, int type, long indirect, int primcount, int stride);
/**
* Renders multiple indexed primitives from array data, taking parameters from memory.
*
* The parameters addressed by indirect are packed into a structure that takes the form (in C):
*
*
* typedef struct {
* uint count;
* uint primCount;
* uint firstIndex;
* uint baseVertex;
* uint baseInstance;
* } DrawElementsIndirectCommand;
*
* A single call to {@code glMultiDrawElementsIndirect} is equivalent, assuming no errors are generated to:
*
*
* const ubyte *ptr = (const ubyte *)indirect;
* for ( i = 0; i < primcount; i++ ) {
* DrawElementsIndirect(mode, type, (DrawElementsIndirectCommand *)ptr);
* if ( stride == 0 )
* ptr += sizeof(DrawElementsIndirectCommand);
* else
* ptr += stride;
* }
*
* @param mode what kind of primitives to render. One of:
{@link GL11#GL_POINTS POINTS} {@link GL11#GL_LINE_STRIP LINE_STRIP} {@link GL11#GL_LINE_LOOP LINE_LOOP} {@link GL11#GL_LINES LINES} {@link GL11#GL_POLYGON POLYGON} {@link GL11#GL_TRIANGLE_STRIP TRIANGLE_STRIP} {@link GL11#GL_TRIANGLE_FAN TRIANGLE_FAN} {@link GL11#GL_TRIANGLES TRIANGLES} {@link GL11#GL_QUAD_STRIP QUAD_STRIP} {@link GL11#GL_QUADS QUADS} {@link GL32#GL_LINES_ADJACENCY LINES_ADJACENCY} {@link GL32#GL_LINE_STRIP_ADJACENCY LINE_STRIP_ADJACENCY} {@link GL32#GL_TRIANGLES_ADJACENCY TRIANGLES_ADJACENCY} {@link GL32#GL_TRIANGLE_STRIP_ADJACENCY TRIANGLE_STRIP_ADJACENCY} {@link GL40#GL_PATCHES PATCHES}
* @param type the type of data in the buffer bound to the GL_ELEMENT_ARRAY_BUFFER binding. One of:
{@link GL11#GL_UNSIGNED_BYTE UNSIGNED_BYTE} {@link GL11#GL_UNSIGNED_SHORT UNSIGNED_SHORT} {@link GL11#GL_UNSIGNED_INT UNSIGNED_INT}
* @param indirect a structure containing an array of draw parameters
* @param primcount the number of elements in the array addressed by {@code indirect}
* @param stride the distance in basic machine units between elements of the draw parameter array
*/
public static void glMultiDrawElementsIndirect(@NativeType("GLenum") int mode, @NativeType("GLenum") int type, @NativeType("const void *") ByteBuffer indirect, @NativeType("GLsizei") int primcount, @NativeType("GLsizei") int stride) {
if (CHECKS) {
check(indirect, primcount * (stride == 0 ? (5 * 4) : stride));
}
nglMultiDrawElementsIndirect(mode, type, memAddress(indirect), primcount, stride);
}
/**
* Renders multiple indexed primitives from array data, taking parameters from memory.
*
* The parameters addressed by indirect are packed into a structure that takes the form (in C):
*
*
* typedef struct {
* uint count;
* uint primCount;
* uint firstIndex;
* uint baseVertex;
* uint baseInstance;
* } DrawElementsIndirectCommand;
*
* A single call to {@code glMultiDrawElementsIndirect} is equivalent, assuming no errors are generated to:
*
*
* const ubyte *ptr = (const ubyte *)indirect;
* for ( i = 0; i < primcount; i++ ) {
* DrawElementsIndirect(mode, type, (DrawElementsIndirectCommand *)ptr);
* if ( stride == 0 )
* ptr += sizeof(DrawElementsIndirectCommand);
* else
* ptr += stride;
* }
*
* @param mode what kind of primitives to render. One of:
{@link GL11#GL_POINTS POINTS} {@link GL11#GL_LINE_STRIP LINE_STRIP} {@link GL11#GL_LINE_LOOP LINE_LOOP} {@link GL11#GL_LINES LINES} {@link GL11#GL_POLYGON POLYGON} {@link GL11#GL_TRIANGLE_STRIP TRIANGLE_STRIP} {@link GL11#GL_TRIANGLE_FAN TRIANGLE_FAN} {@link GL11#GL_TRIANGLES TRIANGLES} {@link GL11#GL_QUAD_STRIP QUAD_STRIP} {@link GL11#GL_QUADS QUADS} {@link GL32#GL_LINES_ADJACENCY LINES_ADJACENCY} {@link GL32#GL_LINE_STRIP_ADJACENCY LINE_STRIP_ADJACENCY} {@link GL32#GL_TRIANGLES_ADJACENCY TRIANGLES_ADJACENCY} {@link GL32#GL_TRIANGLE_STRIP_ADJACENCY TRIANGLE_STRIP_ADJACENCY} {@link GL40#GL_PATCHES PATCHES}
* @param type the type of data in the buffer bound to the GL_ELEMENT_ARRAY_BUFFER binding. One of:
{@link GL11#GL_UNSIGNED_BYTE UNSIGNED_BYTE} {@link GL11#GL_UNSIGNED_SHORT UNSIGNED_SHORT} {@link GL11#GL_UNSIGNED_INT UNSIGNED_INT}
* @param indirect a structure containing an array of draw parameters
* @param primcount the number of elements in the array addressed by {@code indirect}
* @param stride the distance in basic machine units between elements of the draw parameter array
*/
public static void glMultiDrawElementsIndirect(@NativeType("GLenum") int mode, @NativeType("GLenum") int type, @NativeType("const void *") long indirect, @NativeType("GLsizei") int primcount, @NativeType("GLsizei") int stride) {
nglMultiDrawElementsIndirect(mode, type, indirect, primcount, stride);
}
/**
* Renders multiple indexed primitives from array data, taking parameters from memory.
*
* The parameters addressed by indirect are packed into a structure that takes the form (in C):
*
*
* typedef struct {
* uint count;
* uint primCount;
* uint firstIndex;
* uint baseVertex;
* uint baseInstance;
* } DrawElementsIndirectCommand;
*
* A single call to {@code glMultiDrawElementsIndirect} is equivalent, assuming no errors are generated to:
*
*
* const ubyte *ptr = (const ubyte *)indirect;
* for ( i = 0; i < primcount; i++ ) {
* DrawElementsIndirect(mode, type, (DrawElementsIndirectCommand *)ptr);
* if ( stride == 0 )
* ptr += sizeof(DrawElementsIndirectCommand);
* else
* ptr += stride;
* }
*
* @param mode what kind of primitives to render. One of:
{@link GL11#GL_POINTS POINTS} {@link GL11#GL_LINE_STRIP LINE_STRIP} {@link GL11#GL_LINE_LOOP LINE_LOOP} {@link GL11#GL_LINES LINES} {@link GL11#GL_POLYGON POLYGON} {@link GL11#GL_TRIANGLE_STRIP TRIANGLE_STRIP} {@link GL11#GL_TRIANGLE_FAN TRIANGLE_FAN} {@link GL11#GL_TRIANGLES TRIANGLES} {@link GL11#GL_QUAD_STRIP QUAD_STRIP} {@link GL11#GL_QUADS QUADS} {@link GL32#GL_LINES_ADJACENCY LINES_ADJACENCY} {@link GL32#GL_LINE_STRIP_ADJACENCY LINE_STRIP_ADJACENCY} {@link GL32#GL_TRIANGLES_ADJACENCY TRIANGLES_ADJACENCY} {@link GL32#GL_TRIANGLE_STRIP_ADJACENCY TRIANGLE_STRIP_ADJACENCY} {@link GL40#GL_PATCHES PATCHES}
* @param type the type of data in the buffer bound to the GL_ELEMENT_ARRAY_BUFFER binding. One of:
{@link GL11#GL_UNSIGNED_BYTE UNSIGNED_BYTE} {@link GL11#GL_UNSIGNED_SHORT UNSIGNED_SHORT} {@link GL11#GL_UNSIGNED_INT UNSIGNED_INT}
* @param indirect a structure containing an array of draw parameters
* @param primcount the number of elements in the array addressed by {@code indirect}
* @param stride the distance in basic machine units between elements of the draw parameter array
*/
public static void glMultiDrawElementsIndirect(@NativeType("GLenum") int mode, @NativeType("GLenum") int type, @NativeType("const void *") IntBuffer indirect, @NativeType("GLsizei") int primcount, @NativeType("GLsizei") int stride) {
if (CHECKS) {
check(indirect, (primcount * (stride == 0 ? (5 * 4) : stride)) >> 2);
}
nglMultiDrawElementsIndirect(mode, type, memAddress(indirect), primcount, stride);
}
/** Array version of: {@link #glMultiDrawArraysIndirect MultiDrawArraysIndirect} */
public static void glMultiDrawArraysIndirect(@NativeType("GLenum") int mode, @NativeType("const void *") int[] indirect, @NativeType("GLsizei") int primcount, @NativeType("GLsizei") int stride) {
long __functionAddress = GL.getICD().glMultiDrawArraysIndirect;
if (CHECKS) {
check(__functionAddress);
check(indirect, (primcount * (stride == 0 ? (4 * 4) : stride)) >> 2);
}
callPV(__functionAddress, mode, indirect, primcount, stride);
}
/** Array version of: {@link #glMultiDrawElementsIndirect MultiDrawElementsIndirect} */
public static void glMultiDrawElementsIndirect(@NativeType("GLenum") int mode, @NativeType("GLenum") int type, @NativeType("const void *") int[] indirect, @NativeType("GLsizei") int primcount, @NativeType("GLsizei") int stride) {
long __functionAddress = GL.getICD().glMultiDrawElementsIndirect;
if (CHECKS) {
check(__functionAddress);
check(indirect, (primcount * (stride == 0 ? (5 * 4) : stride)) >> 2);
}
callPV(__functionAddress, mode, type, indirect, primcount, stride);
}
}