org.lwjgl.opengles.ANGLETranslatedShaderSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lwjgl-opengles Show documentation
Show all versions of lwjgl-opengles Show documentation
A royalty-free, cross-platform API for full-function 2D and 3D graphics on embedded systems - including consoles, phones, appliances and vehicles.
/*
* Copyright LWJGL. All rights reserved.
* License terms: https://www.lwjgl.org/license
* MACHINE GENERATED FILE, DO NOT EDIT
*/
package org.lwjgl.opengles;
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 ANGLE_translated_shader_source extension.
*
* WebGL uses the GLSL ES 2.0 spec on all platforms, and translates these shaders to the host platform's native language (HLSL, GLSL, and even GLSL ES).
* For debugging purposes, it is useful to be able to examine the shader after translation.
*
* This extension addes a new function to query the translated shader source, and adds a new enum for GetShaderiv's <pname> parameter to query the
* translated shader source length.
*
* Requires {@link GLES20 GLES 2.0}.
*/
public class ANGLETranslatedShaderSource {
/** Accepted by the {@code pname} parameter of GetShaderiv. */
public static final int GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE = 0x93A0;
static { GLES.initialize(); }
protected ANGLETranslatedShaderSource() {
throw new UnsupportedOperationException();
}
static boolean isAvailable(GLESCapabilities caps) {
return checkFunctions(
caps.glGetTranslatedShaderSourceANGLE
);
}
// --- [ glGetTranslatedShaderSourceANGLE ] ---
public static native void nglGetTranslatedShaderSourceANGLE(int shader, int bufsize, long length, long source);
public static void glGetTranslatedShaderSourceANGLE(int shader, IntBuffer length, ByteBuffer source) {
if (CHECKS) {
checkSafe(length, 1);
}
nglGetTranslatedShaderSourceANGLE(shader, source.remaining(), memAddressSafe(length), memAddress(source));
}
public static String glGetTranslatedShaderSourceANGLE(int shader, int bufsize) {
MemoryStack stack = stackGet(); int stackPointer = stack.getPointer();
ByteBuffer source = memAlloc(bufsize);
try {
IntBuffer length = stack.ints(0);
nglGetTranslatedShaderSourceANGLE(shader, bufsize, memAddress(length), memAddress(source));
return memUTF8(source, length.get(0));
} finally {
memFree(source);
stack.setPointer(stackPointer);
}
}
public static String glGetTranslatedShaderSourceANGLE(int shader) {
return glGetTranslatedShaderSourceANGLE(shader, GLES20.glGetShaderi(shader, GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE));
}
/** Array version of: {@link #glGetTranslatedShaderSourceANGLE GetTranslatedShaderSourceANGLE} */
public static void glGetTranslatedShaderSourceANGLE(int shader, int[] length, ByteBuffer source) {
long __functionAddress = GLES.getICD().glGetTranslatedShaderSourceANGLE;
if (CHECKS) {
check(__functionAddress);
checkSafe(length, 1);
}
callPPV(__functionAddress, shader, source.remaining(), length, memAddress(source));
}
}