From bc8e1313c32e94501d8a38e13270d9dbfb0d4fc6 Mon Sep 17 00:00:00 2001 From: squid233 <60126026+squid233@users.noreply.github.com> Date: Wed, 31 Jan 2024 17:49:46 +0800 Subject: [PATCH] [OpenGL] Rewrite GL20C, GL30C, GL41C (WIP) --- .../src/main/java/overrungl/opengl/GL20C.java | 1808 ++++++---------- .../src/main/java/overrungl/opengl/GL30C.java | 1871 ++++++----------- .../src/main/java/overrungl/opengl/GL41C.java | 1508 +++++-------- .../java/overrungl/opengl/GLCapabilities.java | 21 - .../java/overrungl/opengl/GLLoadFunc.java | 2 +- .../main/java/overrungl/opengl/GLLoader.java | 8 +- .../demo/glfw/GLFWWindowIconTest.java | 2 +- .../java/overrungl/demo/opengl/GL10Test.java | 2 +- .../java/overrungl/demo/opengl/GL15Test.java | 2 +- .../java/overrungl/demo/opengl/GL30Test.java | 2 +- .../java/overrungl/demo/opengl/GL33Test.java | 2 +- 11 files changed, 1886 insertions(+), 3342 deletions(-) diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL20C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL20C.java index 9bcd784b..9a31659d 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL20C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL20C.java @@ -17,20 +17,21 @@ package overrungl.opengl; import org.jetbrains.annotations.Nullable; +import overrun.marshal.Marshal; import overrun.marshal.MemoryStack; -import overrungl.internal.RuntimeHelper; +import overrun.marshal.Unmarshal; +import overrun.marshal.gen.Entrypoint; +import overrun.marshal.gen.Ref; +import overrun.marshal.gen.Skip; import overrungl.opengl.ext.arb.GLARBDrawBuffers; import overrungl.opengl.ext.arb.GLARBFragmentProgram; import overrungl.opengl.ext.arb.GLARBShaderObjects; import overrungl.opengl.ext.arb.GLARBVertexProgram; -import java.lang.foreign.Arena; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; import static java.lang.foreign.ValueLayout.*; -import static overrungl.FunctionDescriptors.*; -import static overrungl.opengl.GLLoader.*; /** * The OpenGL 2.0 forward compatible functions. @@ -47,1516 +48,993 @@ * @since 0.1.0 */ public sealed interface GL20C extends GL15C permits GL20, GL21C { - public static final int BLEND_EQUATION_RGB = 0x8009; - public static final int VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; - public static final int VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; - public static final int VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; - public static final int VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; - public static final int CURRENT_VERTEX_ATTRIB = 0x8626; - public static final int VERTEX_PROGRAM_POINT_SIZE = 0x8642; - public static final int VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; - public static final int STENCIL_BACK_FUNC = 0x8800; - public static final int STENCIL_BACK_FAIL = 0x8801; - public static final int STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802; - public static final int STENCIL_BACK_PASS_DEPTH_PASS = 0x8803; - public static final int MAX_DRAW_BUFFERS = 0x8824; - public static final int DRAW_BUFFER0 = 0x8825; - public static final int DRAW_BUFFER1 = 0x8826; - public static final int DRAW_BUFFER2 = 0x8827; - public static final int DRAW_BUFFER3 = 0x8828; - public static final int DRAW_BUFFER4 = 0x8829; - public static final int DRAW_BUFFER5 = 0x882A; - public static final int DRAW_BUFFER6 = 0x882B; - public static final int DRAW_BUFFER7 = 0x882C; - public static final int DRAW_BUFFER8 = 0x882D; - public static final int DRAW_BUFFER9 = 0x882E; - public static final int DRAW_BUFFER10 = 0x882F; - public static final int DRAW_BUFFER11 = 0x8830; - public static final int DRAW_BUFFER12 = 0x8831; - public static final int DRAW_BUFFER13 = 0x8832; - public static final int DRAW_BUFFER14 = 0x8833; - public static final int DRAW_BUFFER15 = 0x8834; - public static final int BLEND_EQUATION_ALPHA = 0x883D; - public static final int MAX_VERTEX_ATTRIBS = 0x8869; - public static final int VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; - public static final int MAX_TEXTURE_IMAGE_UNITS = 0x8872; - public static final int FRAGMENT_SHADER = 0x8B30; - public static final int VERTEX_SHADER = 0x8B31; - public static final int MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49; - public static final int MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A; - public static final int MAX_VARYING_FLOATS = 0x8B4B; - public static final int MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C; - public static final int MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D; - public static final int SHADER_TYPE = 0x8B4F; - public static final int FLOAT_VEC2 = 0x8B50; - public static final int FLOAT_VEC3 = 0x8B51; - public static final int FLOAT_VEC4 = 0x8B52; - public static final int INT_VEC2 = 0x8B53; - public static final int INT_VEC3 = 0x8B54; - public static final int INT_VEC4 = 0x8B55; - public static final int BOOL = 0x8B56; - public static final int BOOL_VEC2 = 0x8B57; - public static final int BOOL_VEC3 = 0x8B58; - public static final int BOOL_VEC4 = 0x8B59; - public static final int FLOAT_MAT2 = 0x8B5A; - public static final int FLOAT_MAT3 = 0x8B5B; - public static final int FLOAT_MAT4 = 0x8B5C; - public static final int SAMPLER_1D = 0x8B5D; - public static final int SAMPLER_2D = 0x8B5E; - public static final int SAMPLER_3D = 0x8B5F; - public static final int SAMPLER_CUBE = 0x8B60; - public static final int SAMPLER_1D_SHADOW = 0x8B61; - public static final int SAMPLER_2D_SHADOW = 0x8B62; - public static final int DELETE_STATUS = 0x8B80; - public static final int COMPILE_STATUS = 0x8B81; - public static final int LINK_STATUS = 0x8B82; - public static final int VALIDATE_STATUS = 0x8B83; - public static final int INFO_LOG_LENGTH = 0x8B84; - public static final int ATTACHED_SHADERS = 0x8B85; - public static final int ACTIVE_UNIFORMS = 0x8B86; - public static final int ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87; - public static final int SHADER_SOURCE_LENGTH = 0x8B88; - public static final int ACTIVE_ATTRIBUTES = 0x8B89; - public static final int ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A; - public static final int FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B; - public static final int SHADING_LANGUAGE_VERSION = 0x8B8C; - public static final int CURRENT_PROGRAM = 0x8B8D; - public static final int POINT_SPRITE_COORD_ORIGIN = 0x8CA0; - public static final int LOWER_LEFT = 0x8CA1; - public static final int UPPER_LEFT = 0x8CA2; - public static final int STENCIL_BACK_REF = 0x8CA3; - public static final int STENCIL_BACK_VALUE_MASK = 0x8CA4; - public static final int STENCIL_BACK_WRITEMASK = 0x8CA5; - - static boolean isSupported(GLCapabilities caps) { - return checkAll(caps.glAttachShader, caps.glBindAttribLocation, caps.glBlendEquationSeparate, caps.glCompileShader, caps.glCreateProgram, caps.glCreateShader, - caps.glDeleteProgram, caps.glDeleteShader, caps.glDetachShader, caps.glDisableVertexAttribArray, caps.glDrawBuffers, caps.glEnableVertexAttribArray, - caps.glGetActiveAttrib, caps.glGetActiveUniform, caps.glGetAttachedShaders, caps.glGetAttribLocation, caps.glGetProgramInfoLog, caps.glGetProgramiv, - caps.glGetShaderInfoLog, caps.glGetShaderSource, caps.glGetShaderiv, caps.glGetUniformLocation, caps.glGetUniformfv, caps.glGetUniformiv, - caps.glGetVertexAttribPointerv, caps.glGetVertexAttribdv, caps.glGetVertexAttribfv, caps.glGetVertexAttribiv, caps.glIsProgram, caps.glIsShader, - caps.glLinkProgram, caps.glShaderSource, caps.glStencilFuncSeparate, caps.glStencilMaskSeparate, caps.glStencilOpSeparate, caps.glUniform1f, - caps.glUniform1fv, caps.glUniform1i, caps.glUniform1iv, caps.glUniform2f, caps.glUniform2fv, caps.glUniform2i, - caps.glUniform2iv, caps.glUniform3f, caps.glUniform3fv, caps.glUniform3i, caps.glUniform3iv, caps.glUniform4f, - caps.glUniform4fv, caps.glUniform4i, caps.glUniform4iv, caps.glUniformMatrix2fv, caps.glUniformMatrix3fv, caps.glUniformMatrix4fv, - caps.glUseProgram, caps.glValidateProgram, caps.glVertexAttrib1d, caps.glVertexAttrib1dv, caps.glVertexAttrib1f, caps.glVertexAttrib1fv, - caps.glVertexAttrib1s, caps.glVertexAttrib1sv, caps.glVertexAttrib2d, caps.glVertexAttrib2dv, caps.glVertexAttrib2f, caps.glVertexAttrib2fv, - caps.glVertexAttrib2s, caps.glVertexAttrib2sv, caps.glVertexAttrib3d, caps.glVertexAttrib3dv, caps.glVertexAttrib3f, caps.glVertexAttrib3fv, - caps.glVertexAttrib3s, caps.glVertexAttrib3sv, caps.glVertexAttrib4Nbv, caps.glVertexAttrib4Niv, caps.glVertexAttrib4Nsv, caps.glVertexAttrib4Nub, - caps.glVertexAttrib4Nubv, caps.glVertexAttrib4Nuiv, caps.glVertexAttrib4Nusv, caps.glVertexAttrib4bv, caps.glVertexAttrib4d, caps.glVertexAttrib4dv, - caps.glVertexAttrib4f, caps.glVertexAttrib4fv, caps.glVertexAttrib4iv, caps.glVertexAttrib4s, caps.glVertexAttrib4sv, caps.glVertexAttrib4ubv, - caps.glVertexAttrib4uiv, caps.glVertexAttrib4usv, caps.glVertexAttribPointer); - } - - static void load(GLCapabilities caps, GLLoadFunc load) { - caps.glAttachShader = load.invoke("glAttachShader", IIV); - caps.glBindAttribLocation = load.invoke("glBindAttribLocation", IIPV); - caps.glBlendEquationSeparate = load.invoke("glBlendEquationSeparate", IIV); - caps.glCompileShader = load.invoke("glCompileShader", IV); - caps.glCreateProgram = load.invoke("glCreateProgram", I); - caps.glCreateShader = load.invoke("glCreateShader", II); - caps.glDeleteProgram = load.invoke("glDeleteProgram", IV); - caps.glDeleteShader = load.invoke("glDeleteShader", IV); - caps.glDetachShader = load.invoke("glDetachShader", IIV); - caps.glDisableVertexAttribArray = load.invoke("glDisableVertexAttribArray", IV); - caps.glDrawBuffers = load.invoke("glDrawBuffers", IPV); - caps.glEnableVertexAttribArray = load.invoke("glEnableVertexAttribArray", IV); - caps.glGetActiveAttrib = load.invoke("glGetActiveAttrib", IIIPPPPV); - caps.glGetActiveUniform = load.invoke("glGetActiveUniform", IIIPPPPV); - caps.glGetAttachedShaders = load.invoke("glGetAttachedShaders", IIPPV); - caps.glGetAttribLocation = load.invoke("glGetAttribLocation", IPI); - caps.glGetProgramInfoLog = load.invoke("glGetProgramInfoLog", IIPPV); - caps.glGetProgramiv = load.invoke("glGetProgramiv", IIPV); - caps.glGetShaderInfoLog = load.invoke("glGetShaderInfoLog", IIPPV); - caps.glGetShaderSource = load.invoke("glGetShaderSource", IIPV); - caps.glGetShaderiv = load.invoke("glGetShaderiv", IIPV); - caps.glGetUniformLocation = load.invoke("glGetUniformLocation", IPI); - caps.glGetUniformfv = load.invoke("glGetUniformfv", IIPV); - caps.glGetUniformiv = load.invoke("glGetUniformiv", IIPV); - caps.glGetVertexAttribPointerv = load.invoke("glGetVertexAttribPointerv", IIPV); - caps.glGetVertexAttribdv = load.invoke("glGetVertexAttribdv", IIPV); - caps.glGetVertexAttribfv = load.invoke("glGetVertexAttribfv", IIPV); - caps.glGetVertexAttribiv = load.invoke("glGetVertexAttribiv", IIPV); - caps.glIsProgram = load.invoke("glIsProgram", IZ); - caps.glIsShader = load.invoke("glIsShader", IZ); - caps.glLinkProgram = load.invoke("glLinkProgram", IV); - caps.glShaderSource = load.invoke("glShaderSource", IIPPV); - caps.glStencilFuncSeparate = load.invoke("glStencilFuncSeparate", IIIIV); - caps.glStencilMaskSeparate = load.invoke("glStencilMaskSeparate", IIV); - caps.glStencilOpSeparate = load.invoke("glStencilOpSeparate", IIIIV); - caps.glUniform1f = load.invoke("glUniform1f", IFV); - caps.glUniform1fv = load.invoke("glUniform1fv", IIPV); - caps.glUniform1i = load.invoke("glUniform1i", IIV); - caps.glUniform1iv = load.invoke("glUniform1iv", IIPV); - caps.glUniform2f = load.invoke("glUniform2f", IFFV); - caps.glUniform2fv = load.invoke("glUniform2fv", IIPV); - caps.glUniform2i = load.invoke("glUniform2i", IIIV); - caps.glUniform2iv = load.invoke("glUniform2iv", IIPV); - caps.glUniform3f = load.invoke("glUniform3f", IFFFV); - caps.glUniform3fv = load.invoke("glUniform3fv", IIPV); - caps.glUniform3i = load.invoke("glUniform3i", IIIIV); - caps.glUniform3iv = load.invoke("glUniform3iv", IIPV); - caps.glUniform4f = load.invoke("glUniform4f", IFFFFV); - caps.glUniform4fv = load.invoke("glUniform4fv", IIPV); - caps.glUniform4i = load.invoke("glUniform4i", IIIIIV); - caps.glUniform4iv = load.invoke("glUniform4iv", IIPV); - caps.glUniformMatrix2fv = load.invoke("glUniformMatrix2fv", IIZPV); - caps.glUniformMatrix3fv = load.invoke("glUniformMatrix3fv", IIZPV); - caps.glUniformMatrix4fv = load.invoke("glUniformMatrix4fv", IIZPV); - caps.glUseProgram = load.invoke("glUseProgram", IV); - caps.glValidateProgram = load.invoke("glValidateProgram", IV); - caps.glVertexAttrib1d = load.invoke("glVertexAttrib1d", IDV); - caps.glVertexAttrib1dv = load.invoke("glVertexAttrib1dv", IPV); - caps.glVertexAttrib1f = load.invoke("glVertexAttrib1f", IFV); - caps.glVertexAttrib1fv = load.invoke("glVertexAttrib1fv", IPV); - caps.glVertexAttrib1s = load.invoke("glVertexAttrib1s", ISV); - caps.glVertexAttrib1sv = load.invoke("glVertexAttrib1sv", IPV); - caps.glVertexAttrib2d = load.invoke("glVertexAttrib2d", IDDV); - caps.glVertexAttrib2dv = load.invoke("glVertexAttrib2dv", IPV); - caps.glVertexAttrib2f = load.invoke("glVertexAttrib2f", IFFV); - caps.glVertexAttrib2fv = load.invoke("glVertexAttrib2fv", IPV); - caps.glVertexAttrib2s = load.invoke("glVertexAttrib2s", ISSV); - caps.glVertexAttrib2sv = load.invoke("glVertexAttrib2sv", IPV); - caps.glVertexAttrib3d = load.invoke("glVertexAttrib3d", IDDDV); - caps.glVertexAttrib3dv = load.invoke("glVertexAttrib3dv", IPV); - caps.glVertexAttrib3f = load.invoke("glVertexAttrib3f", IFFFV); - caps.glVertexAttrib3fv = load.invoke("glVertexAttrib3fv", IPV); - caps.glVertexAttrib3s = load.invoke("glVertexAttrib3s", ISSSV); - caps.glVertexAttrib3sv = load.invoke("glVertexAttrib3sv", IPV); - caps.glVertexAttrib4Nbv = load.invoke("glVertexAttrib4Nbv", IPV); - caps.glVertexAttrib4Niv = load.invoke("glVertexAttrib4Niv", IPV); - caps.glVertexAttrib4Nsv = load.invoke("glVertexAttrib4Nsv", IPV); - caps.glVertexAttrib4Nub = load.invoke("glVertexAttrib4Nub", IBBBBV); - caps.glVertexAttrib4Nubv = load.invoke("glVertexAttrib4Nubv", IPV); - caps.glVertexAttrib4Nuiv = load.invoke("glVertexAttrib4Nuiv", IPV); - caps.glVertexAttrib4Nusv = load.invoke("glVertexAttrib4Nusv", IPV); - caps.glVertexAttrib4bv = load.invoke("glVertexAttrib4bv", IPV); - caps.glVertexAttrib4d = load.invoke("glVertexAttrib4d", IDDDV); - caps.glVertexAttrib4dv = load.invoke("glVertexAttrib4dv", IPV); - caps.glVertexAttrib4f = load.invoke("glVertexAttrib4f", IFFFV); - caps.glVertexAttrib4fv = load.invoke("glVertexAttrib4fv", IPV); - caps.glVertexAttrib4iv = load.invoke("glVertexAttrib4iv", IPV); - caps.glVertexAttrib4s = load.invoke("glVertexAttrib4s", ISSSV); - caps.glVertexAttrib4sv = load.invoke("glVertexAttrib4sv", IPV); - caps.glVertexAttrib4ubv = load.invoke("glVertexAttrib4ubv", IPV); - caps.glVertexAttrib4uiv = load.invoke("glVertexAttrib4uiv", IPV); - caps.glVertexAttrib4usv = load.invoke("glVertexAttrib4usv", IPV); - caps.glVertexAttribPointer = load.invoke("glVertexAttribPointer", IIIZIPV); - } - - public static void attachShader(int program, int shader) { - var caps = getCapabilities(); - try { - check(caps.glAttachShader).invokeExact(program, shader); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } - } - - public static void bindAttribLocation(int program, int index, MemorySegment name) { - var caps = getCapabilities(); - try { - check(caps.glBindAttribLocation).invokeExact(program, index, name); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } - } - - public static void bindAttribLocation(int program, int index, String name) { - final MemoryStack stack = MemoryStack.stackGet(); - final long stackPointer = stack.getPointer(); - try { - bindAttribLocation(program, index, stack.allocateFrom(name)); - } finally { - stack.setPointer(stackPointer); - } - } - - public static void blendEquationSeparate(int modeRGB, int modeAlpha) { - var caps = getCapabilities(); - try { - check(caps.glBlendEquationSeparate).invokeExact(modeRGB, modeAlpha); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } - } - - public static void compileShader(int shader) { - var caps = getCapabilities(); - try { - check(caps.glCompileShader).invokeExact(shader); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } - } - - public static int createProgram() { - var caps = getCapabilities(); - try { - return (int) check(caps.glCreateProgram).invokeExact(); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } - } - - public static int createShader(int type) { - var caps = getCapabilities(); - try { - return (int) check(caps.glCreateShader).invokeExact(type); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } - } - - public static void deleteProgram(int program) { - var caps = getCapabilities(); - try { - check(caps.glDeleteProgram).invokeExact(program); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } - } - - public static void deleteShader(int shader) { - var caps = getCapabilities(); - try { - check(caps.glDeleteShader).invokeExact(shader); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } - } - - public static void detachShader(int program, int shader) { - var caps = getCapabilities(); - try { - check(caps.glDetachShader).invokeExact(program, shader); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } - } - - public static void disableVertexAttribArray(int index) { - var caps = getCapabilities(); - try { - check(caps.glDisableVertexAttribArray).invokeExact(index); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + int BLEND_EQUATION_RGB = 0x8009; + int VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; + int VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; + int VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; + int VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; + int CURRENT_VERTEX_ATTRIB = 0x8626; + int VERTEX_PROGRAM_POINT_SIZE = 0x8642; + int VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; + int STENCIL_BACK_FUNC = 0x8800; + int STENCIL_BACK_FAIL = 0x8801; + int STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802; + int STENCIL_BACK_PASS_DEPTH_PASS = 0x8803; + int MAX_DRAW_BUFFERS = 0x8824; + int DRAW_BUFFER0 = 0x8825; + int DRAW_BUFFER1 = 0x8826; + int DRAW_BUFFER2 = 0x8827; + int DRAW_BUFFER3 = 0x8828; + int DRAW_BUFFER4 = 0x8829; + int DRAW_BUFFER5 = 0x882A; + int DRAW_BUFFER6 = 0x882B; + int DRAW_BUFFER7 = 0x882C; + int DRAW_BUFFER8 = 0x882D; + int DRAW_BUFFER9 = 0x882E; + int DRAW_BUFFER10 = 0x882F; + int DRAW_BUFFER11 = 0x8830; + int DRAW_BUFFER12 = 0x8831; + int DRAW_BUFFER13 = 0x8832; + int DRAW_BUFFER14 = 0x8833; + int DRAW_BUFFER15 = 0x8834; + int BLEND_EQUATION_ALPHA = 0x883D; + int MAX_VERTEX_ATTRIBS = 0x8869; + int VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; + int MAX_TEXTURE_IMAGE_UNITS = 0x8872; + int FRAGMENT_SHADER = 0x8B30; + int VERTEX_SHADER = 0x8B31; + int MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49; + int MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A; + int MAX_VARYING_FLOATS = 0x8B4B; + int MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C; + int MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D; + int SHADER_TYPE = 0x8B4F; + int FLOAT_VEC2 = 0x8B50; + int FLOAT_VEC3 = 0x8B51; + int FLOAT_VEC4 = 0x8B52; + int INT_VEC2 = 0x8B53; + int INT_VEC3 = 0x8B54; + int INT_VEC4 = 0x8B55; + int BOOL = 0x8B56; + int BOOL_VEC2 = 0x8B57; + int BOOL_VEC3 = 0x8B58; + int BOOL_VEC4 = 0x8B59; + int FLOAT_MAT2 = 0x8B5A; + int FLOAT_MAT3 = 0x8B5B; + int FLOAT_MAT4 = 0x8B5C; + int SAMPLER_1D = 0x8B5D; + int SAMPLER_2D = 0x8B5E; + int SAMPLER_3D = 0x8B5F; + int SAMPLER_CUBE = 0x8B60; + int SAMPLER_1D_SHADOW = 0x8B61; + int SAMPLER_2D_SHADOW = 0x8B62; + int DELETE_STATUS = 0x8B80; + int COMPILE_STATUS = 0x8B81; + int LINK_STATUS = 0x8B82; + int VALIDATE_STATUS = 0x8B83; + int INFO_LOG_LENGTH = 0x8B84; + int ATTACHED_SHADERS = 0x8B85; + int ACTIVE_UNIFORMS = 0x8B86; + int ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87; + int SHADER_SOURCE_LENGTH = 0x8B88; + int ACTIVE_ATTRIBUTES = 0x8B89; + int ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A; + int FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B; + int SHADING_LANGUAGE_VERSION = 0x8B8C; + int CURRENT_PROGRAM = 0x8B8D; + int POINT_SPRITE_COORD_ORIGIN = 0x8CA0; + int LOWER_LEFT = 0x8CA1; + int UPPER_LEFT = 0x8CA2; + int STENCIL_BACK_REF = 0x8CA3; + int STENCIL_BACK_VALUE_MASK = 0x8CA4; + int STENCIL_BACK_WRITEMASK = 0x8CA5; + + @Entrypoint("glAttachShader") + default void attachShader(int program, int shader) { + throw new ContextException(); + } + + @Entrypoint("glBindAttribLocation") + default void bindAttribLocation(int program, int index, MemorySegment name) { + throw new ContextException(); + } + + @Entrypoint("glBindAttribLocation") + default void bindAttribLocation(int program, int index, String name) { + throw new ContextException(); + } + + @Entrypoint("glBlendEquationSeparate") + default void blendEquationSeparate(int modeRGB, int modeAlpha) { + throw new ContextException(); + } + + @Entrypoint("glCompileShader") + default void compileShader(int shader) { + throw new ContextException(); + } + + @Entrypoint("glCreateProgram") + default int createProgram() { + throw new ContextException(); + } + + @Entrypoint("glCreateShader") + default int createShader(int type) { + throw new ContextException(); + } + + @Entrypoint("glDeleteProgram") + default void deleteProgram(int program) { + throw new ContextException(); + } + + @Entrypoint("glDeleteShader") + default void deleteShader(int shader) { + throw new ContextException(); + } + + @Entrypoint("glDetachShader") + default void detachShader(int program, int shader) { + throw new ContextException(); + } + + @Entrypoint("glDisableVertexAttribArray") + default void disableVertexAttribArray(int index) { + throw new ContextException(); } - public static void drawBuffers(int n, MemorySegment bufs) { - var caps = getCapabilities(); - try { - check(caps.glDrawBuffers).invokeExact(n, bufs); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glDrawBuffers") + default void drawBuffers(int n, MemorySegment bufs) { + throw new ContextException(); } - public static void drawBuffers(SegmentAllocator allocator, int[] bufs) { - drawBuffers(bufs.length, allocator.allocateFrom(JAVA_INT, bufs)); + @Skip + default void drawBuffers(SegmentAllocator allocator, int[] bufs) { + drawBuffers(bufs.length, Marshal.marshal(allocator, bufs)); } - public static void enableVertexAttribArray(int index) { - var caps = getCapabilities(); - try { - check(caps.glEnableVertexAttribArray).invokeExact(index); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glEnableVertexAttribArray") + default void enableVertexAttribArray(int index) { + throw new ContextException(); } - public static void getActiveAttrib(int program, int index, int bufSize, MemorySegment length, MemorySegment size, MemorySegment type, MemorySegment name) { - var caps = getCapabilities(); - try { - check(caps.glGetActiveAttrib).invokeExact(program, index, bufSize, length, size, type, name); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetActiveAttrib") + default void getActiveAttrib(int program, int index, int bufSize, MemorySegment length, MemorySegment size, MemorySegment type, MemorySegment name) { + throw new ContextException(); } - public static void getActiveAttrib(SegmentAllocator allocator, int program, int index, int bufSize, int @Nullable [] length, int[] size, int[] type, String[] name) { - var pLen = length != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL; - var pSz = allocator.allocate(JAVA_INT); - var pType = allocator.allocate(JAVA_INT); + @Skip + default void getActiveAttrib(SegmentAllocator allocator, int program, int index, int bufSize, @Ref int @Nullable [] length, @Ref int[] size, @Ref int[] type, @Ref String[] name) { + var pLen = Marshal.marshal(allocator, length); + var pSz = Marshal.marshal(allocator, size); + var pType = Marshal.marshal(allocator, type); var pName = allocator.allocate(JAVA_BYTE, bufSize); getActiveAttrib(program, index, bufSize, pLen, pSz, pType, pName); - if (length != null && length.length > 0) { - length[0] = pLen.get(JAVA_INT, 0); - } - size[0] = pSz.get(JAVA_INT, 0); - type[0] = pType.get(JAVA_INT, 0); + Unmarshal.copy(pLen, length); + Unmarshal.copy(pSz, size); + Unmarshal.copy(pType, type); name[0] = pName.getString(0); } - public static void getActiveUniform(int program, int index, int bufSize, MemorySegment length, MemorySegment size, MemorySegment type, MemorySegment name) { - var caps = getCapabilities(); - try { - check(caps.glGetActiveUniform).invokeExact(program, index, bufSize, length, size, type, name); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetActiveUniform") + default void getActiveUniform(int program, int index, int bufSize, MemorySegment length, MemorySegment size, MemorySegment type, MemorySegment name) { + throw new ContextException(); } - public static void getActiveUniform(SegmentAllocator allocator, int program, int index, int bufSize, int @Nullable [] length, int[] size, int[] type, String[] name) { - var pLen = length != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL; - var pSz = allocator.allocate(JAVA_INT); - var pType = allocator.allocate(JAVA_INT); + @Skip + default void getActiveUniform(SegmentAllocator allocator, int program, int index, int bufSize, @Ref int @Nullable [] length, @Ref int[] size, @Ref int[] type, @Ref String[] name) { + var pLen = Marshal.marshal(allocator, length); + var pSz = Marshal.marshal(allocator, size); + var pType = Marshal.marshal(allocator, type); var pName = allocator.allocate(JAVA_BYTE, bufSize); getActiveUniform(program, index, bufSize, pLen, pSz, pType, pName); - if (length != null && length.length > 0) { - length[0] = pLen.get(JAVA_INT, 0); - } - size[0] = pSz.get(JAVA_INT, 0); - type[0] = pType.get(JAVA_INT, 0); + Unmarshal.copy(pLen, length); + Unmarshal.copy(pSz, size); + Unmarshal.copy(pType, type); name[0] = pName.getString(0); } - public static void getAttachedShaders(int program, int maxCount, MemorySegment count, MemorySegment shaders) { - var caps = getCapabilities(); - try { - check(caps.glGetAttachedShaders).invokeExact(program, maxCount, count, shaders); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetAttachedShaders") + default void getAttachedShaders(int program, int maxCount, MemorySegment count, MemorySegment shaders) { + throw new ContextException(); } - public static void getAttachedShaders(SegmentAllocator allocator, int program, int @Nullable [] count, int[] shaders) { - var pCount = count != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL; - var pShaders = allocator.allocate(JAVA_INT, shaders.length); - getAttachedShaders(program, shaders.length, pCount, pShaders); - if (count != null && count.length > 0) { - count[0] = pCount.get(JAVA_INT, 0); - } - RuntimeHelper.toArray(pShaders, shaders); + @Entrypoint("glGetAttachedShaders") + default void getAttachedShaders(SegmentAllocator allocator, int program, int maxCount, @Ref int @Nullable [] count, @Ref int[] shaders) { + throw new ContextException(); } - public static int getAttribLocation(int program, MemorySegment name) { - var caps = getCapabilities(); - try { - return (int) check(caps.glGetAttribLocation).invokeExact(program, name); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetAttribLocation") + default int getAttribLocation(int program, MemorySegment name) { + throw new ContextException(); } - public static int getAttribLocation(int program, String name) { - final MemoryStack stack = MemoryStack.stackGet(); - final long stackPointer = stack.getPointer(); - try { - return getAttribLocation(program, stack.allocateFrom(name)); - } finally { - stack.setPointer(stackPointer); - } + @Entrypoint("glGetAttribLocation") + default int getAttribLocation(int program, String name) { + throw new ContextException(); } - public static void getProgramInfoLog(int program, int bufSize, MemorySegment length, MemorySegment infoLog) { - var caps = getCapabilities(); - try { - check(caps.glGetProgramInfoLog).invokeExact(program, bufSize, length, infoLog); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetProgramInfoLog") + default void getProgramInfoLog(int program, int bufSize, MemorySegment length, MemorySegment infoLog) { + throw new ContextException(); } - public static String getProgramInfoLog(int program, int bufSize, int @Nullable [] length) { - final MemoryStack stack = MemoryStack.stackGet(); - final long stackPointer = stack.getPointer(); - try { - var pLen = length != null ? stack.calloc(JAVA_INT) : MemorySegment.NULL; - final Arena allocator = stack.getPointer() < bufSize ? Arena.ofConfined() : stack; - try { - var pLog = allocator.allocate(JAVA_BYTE, bufSize); - getProgramInfoLog(program, bufSize, pLen, pLog); - if (length != null && length.length > 0) { - length[0] = pLen.get(JAVA_INT, 0); - } - return pLog.getString(0); - } finally { - if (!(allocator instanceof MemoryStack)) allocator.close(); - } - } finally { - stack.setPointer(stackPointer); + @Skip + default String getProgramInfoLog(int program, int bufSize, @Ref int @Nullable [] length) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var pLen = Marshal.marshal(stack, length); + var pLog = stack.allocate(JAVA_BYTE, bufSize); + getProgramInfoLog(program, bufSize, pLen, pLog); + Unmarshal.copy(pLen, length); + return pLog.getString(0); } } - public static String getProgramInfoLog(int program) { - return getProgramInfoLog(program, getProgrami(program, INFO_LOG_LENGTH), null); + @Skip + default String getProgramInfoLog(int program) { + return getProgramInfoLog(program, getProgramiv(program, INFO_LOG_LENGTH), null); } - public static void getProgramiv(int program, int pname, MemorySegment params) { - var caps = getCapabilities(); - try { - check(caps.glGetProgramiv).invokeExact(program, pname, params); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetProgramiv") + default void getProgramiv(int program, int pname, MemorySegment params) { + throw new ContextException(); } - public static void getProgramiv(SegmentAllocator allocator, int program, int pname, int[] params) { - var seg = allocator.allocate(JAVA_INT, params.length); - getProgramiv(program, pname, seg); - RuntimeHelper.toArray(seg, params); + @Entrypoint("glGetProgramiv") + default void getProgramiv(SegmentAllocator allocator, int program, int pname, @Ref int[] params) { + throw new ContextException(); } - public static int getProgrami(int program, int pname) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocInt(); + @Skip + default int getProgramiv(int program, int pname) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.ints(0); getProgramiv(program, pname, seg); return seg.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static void getShaderInfoLog(int shader, int bufSize, MemorySegment length, MemorySegment infoLog) { - var caps = getCapabilities(); - try { - check(caps.glGetShaderInfoLog).invokeExact(shader, bufSize, length, infoLog); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetShaderInfoLog") + default void getShaderInfoLog(int shader, int bufSize, MemorySegment length, MemorySegment infoLog) { + throw new ContextException(); } - public static String getShaderInfoLog(int shader, int bufSize, int @Nullable [] length) { - final MemoryStack stack = MemoryStack.stackGet(); - final long stackPointer = stack.getPointer(); - try { - var pLen = length != null ? stack.callocInt() : MemorySegment.NULL; - final Arena allocator = stack.getPointer() < bufSize ? Arena.ofConfined() : stack; - try { - var pLog = allocator.allocate(JAVA_BYTE, bufSize); - getShaderInfoLog(shader, bufSize, pLen, pLog); - if (length != null && length.length > 0) { - length[0] = pLen.get(JAVA_INT, 0); - } - return pLog.getString(0); - } finally { - if (!(allocator instanceof MemoryStack)) allocator.close(); - } - } finally { - stack.setPointer(stackPointer); + @Skip + default String getShaderInfoLog(int shader, int bufSize, @Ref int @Nullable [] length) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var pLen = Marshal.marshal(stack, length); + var pLog = stack.allocate(JAVA_BYTE, bufSize); + getShaderInfoLog(shader, bufSize, pLen, pLog); + Unmarshal.copy(pLen, length); + return pLog.getString(0); } } - public static String getShaderInfoLog(int shader) { - return getShaderInfoLog(shader, getShaderi(shader, INFO_LOG_LENGTH), null); + @Skip + default String getShaderInfoLog(int shader) { + return getShaderInfoLog(shader, getShaderiv(shader, INFO_LOG_LENGTH), null); } - public static void getShaderSource(int shader, int bufSize, MemorySegment length, MemorySegment source) { - var caps = getCapabilities(); - try { - check(caps.glGetShaderSource).invokeExact(shader, bufSize, length, source); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetShaderSource") + default void getShaderSource(int shader, int bufSize, MemorySegment length, MemorySegment source) { + throw new ContextException(); } - public static String getShaderSource(SegmentAllocator allocator, int shader, int bufSize, int @Nullable [] length) { - var pLen = length != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL; - var pSrc = allocator.allocate(JAVA_BYTE, bufSize); - getShaderSource(shader, bufSize, pLen, pSrc); - if (length != null && length.length > 0) { - length[0] = pLen.get(JAVA_INT, 0); + @Skip + default String getShaderSource(int shader, int bufSize, @Ref int @Nullable [] length) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var pLen = Marshal.marshal(stack, length); + var pSrc = stack.allocate(JAVA_BYTE, bufSize); + getShaderSource(shader, bufSize, pLen, pSrc); + Unmarshal.copy(pLen, length); + return pSrc.getString(0); } - return pSrc.getString(0); } - public static String getShaderSource(SegmentAllocator allocator, int shader) { - return getShaderSource(allocator, shader, getShaderi(shader, SHADER_SOURCE_LENGTH), null); + @Skip + default String getShaderSource(int shader) { + return getShaderSource(shader, getShaderiv(shader, SHADER_SOURCE_LENGTH), null); } - public static void getShaderiv(int shader, int pname, MemorySegment params) { - var caps = getCapabilities(); - try { - check(caps.glGetShaderiv).invokeExact(shader, pname, params); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetShaderiv") + default void getShaderiv(int shader, int pname, MemorySegment params) { + throw new ContextException(); } - public static void getShaderiv(SegmentAllocator allocator, int shader, int pname, int[] params) { - var seg = allocator.allocate(JAVA_INT, params.length); - getShaderiv(shader, pname, seg); - RuntimeHelper.toArray(seg, params); + @Entrypoint("glGetShaderiv") + default void getShaderiv(SegmentAllocator allocator, int shader, int pname, @Ref int[] params) { + throw new ContextException(); } - public static int getShaderi(int shader, int pname) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocInt(); + @Skip + default int getShaderiv(int shader, int pname) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.ints(0); getShaderiv(shader, pname, seg); return seg.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static int getUniformLocation(int program, MemorySegment name) { - var caps = getCapabilities(); - try { - return (int) check(caps.glGetUniformLocation).invokeExact(program, name); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetUniformLocation") + default int getUniformLocation(int program, MemorySegment name) { + throw new ContextException(); } - public static int getUniformLocation(int program, String name) { - final MemoryStack stack = MemoryStack.stackGet(); - final long stackPointer = stack.getPointer(); - try { - return getUniformLocation(program, stack.allocateFrom(name)); - } finally { - stack.setPointer(stackPointer); - } + @Entrypoint("glGetUniformLocation") + default int getUniformLocation(int program, String name) { + throw new ContextException(); } - public static void getUniformfv(int program, int location, MemorySegment params) { - var caps = getCapabilities(); - try { - check(caps.glGetUniformfv).invokeExact(program, location, params); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetUniformfv") + default void getUniformfv(int program, int location, MemorySegment params) { + throw new ContextException(); } - public static void getUniformfv(SegmentAllocator allocator, int program, int location, float[] params) { - var seg = allocator.allocate(JAVA_FLOAT, params.length); - getUniformfv(program, location, seg); - RuntimeHelper.toArray(seg, params); + @Entrypoint("glGetUniformfv") + default void getUniformfv(SegmentAllocator allocator, int program, int location, @Ref float[] params) { + throw new ContextException(); } - public static float getUniformf(int program, int location) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocFloat(); + @Skip + default float getUniformfv(int program, int location) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.floats(0F); getUniformfv(program, location, seg); return seg.get(JAVA_FLOAT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static void getUniformiv(int program, int location, MemorySegment params) { - var caps = getCapabilities(); - try { - check(caps.glGetUniformiv).invokeExact(program, location, params); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetUniformiv") + default void getUniformiv(int program, int location, MemorySegment params) { + throw new ContextException(); } - public static void getUniformiv(SegmentAllocator allocator, int program, int location, int[] params) { - var seg = allocator.allocate(JAVA_INT, params.length); - getUniformiv(program, location, seg); - RuntimeHelper.toArray(seg, params); + @Entrypoint("glGetUniformiv") + default void getUniformiv(SegmentAllocator allocator, int program, int location, @Ref int[] params) { + throw new ContextException(); } - public static int getUniformi(int program, int location) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocInt(); + @Skip + default int getUniformiv(int program, int location) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.ints(0); getUniformiv(program, location, seg); return seg.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static void getVertexAttribPointerv(int index, int pname, MemorySegment pointer) { - var caps = getCapabilities(); - try { - check(caps.glGetVertexAttribPointerv).invokeExact(index, pname, pointer); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetVertexAttribPointerv") + default void getVertexAttribPointerv(int index, int pname, MemorySegment pointer) { + throw new ContextException(); } - public static void getVertexAttribPointerv(SegmentAllocator allocator, int index, int pname, byte[] pointer) { - var seg = allocator.allocate(JAVA_BYTE, pointer.length); - getVertexAttribPointerv(index, pname, seg); - RuntimeHelper.toArray(seg, pointer); + @Entrypoint("glGetVertexAttribPointerv") + default void getVertexAttribPointerv(SegmentAllocator allocator, int index, int pname, @Ref byte[] pointer) { + throw new ContextException(); } - public static void getVertexAttribPointerv(SegmentAllocator allocator, int index, int pname, short[] pointer) { - var seg = allocator.allocate(JAVA_SHORT, pointer.length); - getVertexAttribPointerv(index, pname, seg); - RuntimeHelper.toArray(seg, pointer); + @Entrypoint("glGetVertexAttribPointerv") + default void getVertexAttribPointerv(SegmentAllocator allocator, int index, int pname, @Ref short[] pointer) { + throw new ContextException(); } - public static void getVertexAttribPointerv(SegmentAllocator allocator, int index, int pname, int[] pointer) { - var seg = allocator.allocate(JAVA_INT, pointer.length); - getVertexAttribPointerv(index, pname, seg); - RuntimeHelper.toArray(seg, pointer); + @Entrypoint("glGetVertexAttribPointerv") + default void getVertexAttribPointerv(SegmentAllocator allocator, int index, int pname, @Ref int[] pointer) { + throw new ContextException(); } - public static void getVertexAttribPointerv(SegmentAllocator allocator, int index, int pname, float[] pointer) { - var seg = allocator.allocate(JAVA_FLOAT, pointer.length); - getVertexAttribPointerv(index, pname, seg); - RuntimeHelper.toArray(seg, pointer); + @Entrypoint("glGetVertexAttribPointerv") + default void getVertexAttribPointerv(SegmentAllocator allocator, int index, int pname, @Ref float[] pointer) { + throw new ContextException(); } - public static void getVertexAttribPointerv(SegmentAllocator allocator, int index, int pname, double[] pointer) { - var seg = allocator.allocate(JAVA_DOUBLE, pointer.length); - getVertexAttribPointerv(index, pname, seg); - RuntimeHelper.toArray(seg, pointer); + @Entrypoint("glGetVertexAttribPointerv") + default void getVertexAttribPointerv(SegmentAllocator allocator, int index, int pname, @Ref double[] pointer) { + throw new ContextException(); } - public static void getVertexAttribdv(int index, int pname, MemorySegment params) { - var caps = getCapabilities(); - try { - check(caps.glGetVertexAttribdv).invokeExact(index, pname, params); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetVertexAttribdv") + default void getVertexAttribdv(int index, int pname, MemorySegment params) { + throw new ContextException(); } - public static void getVertexAttribdv(SegmentAllocator allocator, int index, int pname, double[] params) { - var seg = allocator.allocate(JAVA_DOUBLE, params.length); - getVertexAttribdv(index, pname, seg); - RuntimeHelper.toArray(seg, params); + @Entrypoint("glGetVertexAttribdv") + default void getVertexAttribdv(SegmentAllocator allocator, int index, int pname, @Ref double[] params) { + throw new ContextException(); } - public static double getVertexAttribd(int index, int pname) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocDouble(); + @Skip + default double getVertexAttribdv(int index, int pname) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.doubles(0D); getVertexAttribdv(index, pname, seg); return seg.get(JAVA_DOUBLE, 0); - } finally { - stack.setPointer(stackPointer); } } - public static void getVertexAttribfv(int index, int pname, MemorySegment params) { - var caps = getCapabilities(); - try { - check(caps.glGetVertexAttribfv).invokeExact(index, pname, params); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetVertexAttribfv") + default void getVertexAttribfv(int index, int pname, MemorySegment params) { + throw new ContextException(); } - public static void getVertexAttribfv(SegmentAllocator allocator, int index, int pname, float[] params) { - var seg = allocator.allocate(JAVA_FLOAT, params.length); - getVertexAttribfv(index, pname, seg); - RuntimeHelper.toArray(seg, params); + @Entrypoint("glGetVertexAttribfv") + default void getVertexAttribfv(SegmentAllocator allocator, int index, int pname, @Ref float[] params) { + throw new ContextException(); } - public static float getVertexAttribf(int index, int pname) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocFloat(); + @Skip + default float getVertexAttribfv(int index, int pname) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.floats(0F); getVertexAttribfv(index, pname, seg); return seg.get(JAVA_FLOAT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static void getVertexAttribiv(int index, int pname, MemorySegment params) { - var caps = getCapabilities(); - try { - check(caps.glGetVertexAttribiv).invokeExact(index, pname, params); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetVertexAttribiv") + default void getVertexAttribiv(int index, int pname, MemorySegment params) { + throw new ContextException(); } - public static void getVertexAttribiv(SegmentAllocator allocator, int index, int pname, int[] params) { - var seg = allocator.allocate(JAVA_INT, params.length); - getVertexAttribiv(index, pname, seg); - RuntimeHelper.toArray(seg, params); + @Entrypoint("glGetVertexAttribiv") + default void getVertexAttribiv(SegmentAllocator allocator, int index, int pname, @Ref int[] params) { + throw new ContextException(); } - public static int getVertexAttribi(int index, int pname) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocInt(); + @Skip + default int getVertexAttribiv(int index, int pname) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.ints(0); getVertexAttribiv(index, pname, seg); return seg.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static boolean isProgram(int program) { - var caps = getCapabilities(); - try { - return (boolean) check(caps.glIsProgram).invokeExact(program); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glIsProgram") + default boolean isProgram(int program) { + throw new ContextException(); } - public static boolean isShader(int shader) { - var caps = getCapabilities(); - try { - return (boolean) check(caps.glIsShader).invokeExact(shader); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glIsShader") + default boolean isShader(int shader) { + throw new ContextException(); } - public static void linkProgram(int program) { - var caps = getCapabilities(); - try { - check(caps.glLinkProgram).invokeExact(program); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glLinkProgram") + default void linkProgram(int program) { + throw new ContextException(); } - public static void shaderSource(int shader, int count, MemorySegment string, MemorySegment length) { - var caps = getCapabilities(); - try { - check(caps.glShaderSource).invokeExact(shader, count, string, length); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glShaderSource") + default void shaderSource(int shader, int count, MemorySegment string, MemorySegment length) { + throw new ContextException(); } - public static void shaderSource(SegmentAllocator allocator, int shader, String[] string) { - var pStr = allocator.allocate(ADDRESS, string.length); - var pLen = allocator.allocate(JAVA_INT, string.length); - for (int i = 0; i < string.length; i++) { - pStr.setAtIndex(ADDRESS, i, allocator.allocateFrom(string[i])); - pLen.setAtIndex(JAVA_INT, i, string[i].length()); - } - shaderSource(shader, string.length, pStr, pLen); + @Skip + default void shaderSource(SegmentAllocator allocator, int shader, String[] string) { + shaderSource(shader, string.length, Marshal.marshal(allocator, string), MemorySegment.NULL); } - public static void shaderSource(int shader, String string) { - final MemoryStack stack = MemoryStack.stackGet(); - final long stackPointer = stack.getPointer(); - try { - shaderSource(shader, 1, stack.allocateFrom(ADDRESS, stack.allocateFrom(string)), stack.allocateFrom(JAVA_INT, string.length())); - } finally { - stack.setPointer(stackPointer); + @Skip + default void shaderSource(int shader, String string) { + try (MemoryStack stack = MemoryStack.stackPush()) { + shaderSource(shader, 1, stack.allocateFrom(ADDRESS, Marshal.marshal(stack, string)), MemorySegment.NULL); } } - public static void stencilFuncSeparate(int face, int func, int ref, int mask) { - var caps = getCapabilities(); - try { - check(caps.glStencilFuncSeparate).invokeExact(face, func, ref, mask); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glStencilFuncSeparate") + default void stencilFuncSeparate(int face, int func, int ref, int mask) { + throw new ContextException(); } - public static void stencilMaskSeparate(int face, int mask) { - var caps = getCapabilities(); - try { - check(caps.glStencilMaskSeparate).invokeExact(face, mask); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glStencilMaskSeparate") + default void stencilMaskSeparate(int face, int mask) { + throw new ContextException(); } - public static void stencilOpSeparate(int face, int sfail, int dpfail, int dppass) { - var caps = getCapabilities(); - try { - check(caps.glStencilOpSeparate).invokeExact(face, sfail, dpfail, dppass); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glStencilOpSeparate") + default void stencilOpSeparate(int face, int sfail, int dpfail, int dppass) { + throw new ContextException(); } - public static void uniform1f(int location, float v0) { - var caps = getCapabilities(); - try { - check(caps.glUniform1f).invokeExact(location, v0); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform1f") + default void uniform1f(int location, float v0) { + throw new ContextException(); } - public static void uniform1fv(int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glUniform1fv).invokeExact(location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform1fv") + default void uniform1fv(int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void uniform1fv(SegmentAllocator allocator, int location, float[] value) { - uniform1fv(location, value.length, allocator.allocateFrom(JAVA_FLOAT, value)); + @Skip + default void uniform1fv(SegmentAllocator allocator, int location, float[] value) { + uniform1fv(location, value.length, Marshal.marshal(allocator, value)); } - public static void uniform1i(int location, int v0) { - var caps = getCapabilities(); - try { - check(caps.glUniform1i).invokeExact(location, v0); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform1i") + default void uniform1i(int location, int v0) { + throw new ContextException(); } - public static void uniform1iv(int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glUniform1iv).invokeExact(location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform1iv") + default void uniform1iv(int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void uniform1iv(SegmentAllocator allocator, int location, int[] value) { - uniform1iv(location, value.length, allocator.allocateFrom(JAVA_INT, value)); + @Skip + default void uniform1iv(SegmentAllocator allocator, int location, int[] value) { + uniform1iv(location, value.length, Marshal.marshal(allocator, value)); } - public static void uniform2f(int location, float v0, float v1) { - var caps = getCapabilities(); - try { - check(caps.glUniform2f).invokeExact(location, v0, v1); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform2f") + default void uniform2f(int location, float v0, float v1) { + throw new ContextException(); } - public static void uniform2fv(int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glUniform2fv).invokeExact(location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform2fv") + default void uniform2fv(int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void uniform2fv(SegmentAllocator allocator, int location, float[] value) { - uniform2fv(location, value.length >> 1, allocator.allocateFrom(JAVA_FLOAT, value)); + @Skip + default void uniform2fv(SegmentAllocator allocator, int location, float[] value) { + uniform2fv(location, value.length >> 1, Marshal.marshal(allocator, value)); } - public static void uniform2i(int location, int v0, int v1) { - var caps = getCapabilities(); - try { - check(caps.glUniform2i).invokeExact(location, v0, v1); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform2i") + default void uniform2i(int location, int v0, int v1) { + throw new ContextException(); } - public static void uniform2iv(int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glUniform2iv).invokeExact(location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform2iv") + default void uniform2iv(int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void uniform2iv(SegmentAllocator allocator, int location, int[] value) { - uniform2iv(location, value.length >> 1, allocator.allocateFrom(JAVA_INT, value)); + @Skip + default void uniform2iv(SegmentAllocator allocator, int location, int[] value) { + uniform2iv(location, value.length >> 1, Marshal.marshal(allocator, value)); } - public static void uniform3f(int location, float v0, float v1, float v2) { - var caps = getCapabilities(); - try { - check(caps.glUniform3f).invokeExact(location, v0, v1, v2); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform3f") + default void uniform3f(int location, float v0, float v1, float v2) { + throw new ContextException(); } - public static void uniform3fv(int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glUniform3fv).invokeExact(location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform3fv") + default void uniform3fv(int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void uniform3fv(SegmentAllocator allocator, int location, float[] value) { - uniform3fv(location, value.length / 3, allocator.allocateFrom(JAVA_FLOAT, value)); + @Skip + default void uniform3fv(SegmentAllocator allocator, int location, float[] value) { + uniform3fv(location, value.length / 3, Marshal.marshal(allocator, value)); } - public static void uniform3i(int location, int v0, int v1, int v2) { - var caps = getCapabilities(); - try { - check(caps.glUniform3i).invokeExact(location, v0, v1, v2); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform3i") + default void uniform3i(int location, int v0, int v1, int v2) { + throw new ContextException(); } - public static void uniform3iv(int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glUniform3iv).invokeExact(location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform3iv") + default void uniform3iv(int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void uniform3iv(SegmentAllocator allocator, int location, int[] value) { - uniform3iv(location, value.length / 3, allocator.allocateFrom(JAVA_INT, value)); + @Skip + default void uniform3iv(SegmentAllocator allocator, int location, int[] value) { + uniform3iv(location, value.length / 3, Marshal.marshal(allocator, value)); } - public static void uniform4f(int location, float v0, float v1, float v2, float v3) { - var caps = getCapabilities(); - try { - check(caps.glUniform4f).invokeExact(location, v0, v1, v2, v3); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform4f") + default void uniform4f(int location, float v0, float v1, float v2, float v3) { + throw new ContextException(); } - public static void uniform4fv(int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glUniform4fv).invokeExact(location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform4fv") + default void uniform4fv(int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void uniform4fv(SegmentAllocator allocator, int location, float[] value) { - uniform4fv(location, value.length >> 2, allocator.allocateFrom(JAVA_FLOAT, value)); + @Skip + default void uniform4fv(SegmentAllocator allocator, int location, float[] value) { + uniform4fv(location, value.length >> 2, Marshal.marshal(allocator, value)); } - public static void uniform4i(int location, int v0, int v1, int v2, int v3) { - var caps = getCapabilities(); - try { - check(caps.glUniform4i).invokeExact(location, v0, v1, v2, v3); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform4i") + default void uniform4i(int location, int v0, int v1, int v2, int v3) { + throw new ContextException(); } - public static void uniform4iv(int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glUniform4iv).invokeExact(location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform4iv") + default void uniform4iv(int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void uniform4iv(SegmentAllocator allocator, int location, int[] value) { - uniform4iv(location, value.length >> 2, allocator.allocateFrom(JAVA_INT, value)); + @Skip + default void uniform4iv(SegmentAllocator allocator, int location, int[] value) { + uniform4iv(location, value.length >> 2, Marshal.marshal(allocator, value)); } - public static void uniformMatrix2fv(int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glUniformMatrix2fv).invokeExact(location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniformMatrix2fv") + default void uniformMatrix2fv(int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void uniformMatrix2fv(SegmentAllocator allocator, int location, int count, boolean transpose, float[] value) { - uniformMatrix2fv(location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); + @Skip + default void uniformMatrix2fv(SegmentAllocator allocator, int location, int count, boolean transpose, float[] value) { + uniformMatrix2fv(location, count, transpose, Marshal.marshal(allocator, value)); } - public static void uniformMatrix2fv(SegmentAllocator allocator, int location, boolean transpose, float[] value) { + @Skip + default void uniformMatrix2fv(SegmentAllocator allocator, int location, boolean transpose, float[] value) { uniformMatrix2fv(allocator, location, value.length >> 2, transpose, value); } - public static void uniformMatrix3fv(int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glUniformMatrix3fv).invokeExact(location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniformMatrix3fv") + default void uniformMatrix3fv(int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void uniformMatrix3fv(SegmentAllocator allocator, int location, int count, boolean transpose, float[] value) { - uniformMatrix3fv(location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); + @Skip + default void uniformMatrix3fv(SegmentAllocator allocator, int location, int count, boolean transpose, float[] value) { + uniformMatrix3fv(location, count, transpose, Marshal.marshal(allocator, value)); } - public static void uniformMatrix3fv(SegmentAllocator allocator, int location, boolean transpose, float[] value) { + @Skip + default void uniformMatrix3fv(SegmentAllocator allocator, int location, boolean transpose, float[] value) { uniformMatrix3fv(allocator, location, value.length / 9, transpose, value); } - public static void uniformMatrix4fv(int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glUniformMatrix4fv).invokeExact(location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniformMatrix4fv") + default void uniformMatrix4fv(int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void uniformMatrix4fv(SegmentAllocator allocator, int location, int count, boolean transpose, float[] value) { - uniformMatrix4fv(location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); + @Skip + default void uniformMatrix4fv(SegmentAllocator allocator, int location, int count, boolean transpose, float[] value) { + uniformMatrix4fv(location, count, transpose, Marshal.marshal(allocator, value)); } - public static void uniformMatrix4fv(SegmentAllocator allocator, int location, boolean transpose, float[] value) { + @Skip + default void uniformMatrix4fv(SegmentAllocator allocator, int location, boolean transpose, float[] value) { uniformMatrix4fv(allocator, location, value.length >> 4, transpose, value); } - public static void useProgram(int program) { - var caps = getCapabilities(); - try { - check(caps.glUseProgram).invokeExact(program); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUseProgram") + default void useProgram(int program) { + throw new ContextException(); } - public static void validateProgram(int program) { - var caps = getCapabilities(); - try { - check(caps.glValidateProgram).invokeExact(program); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glValidateProgram") + default void validateProgram(int program) { + throw new ContextException(); } - public static void vertexAttrib1d(int index, double x) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib1d).invokeExact(index, x); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib1d") + default void vertexAttrib1d(int index, double x) { + throw new ContextException(); } - public static void vertexAttrib1dv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib1dv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib1dv") + default void vertexAttrib1dv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib1dv(SegmentAllocator allocator, int index, double[] v) { - vertexAttrib1dv(index, allocator.allocateFrom(JAVA_DOUBLE, v)); + @Entrypoint("glVertexAttrib1dv") + default void vertexAttrib1dv(SegmentAllocator allocator, int index, double[] v) { + throw new ContextException(); } - public static void vertexAttrib1f(int index, float x) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib1f).invokeExact(index, x); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib1f") + default void vertexAttrib1f(int index, float x) { + throw new ContextException(); } - public static void vertexAttrib1fv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib1fv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib1fv") + default void vertexAttrib1fv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib1fv(SegmentAllocator allocator, int index, float[] v) { - vertexAttrib1fv(index, allocator.allocateFrom(JAVA_FLOAT, v)); + @Entrypoint("glVertexAttrib1fv") + default void vertexAttrib1fv(SegmentAllocator allocator, int index, float[] v) { + throw new ContextException(); } - public static void vertexAttrib1s(int index, short x) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib1s).invokeExact(index, x); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib1s") + default void vertexAttrib1s(int index, short x) { + throw new ContextException(); } - public static void vertexAttrib1sv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib1sv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib1sv") + default void vertexAttrib1sv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib1sv(SegmentAllocator allocator, int index, short[] v) { - vertexAttrib1sv(index, allocator.allocateFrom(JAVA_SHORT, v)); + @Entrypoint("glVertexAttrib1sv") + default void vertexAttrib1sv(SegmentAllocator allocator, int index, short[] v) { + throw new ContextException(); } - public static void vertexAttrib2d(int index, double x, double y) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib2d).invokeExact(index, x, y); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib2d") + default void vertexAttrib2d(int index, double x, double y) { + throw new ContextException(); } - public static void vertexAttrib2dv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib2dv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib2dv") + default void vertexAttrib2dv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib2dv(SegmentAllocator allocator, int index, double[] v) { - vertexAttrib2dv(index, allocator.allocateFrom(JAVA_DOUBLE, v)); + @Entrypoint("glVertexAttrib2dv") + default void vertexAttrib2dv(SegmentAllocator allocator, int index, double[] v) { + throw new ContextException(); } - public static void vertexAttrib2f(int index, float x, float y) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib2f).invokeExact(index, x, y); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib2f") + default void vertexAttrib2f(int index, float x, float y) { + throw new ContextException(); } - public static void vertexAttrib2fv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib2fv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib2fv") + default void vertexAttrib2fv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib2fv(SegmentAllocator allocator, int index, float[] v) { - vertexAttrib2fv(index, allocator.allocateFrom(JAVA_FLOAT, v)); + @Entrypoint("glVertexAttrib2fv") + default void vertexAttrib2fv(SegmentAllocator allocator, int index, float[] v) { + throw new ContextException(); } - public static void vertexAttrib2s(int index, short x, short y) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib2s).invokeExact(index, x, y); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib2s") + default void vertexAttrib2s(int index, short x, short y) { + throw new ContextException(); } - public static void vertexAttrib2sv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib2sv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib2sv") + default void vertexAttrib2sv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib2sv(SegmentAllocator allocator, int index, short[] v) { - vertexAttrib2sv(index, allocator.allocateFrom(JAVA_SHORT, v)); + @Entrypoint("glVertexAttrib2sv") + default void vertexAttrib2sv(SegmentAllocator allocator, int index, short[] v) { + throw new ContextException(); } - public static void vertexAttrib3d(int index, double x, double y, double z) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib3d).invokeExact(index, x, y, z); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib3d") + default void vertexAttrib3d(int index, double x, double y, double z) { + throw new ContextException(); } - public static void vertexAttrib3dv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib3dv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib3dv") + default void vertexAttrib3dv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib3dv(SegmentAllocator allocator, int index, double[] v) { - vertexAttrib3dv(index, allocator.allocateFrom(JAVA_DOUBLE, v)); + @Entrypoint("glVertexAttrib3dv") + default void vertexAttrib3dv(SegmentAllocator allocator, int index, double[] v) { + throw new ContextException(); } - public static void vertexAttrib3f(int index, float x, float y, float z) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib3f).invokeExact(index, x, y, z); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib3f") + default void vertexAttrib3f(int index, float x, float y, float z) { + throw new ContextException(); } - public static void vertexAttrib3fv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib3fv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib3fv") + default void vertexAttrib3fv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib3fv(SegmentAllocator allocator, int index, float[] v) { - vertexAttrib3fv(index, allocator.allocateFrom(JAVA_FLOAT, v)); + @Entrypoint("glVertexAttrib3fv") + default void vertexAttrib3fv(SegmentAllocator allocator, int index, float[] v) { + throw new ContextException(); } - public static void vertexAttrib3s(int index, short x, short y, short z) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib3s).invokeExact(index, x, y, z); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib3s") + default void vertexAttrib3s(int index, short x, short y, short z) { + throw new ContextException(); } - public static void vertexAttrib3sv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib3sv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib3sv") + default void vertexAttrib3sv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib3sv(SegmentAllocator allocator, int index, short[] v) { - vertexAttrib3sv(index, allocator.allocateFrom(JAVA_SHORT, v)); + @Entrypoint("glVertexAttrib3sv") + default void vertexAttrib3sv(SegmentAllocator allocator, int index, short[] v) { + throw new ContextException(); } - public static void vertexAttrib4Nbv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib4Nbv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib4Nbv") + default void vertexAttrib4Nbv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib4Nbv(SegmentAllocator allocator, int index, byte[] v) { - vertexAttrib4Nbv(index, allocator.allocateFrom(JAVA_BYTE, v)); + @Entrypoint("glVertexAttrib4Nbv") + default void vertexAttrib4Nbv(SegmentAllocator allocator, int index, byte[] v) { + throw new ContextException(); } - public static void vertexAttrib4Niv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib4Niv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib4Niv") + default void vertexAttrib4Niv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib4Niv(SegmentAllocator allocator, int index, int[] v) { - vertexAttrib4Niv(index, allocator.allocateFrom(JAVA_INT, v)); + @Entrypoint("glVertexAttrib4Niv") + default void vertexAttrib4Niv(SegmentAllocator allocator, int index, int[] v) { + throw new ContextException(); } - public static void vertexAttrib4Nsv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib4Nsv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib4Nsv") + default void vertexAttrib4Nsv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib4Nsv(SegmentAllocator allocator, int index, short[] v) { - vertexAttrib4Nsv(index, allocator.allocateFrom(JAVA_SHORT, v)); + @Entrypoint("glVertexAttrib4Nsv") + default void vertexAttrib4Nsv(SegmentAllocator allocator, int index, short[] v) { + throw new ContextException(); } - public static void vertexAttrib4Nub(int index, byte x, byte y, byte z, byte w) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib4Nub).invokeExact(index, x, y, z, w); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib4Nub") + default void vertexAttrib4Nub(int index, byte x, byte y, byte z, byte w) { + throw new ContextException(); } - public static void vertexAttrib4Nubv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib4Nubv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib4Nubv") + default void vertexAttrib4Nubv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib4Nubv(SegmentAllocator allocator, int index, byte[] v) { - vertexAttrib4Nubv(index, allocator.allocateFrom(JAVA_BYTE, v)); + @Entrypoint("glVertexAttrib4Nubv") + default void vertexAttrib4Nubv(SegmentAllocator allocator, int index, byte[] v) { + throw new ContextException(); } - public static void vertexAttrib4Nuiv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib4Nuiv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib4Nuiv") + default void vertexAttrib4Nuiv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib4Nuiv(SegmentAllocator allocator, int index, int[] v) { - vertexAttrib4Nuiv(index, allocator.allocateFrom(JAVA_INT, v)); + @Entrypoint("glVertexAttrib4Nuiv") + default void vertexAttrib4Nuiv(SegmentAllocator allocator, int index, int[] v) { + throw new ContextException(); } - public static void vertexAttrib4Nusv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib4Nusv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib4Nusv") + default void vertexAttrib4Nusv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib4Nusv(SegmentAllocator allocator, int index, short[] v) { - vertexAttrib4Nusv(index, allocator.allocateFrom(JAVA_SHORT, v)); + @Entrypoint("glVertexAttrib4Nusv") + default void vertexAttrib4Nusv(SegmentAllocator allocator, int index, short[] v) { + throw new ContextException(); } - public static void vertexAttrib4bv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib4bv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib4bv") + default void vertexAttrib4bv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib4bv(SegmentAllocator allocator, int index, byte[] v) { - vertexAttrib4bv(index, allocator.allocateFrom(JAVA_BYTE, v)); + @Entrypoint("glVertexAttrib4bv") + default void vertexAttrib4bv(SegmentAllocator allocator, int index, byte[] v) { + throw new ContextException(); } - public static void vertexAttrib4d(int index, double x, double y, double z, double w) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib4d).invokeExact(index, x, y, z, w); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib4d") + default void vertexAttrib4d(int index, double x, double y, double z, double w) { + throw new ContextException(); } - public static void vertexAttrib4dv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib4dv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib4dv") + default void vertexAttrib4dv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib4dv(SegmentAllocator allocator, int index, double[] v) { - vertexAttrib4dv(index, allocator.allocateFrom(JAVA_DOUBLE, v)); + @Entrypoint("glVertexAttrib4dv") + default void vertexAttrib4dv(SegmentAllocator allocator, int index, double[] v) { + throw new ContextException(); } - public static void vertexAttrib4f(int index, float x, float y, float z, float w) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib4f).invokeExact(index, x, y, z, w); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib4f") + default void vertexAttrib4f(int index, float x, float y, float z, float w) { + throw new ContextException(); } - public static void vertexAttrib4fv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib4fv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib4fv") + default void vertexAttrib4fv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib4fv(SegmentAllocator allocator, int index, float[] v) { - vertexAttrib4fv(index, allocator.allocateFrom(JAVA_FLOAT, v)); + @Entrypoint("glVertexAttrib4fv") + default void vertexAttrib4fv(SegmentAllocator allocator, int index, float[] v) { + throw new ContextException(); } - public static void vertexAttrib4iv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib4iv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib4iv") + default void vertexAttrib4iv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib4iv(SegmentAllocator allocator, int index, int[] v) { - vertexAttrib4iv(index, allocator.allocateFrom(JAVA_INT, v)); + @Entrypoint("glVertexAttrib4iv") + default void vertexAttrib4iv(SegmentAllocator allocator, int index, int[] v) { + throw new ContextException(); } - public static void vertexAttrib4s(int index, short x, short y, short z, short w) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib4s).invokeExact(index, x, y, z, w); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib4s") + default void vertexAttrib4s(int index, short x, short y, short z, short w) { + throw new ContextException(); } - public static void vertexAttrib4sv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib4sv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib4sv") + default void vertexAttrib4sv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib4sv(SegmentAllocator allocator, int index, short[] v) { - vertexAttrib4sv(index, allocator.allocateFrom(JAVA_SHORT, v)); + @Entrypoint("glVertexAttrib4sv") + default void vertexAttrib4sv(SegmentAllocator allocator, int index, short[] v) { + throw new ContextException(); } - public static void vertexAttrib4ubv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib4ubv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib4ubv") + default void vertexAttrib4ubv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib4ubv(SegmentAllocator allocator, int index, byte[] v) { - vertexAttrib4ubv(index, allocator.allocateFrom(JAVA_BYTE, v)); + @Entrypoint("glVertexAttrib4ubv") + default void vertexAttrib4ubv(SegmentAllocator allocator, int index, byte[] v) { + throw new ContextException(); } - public static void vertexAttrib4uiv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib4uiv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib4uiv") + default void vertexAttrib4uiv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib4uiv(SegmentAllocator allocator, int index, int[] v) { - vertexAttrib4uiv(index, allocator.allocateFrom(JAVA_INT, v)); + @Entrypoint("glVertexAttrib4uiv") + default void vertexAttrib4uiv(SegmentAllocator allocator, int index, int[] v) { + throw new ContextException(); } - public static void vertexAttrib4usv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttrib4usv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttrib4usv") + default void vertexAttrib4usv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttrib4usv(SegmentAllocator allocator, int index, short[] v) { - vertexAttrib4usv(index, allocator.allocateFrom(JAVA_SHORT, v)); + @Entrypoint("glVertexAttrib4usv") + default void vertexAttrib4usv(SegmentAllocator allocator, int index, short[] v) { + throw new ContextException(); } - public static void vertexAttribPointer(int index, int size, int type, boolean normalized, int stride, MemorySegment pointer) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribPointer).invokeExact(index, size, type, normalized, stride, pointer); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribPointer") + default void vertexAttribPointer(int index, int size, int type, boolean normalized, int stride, MemorySegment pointer) { + throw new ContextException(); } - public static void vertexAttribPointer(SegmentAllocator allocator, int index, int size, int type, boolean normalized, int stride, byte[] pointer) { - vertexAttribPointer(index, size, type, normalized, stride, allocator.allocateFrom(JAVA_BYTE, pointer)); + @Entrypoint("glVertexAttribPointer") + default void vertexAttribPointer(SegmentAllocator allocator, int index, int size, int type, boolean normalized, int stride, byte[] pointer) { + throw new ContextException(); } - public static void vertexAttribPointer(SegmentAllocator allocator, int index, int size, int type, boolean normalized, int stride, short[] pointer) { - vertexAttribPointer(index, size, type, normalized, stride, allocator.allocateFrom(JAVA_SHORT, pointer)); + @Entrypoint("glVertexAttribPointer") + default void vertexAttribPointer(SegmentAllocator allocator, int index, int size, int type, boolean normalized, int stride, short[] pointer) { + throw new ContextException(); } - public static void vertexAttribPointer(SegmentAllocator allocator, int index, int size, int type, boolean normalized, int stride, int[] pointer) { - vertexAttribPointer(index, size, type, normalized, stride, allocator.allocateFrom(JAVA_INT, pointer)); + @Entrypoint("glVertexAttribPointer") + default void vertexAttribPointer(SegmentAllocator allocator, int index, int size, int type, boolean normalized, int stride, int[] pointer) { + throw new ContextException(); } - public static void vertexAttribPointer(SegmentAllocator allocator, int index, int size, int type, boolean normalized, int stride, float[] pointer) { - vertexAttribPointer(index, size, type, normalized, stride, allocator.allocateFrom(JAVA_FLOAT, pointer)); + @Entrypoint("glVertexAttribPointer") + default void vertexAttribPointer(SegmentAllocator allocator, int index, int size, int type, boolean normalized, int stride, float[] pointer) { + throw new ContextException(); } - public static void vertexAttribPointer(SegmentAllocator allocator, int index, int size, int type, boolean normalized, int stride, double[] pointer) { - vertexAttribPointer(index, size, type, normalized, stride, allocator.allocateFrom(JAVA_DOUBLE, pointer)); + @Entrypoint("glVertexAttribPointer") + default void vertexAttribPointer(SegmentAllocator allocator, int index, int size, int type, boolean normalized, int stride, double[] pointer) { + throw new ContextException(); } } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL30C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL30C.java index 9dc4be1d..04c22a36 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL30C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL30C.java @@ -17,17 +17,21 @@ package overrungl.opengl; import org.jetbrains.annotations.Nullable; +import overrun.marshal.Marshal; import overrun.marshal.MemoryStack; +import overrun.marshal.Unmarshal; +import overrun.marshal.gen.Entrypoint; +import overrun.marshal.gen.Ref; +import overrun.marshal.gen.SizedSeg; +import overrun.marshal.gen.Skip; import overrungl.opengl.ext.arb.GLARBColorBufferFloat; import overrungl.opengl.ext.arb.GLARBTextureFloat; -import overrungl.internal.RuntimeHelper; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; +import java.lang.invoke.MethodHandle; import static java.lang.foreign.ValueLayout.*; -import static overrungl.FunctionDescriptors.*; -import static overrungl.opengl.GLLoader.*; /** * The OpenGL 3.0 core profile functions. @@ -45,1497 +49,1008 @@ * @since 0.1.0 */ public sealed interface GL30C extends GL21C permits GL30, GL31C { - public static final int COMPARE_REF_TO_TEXTURE = 0x884E; - public static final int CLIP_DISTANCE0 = 0x3000; - public static final int CLIP_DISTANCE1 = 0x3001; - public static final int CLIP_DISTANCE2 = 0x3002; - public static final int CLIP_DISTANCE3 = 0x3003; - public static final int CLIP_DISTANCE4 = 0x3004; - public static final int CLIP_DISTANCE5 = 0x3005; - public static final int CLIP_DISTANCE6 = 0x3006; - public static final int CLIP_DISTANCE7 = 0x3007; - public static final int MAX_CLIP_DISTANCES = 0x0D32; - public static final int MAJOR_VERSION = 0x821B; - public static final int MINOR_VERSION = 0x821C; - public static final int NUM_EXTENSIONS = 0x821D; - public static final int CONTEXT_FLAGS = 0x821E; - public static final int COMPRESSED_RED = 0x8225; - public static final int COMPRESSED_RG = 0x8226; - public static final int CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 0x00000001; - public static final int RGBA32F = 0x8814; - public static final int RGB32F = 0x8815; - public static final int RGBA16F = 0x881A; - public static final int RGB16F = 0x881B; - public static final int VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD; - public static final int MAX_ARRAY_TEXTURE_LAYERS = 0x88FF; - public static final int MIN_PROGRAM_TEXEL_OFFSET = 0x8904; - public static final int MAX_PROGRAM_TEXEL_OFFSET = 0x8905; - public static final int CLAMP_READ_COLOR = 0x891C; - public static final int FIXED_ONLY = 0x891D; - public static final int MAX_VARYING_COMPONENTS = 0x8B4B; - public static final int TEXTURE_1D_ARRAY = 0x8C18; - public static final int PROXY_TEXTURE_1D_ARRAY = 0x8C19; - public static final int TEXTURE_2D_ARRAY = 0x8C1A; - public static final int PROXY_TEXTURE_2D_ARRAY = 0x8C1B; - public static final int TEXTURE_BINDING_1D_ARRAY = 0x8C1C; - public static final int TEXTURE_BINDING_2D_ARRAY = 0x8C1D; - public static final int R11F_G11F_B10F = 0x8C3A; - public static final int UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B; - public static final int RGB9_E5 = 0x8C3D; - public static final int UNSIGNED_INT_5_9_9_9_REV = 0x8C3E; - public static final int TEXTURE_SHARED_SIZE = 0x8C3F; - public static final int TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH = 0x8C76; - public static final int TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F; - public static final int MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8C80; - public static final int TRANSFORM_FEEDBACK_VARYINGS = 0x8C83; - public static final int TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84; - public static final int TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85; - public static final int PRIMITIVES_GENERATED = 0x8C87; - public static final int TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88; - public static final int RASTERIZER_DISCARD = 0x8C89; - public static final int MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A; - public static final int MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B; - public static final int INTERLEAVED_ATTRIBS = 0x8C8C; - public static final int SEPARATE_ATTRIBS = 0x8C8D; - public static final int TRANSFORM_FEEDBACK_BUFFER = 0x8C8E; - public static final int TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F; - public static final int RGBA32UI = 0x8D70; - public static final int RGB32UI = 0x8D71; - public static final int RGBA16UI = 0x8D76; - public static final int RGB16UI = 0x8D77; - public static final int RGBA8UI = 0x8D7C; - public static final int RGB8UI = 0x8D7D; - public static final int RGBA32I = 0x8D82; - public static final int RGB32I = 0x8D83; - public static final int RGBA16I = 0x8D88; - public static final int RGB16I = 0x8D89; - public static final int RGBA8I = 0x8D8E; - public static final int RGB8I = 0x8D8F; - public static final int RED_INTEGER = 0x8D94; - public static final int GREEN_INTEGER = 0x8D95; - public static final int BLUE_INTEGER = 0x8D96; - public static final int RGB_INTEGER = 0x8D98; - public static final int RGBA_INTEGER = 0x8D99; - public static final int BGR_INTEGER = 0x8D9A; - public static final int BGRA_INTEGER = 0x8D9B; - public static final int SAMPLER_1D_ARRAY = 0x8DC0; - public static final int SAMPLER_2D_ARRAY = 0x8DC1; - public static final int SAMPLER_1D_ARRAY_SHADOW = 0x8DC3; - public static final int SAMPLER_2D_ARRAY_SHADOW = 0x8DC4; - public static final int SAMPLER_CUBE_SHADOW = 0x8DC5; - public static final int UNSIGNED_INT_VEC2 = 0x8DC6; - public static final int UNSIGNED_INT_VEC3 = 0x8DC7; - public static final int UNSIGNED_INT_VEC4 = 0x8DC8; - public static final int INT_SAMPLER_1D = 0x8DC9; - public static final int INT_SAMPLER_2D = 0x8DCA; - public static final int INT_SAMPLER_3D = 0x8DCB; - public static final int INT_SAMPLER_CUBE = 0x8DCC; - public static final int INT_SAMPLER_1D_ARRAY = 0x8DCE; - public static final int INT_SAMPLER_2D_ARRAY = 0x8DCF; - public static final int UNSIGNED_INT_SAMPLER_1D = 0x8DD1; - public static final int UNSIGNED_INT_SAMPLER_2D = 0x8DD2; - public static final int UNSIGNED_INT_SAMPLER_3D = 0x8DD3; - public static final int UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4; - public static final int UNSIGNED_INT_SAMPLER_1D_ARRAY = 0x8DD6; - public static final int UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7; - public static final int QUERY_WAIT = 0x8E13; - public static final int QUERY_NO_WAIT = 0x8E14; - public static final int QUERY_BY_REGION_WAIT = 0x8E15; - public static final int QUERY_BY_REGION_NO_WAIT = 0x8E16; - public static final int BUFFER_ACCESS_FLAGS = 0x911F; - public static final int BUFFER_MAP_LENGTH = 0x9120; - public static final int BUFFER_MAP_OFFSET = 0x9121; - public static final int DEPTH_COMPONENT32F = 0x8CAC; - public static final int DEPTH32F_STENCIL8 = 0x8CAD; - public static final int FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD; - public static final int INVALID_FRAMEBUFFER_OPERATION = 0x0506; - public static final int FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210; - public static final int FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211; - public static final int FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212; - public static final int FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213; - public static final int FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214; - public static final int FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215; - public static final int FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216; - public static final int FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217; - public static final int FRAMEBUFFER_DEFAULT = 0x8218; - public static final int FRAMEBUFFER_UNDEFINED = 0x8219; - public static final int DEPTH_STENCIL_ATTACHMENT = 0x821A; - public static final int MAX_RENDERBUFFER_SIZE = 0x84E8; - public static final int DEPTH_STENCIL = 0x84F9; - public static final int UNSIGNED_INT_24_8 = 0x84FA; - public static final int DEPTH24_STENCIL8 = 0x88F0; - public static final int TEXTURE_STENCIL_SIZE = 0x88F1; - public static final int TEXTURE_RED_TYPE = 0x8C10; - public static final int TEXTURE_GREEN_TYPE = 0x8C11; - public static final int TEXTURE_BLUE_TYPE = 0x8C12; - public static final int TEXTURE_ALPHA_TYPE = 0x8C13; - public static final int TEXTURE_DEPTH_TYPE = 0x8C16; - public static final int UNSIGNED_NORMALIZED = 0x8C17; - public static final int FRAMEBUFFER_BINDING = 0x8CA6; - public static final int DRAW_FRAMEBUFFER_BINDING = 0x8CA6; - public static final int RENDERBUFFER_BINDING = 0x8CA7; - public static final int READ_FRAMEBUFFER = 0x8CA8; - public static final int DRAW_FRAMEBUFFER = 0x8CA9; - public static final int READ_FRAMEBUFFER_BINDING = 0x8CAA; - public static final int RENDERBUFFER_SAMPLES = 0x8CAB; - public static final int FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0; - public static final int FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1; - public static final int FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2; - public static final int FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3; - public static final int FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4; - public static final int FRAMEBUFFER_COMPLETE = 0x8CD5; - public static final int FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6; - public static final int FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7; - public static final int FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 0x8CDB; - public static final int FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 0x8CDC; - public static final int FRAMEBUFFER_UNSUPPORTED = 0x8CDD; - public static final int MAX_COLOR_ATTACHMENTS = 0x8CDF; - public static final int COLOR_ATTACHMENT0 = 0x8CE0; - public static final int COLOR_ATTACHMENT1 = 0x8CE1; - public static final int COLOR_ATTACHMENT2 = 0x8CE2; - public static final int COLOR_ATTACHMENT3 = 0x8CE3; - public static final int COLOR_ATTACHMENT4 = 0x8CE4; - public static final int COLOR_ATTACHMENT5 = 0x8CE5; - public static final int COLOR_ATTACHMENT6 = 0x8CE6; - public static final int COLOR_ATTACHMENT7 = 0x8CE7; - public static final int COLOR_ATTACHMENT8 = 0x8CE8; - public static final int COLOR_ATTACHMENT9 = 0x8CE9; - public static final int COLOR_ATTACHMENT10 = 0x8CEA; - public static final int COLOR_ATTACHMENT11 = 0x8CEB; - public static final int COLOR_ATTACHMENT12 = 0x8CEC; - public static final int COLOR_ATTACHMENT13 = 0x8CED; - public static final int COLOR_ATTACHMENT14 = 0x8CEE; - public static final int COLOR_ATTACHMENT15 = 0x8CEF; - public static final int COLOR_ATTACHMENT16 = 0x8CF0; - public static final int COLOR_ATTACHMENT17 = 0x8CF1; - public static final int COLOR_ATTACHMENT18 = 0x8CF2; - public static final int COLOR_ATTACHMENT19 = 0x8CF3; - public static final int COLOR_ATTACHMENT20 = 0x8CF4; - public static final int COLOR_ATTACHMENT21 = 0x8CF5; - public static final int COLOR_ATTACHMENT22 = 0x8CF6; - public static final int COLOR_ATTACHMENT23 = 0x8CF7; - public static final int COLOR_ATTACHMENT24 = 0x8CF8; - public static final int COLOR_ATTACHMENT25 = 0x8CF9; - public static final int COLOR_ATTACHMENT26 = 0x8CFA; - public static final int COLOR_ATTACHMENT27 = 0x8CFB; - public static final int COLOR_ATTACHMENT28 = 0x8CFC; - public static final int COLOR_ATTACHMENT29 = 0x8CFD; - public static final int COLOR_ATTACHMENT30 = 0x8CFE; - public static final int COLOR_ATTACHMENT31 = 0x8CFF; - public static final int DEPTH_ATTACHMENT = 0x8D00; - public static final int STENCIL_ATTACHMENT = 0x8D20; - public static final int FRAMEBUFFER = 0x8D40; - public static final int RENDERBUFFER = 0x8D41; - public static final int RENDERBUFFER_WIDTH = 0x8D42; - public static final int RENDERBUFFER_HEIGHT = 0x8D43; - public static final int RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; - public static final int STENCIL_INDEX1 = 0x8D46; - public static final int STENCIL_INDEX4 = 0x8D47; - public static final int STENCIL_INDEX8 = 0x8D48; - public static final int STENCIL_INDEX16 = 0x8D49; - public static final int RENDERBUFFER_RED_SIZE = 0x8D50; - public static final int RENDERBUFFER_GREEN_SIZE = 0x8D51; - public static final int RENDERBUFFER_BLUE_SIZE = 0x8D52; - public static final int RENDERBUFFER_ALPHA_SIZE = 0x8D53; - public static final int RENDERBUFFER_DEPTH_SIZE = 0x8D54; - public static final int RENDERBUFFER_STENCIL_SIZE = 0x8D55; - public static final int FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56; - public static final int MAX_SAMPLES = 0x8D57; - public static final int FRAMEBUFFER_SRGB = 0x8DB9; - public static final int HALF_FLOAT = 0x140B; - public static final int MAP_READ_BIT = 0x0001; - public static final int MAP_WRITE_BIT = 0x0002; - public static final int MAP_INVALIDATE_RANGE_BIT = 0x0004; - public static final int MAP_INVALIDATE_BUFFER_BIT = 0x0008; - public static final int MAP_FLUSH_EXPLICIT_BIT = 0x0010; - public static final int MAP_UNSYNCHRONIZED_BIT = 0x0020; - public static final int COMPRESSED_RED_RGTC1 = 0x8DBB; - public static final int COMPRESSED_SIGNED_RED_RGTC1 = 0x8DBC; - public static final int COMPRESSED_RG_RGTC2 = 0x8DBD; - public static final int COMPRESSED_SIGNED_RG_RGTC2 = 0x8DBE; - public static final int RG = 0x8227; - public static final int RG_INTEGER = 0x8228; - public static final int R8 = 0x8229; - public static final int R16 = 0x822A; - public static final int RG8 = 0x822B; - public static final int RG16 = 0x822C; - public static final int R16F = 0x822D; - public static final int R32F = 0x822E; - public static final int RG16F = 0x822F; - public static final int RG32F = 0x8230; - public static final int R8I = 0x8231; - public static final int R8UI = 0x8232; - public static final int R16I = 0x8233; - public static final int R16UI = 0x8234; - public static final int R32I = 0x8235; - public static final int R32UI = 0x8236; - public static final int RG8I = 0x8237; - public static final int RG8UI = 0x8238; - public static final int RG16I = 0x8239; - public static final int RG16UI = 0x823A; - public static final int RG32I = 0x823B; - public static final int RG32UI = 0x823C; - public static final int VERTEX_ARRAY_BINDING = 0x85B5; - - static boolean isSupported(GLCapabilities caps) { - return checkAll(caps.glBeginConditionalRender, caps.glBeginTransformFeedback, caps.glBindBufferBase, caps.glBindBufferRange, caps.glBindFragDataLocation, caps.glBindFramebuffer, - caps.glBindRenderbuffer, caps.glBindVertexArray, caps.glBlitFramebuffer, caps.glCheckFramebufferStatus, caps.glClampColor, caps.glClearBufferfi, - caps.glClearBufferfv, caps.glClearBufferiv, caps.glClearBufferuiv, caps.glColorMaski, caps.glDeleteFramebuffers, caps.glDeleteRenderbuffers, - caps.glDeleteVertexArrays, caps.glDisablei, caps.glEnablei, caps.glEndConditionalRender, caps.glEndTransformFeedback, caps.glFlushMappedBufferRange, - caps.glFramebufferRenderbuffer, caps.glFramebufferTexture1D, caps.glFramebufferTexture2D, caps.glFramebufferTexture3D, caps.glFramebufferTextureLayer, caps.glGenFramebuffers, - caps.glGenRenderbuffers, caps.glGenVertexArrays, caps.glGenerateMipmap, caps.glGetBooleani_v, caps.glGetFragDataLocation, caps.glGetFramebufferAttachmentParameteriv, - caps.glGetIntegeri_v, caps.glGetRenderbufferParameteriv, caps.glGetStringi, caps.glGetTexParameterIiv, caps.glGetTexParameterIuiv, caps.glGetTransformFeedbackVarying, - caps.glGetUniformuiv, caps.glGetVertexAttribIiv, caps.glGetVertexAttribIuiv, caps.glIsEnabledi, caps.glIsFramebuffer, caps.glIsRenderbuffer, - caps.glIsVertexArray, caps.glMapBufferRange, caps.glRenderbufferStorage, caps.glRenderbufferStorageMultisample, caps.glTexParameterIiv, caps.glTexParameterIuiv, - caps.glTransformFeedbackVaryings, caps.glUniform1ui, caps.glUniform1uiv, caps.glUniform2ui, caps.glUniform2uiv, caps.glUniform3ui, - caps.glUniform3uiv, caps.glUniform4ui, caps.glUniform4uiv, caps.glVertexAttribI1i, caps.glVertexAttribI1iv, caps.glVertexAttribI1ui, - caps.glVertexAttribI1uiv, caps.glVertexAttribI2i, caps.glVertexAttribI2iv, caps.glVertexAttribI2ui, caps.glVertexAttribI2uiv, caps.glVertexAttribI3i, - caps.glVertexAttribI3iv, caps.glVertexAttribI3ui, caps.glVertexAttribI3uiv, caps.glVertexAttribI4bv, caps.glVertexAttribI4i, caps.glVertexAttribI4iv, - caps.glVertexAttribI4sv, caps.glVertexAttribI4ubv, caps.glVertexAttribI4ui, caps.glVertexAttribI4uiv, caps.glVertexAttribI4usv, caps.glVertexAttribIPointer); - } - - static void load(GLCapabilities caps, GLLoadFunc load) { - caps.glBeginConditionalRender = load.invoke("glBeginConditionalRender", IIV); - caps.glBeginTransformFeedback = load.invoke("glBeginTransformFeedback", IV); - caps.glBindBufferBase = load.invoke("glBindBufferBase", IIIV); - caps.glBindBufferRange = load.invoke("glBindBufferRange", IIIJJV); - caps.glBindFragDataLocation = load.invoke("glBindFragDataLocation", IIPV); - caps.glBindFramebuffer = load.invoke("glBindFramebuffer", IIV); - caps.glBindRenderbuffer = load.invoke("glBindRenderbuffer", IIV); - caps.glBindVertexArray = load.invoke("glBindVertexArray", IV); - caps.glBlitFramebuffer = load.invoke("glBlitFramebuffer", IIIIIIIIIIV); - caps.glCheckFramebufferStatus = load.invoke("glCheckFramebufferStatus", II); - caps.glClampColor = load.invoke("glClampColor", IIV); - caps.glClearBufferfi = load.invoke("glClearBufferfi", IIFIV); - caps.glClearBufferfv = load.invoke("glClearBufferfv", IIPV); - caps.glClearBufferiv = load.invoke("glClearBufferiv", IIPV); - caps.glClearBufferuiv = load.invoke("glClearBufferuiv", IIPV); - caps.glColorMaski = load.invoke("glColorMaski", IZZZZV); - caps.glDeleteFramebuffers = load.invoke("glDeleteFramebuffers", IPV); - caps.glDeleteRenderbuffers = load.invoke("glDeleteRenderbuffers", IPV); - caps.glDeleteVertexArrays = load.invoke("glDeleteVertexArrays", IPV); - caps.glDisablei = load.invoke("glDisablei", IIV); - caps.glEnablei = load.invoke("glEnablei", IIV); - caps.glEndConditionalRender = load.invoke("glEndConditionalRender", V); - caps.glEndTransformFeedback = load.invoke("glEndTransformFeedback", V); - caps.glFlushMappedBufferRange = load.invoke("glFlushMappedBufferRange", IJJV); - caps.glFramebufferRenderbuffer = load.invoke("glFramebufferRenderbuffer", IIIIV); - caps.glFramebufferTexture1D = load.invoke("glFramebufferTexture1D", IIIIIV); - caps.glFramebufferTexture2D = load.invoke("glFramebufferTexture2D", IIIIIV); - caps.glFramebufferTexture3D = load.invoke("glFramebufferTexture3D", IIIIIIV); - caps.glFramebufferTextureLayer = load.invoke("glFramebufferTextureLayer", IIIIIV); - caps.glGenFramebuffers = load.invoke("glGenFramebuffers", IPV); - caps.glGenRenderbuffers = load.invoke("glGenRenderbuffers", IPV); - caps.glGenVertexArrays = load.invoke("glGenVertexArrays", IPV); - caps.glGenerateMipmap = load.invoke("glGenerateMipmap", IV); - caps.glGetBooleani_v = load.invoke("glGetBooleani_v", IIPV); - caps.glGetFragDataLocation = load.invoke("glGetFragDataLocation", IPI); - caps.glGetFramebufferAttachmentParameteriv = load.invoke("glGetFramebufferAttachmentParameteriv", IIIPV); - caps.glGetIntegeri_v = load.invoke("glGetIntegeri_v", IIPV); - caps.glGetRenderbufferParameteriv = load.invoke("glGetRenderbufferParameteriv", IIPV); - caps.glGetStringi = load.invoke("glGetStringi", IIp); - caps.glGetTexParameterIiv = load.invoke("glGetTexParameterIiv", IIPV); - caps.glGetTexParameterIuiv = load.invoke("glGetTexParameterIuiv", IIPV); - caps.glGetTransformFeedbackVarying = load.invoke("glGetTransformFeedbackVarying", IIIPPPPV); - caps.glGetUniformuiv = load.invoke("glGetUniformuiv", IIPV); - caps.glGetVertexAttribIiv = load.invoke("glGetVertexAttribIiv", IIPV); - caps.glGetVertexAttribIuiv = load.invoke("glGetVertexAttribIuiv", IIPV); - caps.glIsEnabledi = load.invoke("glIsEnabledi", IIZ); - caps.glIsFramebuffer = load.invoke("glIsFramebuffer", IZ); - caps.glIsRenderbuffer = load.invoke("glIsRenderbuffer", IZ); - caps.glIsVertexArray = load.invoke("glIsVertexArray", IZ); - caps.glMapBufferRange = load.invoke("glMapBufferRange", IJJIP); - caps.glRenderbufferStorage = load.invoke("glRenderbufferStorage", IIIIV); - caps.glRenderbufferStorageMultisample = load.invoke("glRenderbufferStorageMultisample", IIIIIV); - caps.glTexParameterIiv = load.invoke("glTexParameterIiv", IIPV); - caps.glTexParameterIuiv = load.invoke("glTexParameterIuiv", IIPV); - caps.glTransformFeedbackVaryings = load.invoke("glTransformFeedbackVaryings", IIPIV); - caps.glUniform1ui = load.invoke("glUniform1ui", IIV); - caps.glUniform1uiv = load.invoke("glUniform1uiv", IIPV); - caps.glUniform2ui = load.invoke("glUniform2ui", IIIV); - caps.glUniform2uiv = load.invoke("glUniform2uiv", IIPV); - caps.glUniform3ui = load.invoke("glUniform3ui", IIIIV); - caps.glUniform3uiv = load.invoke("glUniform3uiv", IIPV); - caps.glUniform4ui = load.invoke("glUniform4ui", IIIIIV); - caps.glUniform4uiv = load.invoke("glUniform4uiv", IIPV); - caps.glVertexAttribI1i = load.invoke("glVertexAttribI1i", IIV); - caps.glVertexAttribI1iv = load.invoke("glVertexAttribI1iv", IPV); - caps.glVertexAttribI1ui = load.invoke("glVertexAttribI1ui", IIV); - caps.glVertexAttribI1uiv = load.invoke("glVertexAttribI1uiv", IPV); - caps.glVertexAttribI2i = load.invoke("glVertexAttribI2i", IIIV); - caps.glVertexAttribI2iv = load.invoke("glVertexAttribI2iv", IPV); - caps.glVertexAttribI2ui = load.invoke("glVertexAttribI2ui", IIIV); - caps.glVertexAttribI2uiv = load.invoke("glVertexAttribI2uiv", IPV); - caps.glVertexAttribI3i = load.invoke("glVertexAttribI3i", IIIIV); - caps.glVertexAttribI3iv = load.invoke("glVertexAttribI3iv", IPV); - caps.glVertexAttribI3ui = load.invoke("glVertexAttribI3ui", IIIIV); - caps.glVertexAttribI3uiv = load.invoke("glVertexAttribI3uiv", IPV); - caps.glVertexAttribI4bv = load.invoke("glVertexAttribI4bv", IPV); - caps.glVertexAttribI4i = load.invoke("glVertexAttribI4i", IIIIIV); - caps.glVertexAttribI4iv = load.invoke("glVertexAttribI4iv", IPV); - caps.glVertexAttribI4sv = load.invoke("glVertexAttribI4sv", IPV); - caps.glVertexAttribI4ubv = load.invoke("glVertexAttribI4ubv", IPV); - caps.glVertexAttribI4ui = load.invoke("glVertexAttribI4ui", IIIIIV); - caps.glVertexAttribI4uiv = load.invoke("glVertexAttribI4uiv", IPV); - caps.glVertexAttribI4usv = load.invoke("glVertexAttribI4usv", IPV); - caps.glVertexAttribIPointer = load.invoke("glVertexAttribIPointer", IIIIPV); - } - - public static void beginConditionalRender(int id, int mode) { - var caps = getCapabilities(); - try { - check(caps.glBeginConditionalRender).invokeExact(id, mode); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + int COMPARE_REF_TO_TEXTURE = 0x884E; + int CLIP_DISTANCE0 = 0x3000; + int CLIP_DISTANCE1 = 0x3001; + int CLIP_DISTANCE2 = 0x3002; + int CLIP_DISTANCE3 = 0x3003; + int CLIP_DISTANCE4 = 0x3004; + int CLIP_DISTANCE5 = 0x3005; + int CLIP_DISTANCE6 = 0x3006; + int CLIP_DISTANCE7 = 0x3007; + int MAX_CLIP_DISTANCES = 0x0D32; + int MAJOR_VERSION = 0x821B; + int MINOR_VERSION = 0x821C; + int NUM_EXTENSIONS = 0x821D; + int CONTEXT_FLAGS = 0x821E; + int COMPRESSED_RED = 0x8225; + int COMPRESSED_RG = 0x8226; + int CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT = 0x00000001; + int RGBA32F = 0x8814; + int RGB32F = 0x8815; + int RGBA16F = 0x881A; + int RGB16F = 0x881B; + int VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD; + int MAX_ARRAY_TEXTURE_LAYERS = 0x88FF; + int MIN_PROGRAM_TEXEL_OFFSET = 0x8904; + int MAX_PROGRAM_TEXEL_OFFSET = 0x8905; + int CLAMP_READ_COLOR = 0x891C; + int FIXED_ONLY = 0x891D; + int MAX_VARYING_COMPONENTS = 0x8B4B; + int TEXTURE_1D_ARRAY = 0x8C18; + int PROXY_TEXTURE_1D_ARRAY = 0x8C19; + int TEXTURE_2D_ARRAY = 0x8C1A; + int PROXY_TEXTURE_2D_ARRAY = 0x8C1B; + int TEXTURE_BINDING_1D_ARRAY = 0x8C1C; + int TEXTURE_BINDING_2D_ARRAY = 0x8C1D; + int R11F_G11F_B10F = 0x8C3A; + int UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B; + int RGB9_E5 = 0x8C3D; + int UNSIGNED_INT_5_9_9_9_REV = 0x8C3E; + int TEXTURE_SHARED_SIZE = 0x8C3F; + int TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH = 0x8C76; + int TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F; + int MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8C80; + int TRANSFORM_FEEDBACK_VARYINGS = 0x8C83; + int TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84; + int TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85; + int PRIMITIVES_GENERATED = 0x8C87; + int TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88; + int RASTERIZER_DISCARD = 0x8C89; + int MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A; + int MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B; + int INTERLEAVED_ATTRIBS = 0x8C8C; + int SEPARATE_ATTRIBS = 0x8C8D; + int TRANSFORM_FEEDBACK_BUFFER = 0x8C8E; + int TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F; + int RGBA32UI = 0x8D70; + int RGB32UI = 0x8D71; + int RGBA16UI = 0x8D76; + int RGB16UI = 0x8D77; + int RGBA8UI = 0x8D7C; + int RGB8UI = 0x8D7D; + int RGBA32I = 0x8D82; + int RGB32I = 0x8D83; + int RGBA16I = 0x8D88; + int RGB16I = 0x8D89; + int RGBA8I = 0x8D8E; + int RGB8I = 0x8D8F; + int RED_INTEGER = 0x8D94; + int GREEN_INTEGER = 0x8D95; + int BLUE_INTEGER = 0x8D96; + int RGB_INTEGER = 0x8D98; + int RGBA_INTEGER = 0x8D99; + int BGR_INTEGER = 0x8D9A; + int BGRA_INTEGER = 0x8D9B; + int SAMPLER_1D_ARRAY = 0x8DC0; + int SAMPLER_2D_ARRAY = 0x8DC1; + int SAMPLER_1D_ARRAY_SHADOW = 0x8DC3; + int SAMPLER_2D_ARRAY_SHADOW = 0x8DC4; + int SAMPLER_CUBE_SHADOW = 0x8DC5; + int UNSIGNED_INT_VEC2 = 0x8DC6; + int UNSIGNED_INT_VEC3 = 0x8DC7; + int UNSIGNED_INT_VEC4 = 0x8DC8; + int INT_SAMPLER_1D = 0x8DC9; + int INT_SAMPLER_2D = 0x8DCA; + int INT_SAMPLER_3D = 0x8DCB; + int INT_SAMPLER_CUBE = 0x8DCC; + int INT_SAMPLER_1D_ARRAY = 0x8DCE; + int INT_SAMPLER_2D_ARRAY = 0x8DCF; + int UNSIGNED_INT_SAMPLER_1D = 0x8DD1; + int UNSIGNED_INT_SAMPLER_2D = 0x8DD2; + int UNSIGNED_INT_SAMPLER_3D = 0x8DD3; + int UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4; + int UNSIGNED_INT_SAMPLER_1D_ARRAY = 0x8DD6; + int UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7; + int QUERY_WAIT = 0x8E13; + int QUERY_NO_WAIT = 0x8E14; + int QUERY_BY_REGION_WAIT = 0x8E15; + int QUERY_BY_REGION_NO_WAIT = 0x8E16; + int BUFFER_ACCESS_FLAGS = 0x911F; + int BUFFER_MAP_LENGTH = 0x9120; + int BUFFER_MAP_OFFSET = 0x9121; + int DEPTH_COMPONENT32F = 0x8CAC; + int DEPTH32F_STENCIL8 = 0x8CAD; + int FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD; + int INVALID_FRAMEBUFFER_OPERATION = 0x0506; + int FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210; + int FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211; + int FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212; + int FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213; + int FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214; + int FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215; + int FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216; + int FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217; + int FRAMEBUFFER_DEFAULT = 0x8218; + int FRAMEBUFFER_UNDEFINED = 0x8219; + int DEPTH_STENCIL_ATTACHMENT = 0x821A; + int MAX_RENDERBUFFER_SIZE = 0x84E8; + int DEPTH_STENCIL = 0x84F9; + int UNSIGNED_INT_24_8 = 0x84FA; + int DEPTH24_STENCIL8 = 0x88F0; + int TEXTURE_STENCIL_SIZE = 0x88F1; + int TEXTURE_RED_TYPE = 0x8C10; + int TEXTURE_GREEN_TYPE = 0x8C11; + int TEXTURE_BLUE_TYPE = 0x8C12; + int TEXTURE_ALPHA_TYPE = 0x8C13; + int TEXTURE_DEPTH_TYPE = 0x8C16; + int UNSIGNED_NORMALIZED = 0x8C17; + int FRAMEBUFFER_BINDING = 0x8CA6; + int DRAW_FRAMEBUFFER_BINDING = 0x8CA6; + int RENDERBUFFER_BINDING = 0x8CA7; + int READ_FRAMEBUFFER = 0x8CA8; + int DRAW_FRAMEBUFFER = 0x8CA9; + int READ_FRAMEBUFFER_BINDING = 0x8CAA; + int RENDERBUFFER_SAMPLES = 0x8CAB; + int FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0; + int FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1; + int FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2; + int FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3; + int FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4; + int FRAMEBUFFER_COMPLETE = 0x8CD5; + int FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6; + int FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7; + int FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER = 0x8CDB; + int FRAMEBUFFER_INCOMPLETE_READ_BUFFER = 0x8CDC; + int FRAMEBUFFER_UNSUPPORTED = 0x8CDD; + int MAX_COLOR_ATTACHMENTS = 0x8CDF; + int COLOR_ATTACHMENT0 = 0x8CE0; + int COLOR_ATTACHMENT1 = 0x8CE1; + int COLOR_ATTACHMENT2 = 0x8CE2; + int COLOR_ATTACHMENT3 = 0x8CE3; + int COLOR_ATTACHMENT4 = 0x8CE4; + int COLOR_ATTACHMENT5 = 0x8CE5; + int COLOR_ATTACHMENT6 = 0x8CE6; + int COLOR_ATTACHMENT7 = 0x8CE7; + int COLOR_ATTACHMENT8 = 0x8CE8; + int COLOR_ATTACHMENT9 = 0x8CE9; + int COLOR_ATTACHMENT10 = 0x8CEA; + int COLOR_ATTACHMENT11 = 0x8CEB; + int COLOR_ATTACHMENT12 = 0x8CEC; + int COLOR_ATTACHMENT13 = 0x8CED; + int COLOR_ATTACHMENT14 = 0x8CEE; + int COLOR_ATTACHMENT15 = 0x8CEF; + int COLOR_ATTACHMENT16 = 0x8CF0; + int COLOR_ATTACHMENT17 = 0x8CF1; + int COLOR_ATTACHMENT18 = 0x8CF2; + int COLOR_ATTACHMENT19 = 0x8CF3; + int COLOR_ATTACHMENT20 = 0x8CF4; + int COLOR_ATTACHMENT21 = 0x8CF5; + int COLOR_ATTACHMENT22 = 0x8CF6; + int COLOR_ATTACHMENT23 = 0x8CF7; + int COLOR_ATTACHMENT24 = 0x8CF8; + int COLOR_ATTACHMENT25 = 0x8CF9; + int COLOR_ATTACHMENT26 = 0x8CFA; + int COLOR_ATTACHMENT27 = 0x8CFB; + int COLOR_ATTACHMENT28 = 0x8CFC; + int COLOR_ATTACHMENT29 = 0x8CFD; + int COLOR_ATTACHMENT30 = 0x8CFE; + int COLOR_ATTACHMENT31 = 0x8CFF; + int DEPTH_ATTACHMENT = 0x8D00; + int STENCIL_ATTACHMENT = 0x8D20; + int FRAMEBUFFER = 0x8D40; + int RENDERBUFFER = 0x8D41; + int RENDERBUFFER_WIDTH = 0x8D42; + int RENDERBUFFER_HEIGHT = 0x8D43; + int RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; + int STENCIL_INDEX1 = 0x8D46; + int STENCIL_INDEX4 = 0x8D47; + int STENCIL_INDEX8 = 0x8D48; + int STENCIL_INDEX16 = 0x8D49; + int RENDERBUFFER_RED_SIZE = 0x8D50; + int RENDERBUFFER_GREEN_SIZE = 0x8D51; + int RENDERBUFFER_BLUE_SIZE = 0x8D52; + int RENDERBUFFER_ALPHA_SIZE = 0x8D53; + int RENDERBUFFER_DEPTH_SIZE = 0x8D54; + int RENDERBUFFER_STENCIL_SIZE = 0x8D55; + int FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56; + int MAX_SAMPLES = 0x8D57; + int FRAMEBUFFER_SRGB = 0x8DB9; + int HALF_FLOAT = 0x140B; + int MAP_READ_BIT = 0x0001; + int MAP_WRITE_BIT = 0x0002; + int MAP_INVALIDATE_RANGE_BIT = 0x0004; + int MAP_INVALIDATE_BUFFER_BIT = 0x0008; + int MAP_FLUSH_EXPLICIT_BIT = 0x0010; + int MAP_UNSYNCHRONIZED_BIT = 0x0020; + int COMPRESSED_RED_RGTC1 = 0x8DBB; + int COMPRESSED_SIGNED_RED_RGTC1 = 0x8DBC; + int COMPRESSED_RG_RGTC2 = 0x8DBD; + int COMPRESSED_SIGNED_RG_RGTC2 = 0x8DBE; + int RG = 0x8227; + int RG_INTEGER = 0x8228; + int R8 = 0x8229; + int R16 = 0x822A; + int RG8 = 0x822B; + int RG16 = 0x822C; + int R16F = 0x822D; + int R32F = 0x822E; + int RG16F = 0x822F; + int RG32F = 0x8230; + int R8I = 0x8231; + int R8UI = 0x8232; + int R16I = 0x8233; + int R16UI = 0x8234; + int R32I = 0x8235; + int R32UI = 0x8236; + int RG8I = 0x8237; + int RG8UI = 0x8238; + int RG16I = 0x8239; + int RG16UI = 0x823A; + int RG32I = 0x823B; + int RG32UI = 0x823C; + int VERTEX_ARRAY_BINDING = 0x85B5; + + @Entrypoint("glBeginConditionalRender") + default void beginConditionalRender(int id, int mode) { + throw new ContextException(); + } + + @Entrypoint("glBeginTransformFeedback") + default void beginTransformFeedback(int primitiveMode) { + throw new ContextException(); + } + + @Entrypoint("glBindBufferBase") + default void bindBufferBase(int target, int index, int buffer) { + throw new ContextException(); + } + + @Entrypoint("glBindBufferRange") + default void bindBufferRange(int target, int index, int buffer, long offset, long size) { + throw new ContextException(); + } + + @Entrypoint("glBindFragDataLocation") + default void bindFragDataLocation(int program, int color, MemorySegment name) { + throw new ContextException(); } - public static void beginTransformFeedback(int primitiveMode) { - var caps = getCapabilities(); - try { - check(caps.glBeginTransformFeedback).invokeExact(primitiveMode); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glBindFragDataLocation") + default void bindFragDataLocation(int program, int color, String name) { + throw new ContextException(); } - public static void bindBufferBase(int target, int index, int buffer) { - var caps = getCapabilities(); - try { - check(caps.glBindBufferBase).invokeExact(target, index, buffer); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glBindFramebuffer") + default void bindFramebuffer(int target, int framebuffer) { + throw new ContextException(); } - public static void bindBufferRange(int target, int index, int buffer, long offset, long size) { - var caps = getCapabilities(); - try { - check(caps.glBindBufferRange).invokeExact(target, index, buffer, offset, size); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glBindRenderbuffer") + default void bindRenderbuffer(int target, int renderbuffer) { + throw new ContextException(); } - public static void bindFragDataLocation(int program, int color, MemorySegment name) { - var caps = getCapabilities(); - try { - check(caps.glBindFragDataLocation).invokeExact(program, color, name); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glBindVertexArray") + default void bindVertexArray(int array) { + throw new ContextException(); } - public static void bindFragDataLocation(int program, int color, String name) { - final MemoryStack stack = MemoryStack.stackGet(); - final long stackPointer = stack.getPointer(); - try { - bindFragDataLocation(program, color, stack.allocateFrom(name)); - } finally { - stack.setPointer(stackPointer); - } + @Entrypoint("glBlitFramebuffer") + default void blitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter) { + throw new ContextException(); } - public static void bindFramebuffer(int target, int framebuffer) { - var caps = getCapabilities(); - try { - check(caps.glBindFramebuffer).invokeExact(target, framebuffer); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glCheckFramebufferStatus") + default int checkFramebufferStatus(int target) { + throw new ContextException(); } - public static void bindRenderbuffer(int target, int renderbuffer) { - var caps = getCapabilities(); - try { - check(caps.glBindRenderbuffer).invokeExact(target, renderbuffer); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glClampColor") + default void clampColor(int target, int clamp) { + throw new ContextException(); } - public static void bindVertexArray(int array) { - var caps = getCapabilities(); - try { - check(caps.glBindVertexArray).invokeExact(array); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glClearBufferfi") + default void clearBufferfi(int buffer, int drawBuffer, float depth, int stencil) { + throw new ContextException(); } - public static void blitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter) { - var caps = getCapabilities(); - try { - check(caps.glBlitFramebuffer).invokeExact(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glClearBufferfv") + default void clearBufferfv(int buffer, int drawBuffer, MemorySegment value) { + throw new ContextException(); } - public static int checkFramebufferStatus(int target) { - var caps = getCapabilities(); - try { - return (int) check(caps.glCheckFramebufferStatus).invokeExact(target); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glClearBufferfv") + default void clearBufferfv(SegmentAllocator allocator, int buffer, int drawBuffer, float[] value) { + throw new ContextException(); } - public static void clampColor(int target, int clamp) { - var caps = getCapabilities(); - try { - check(caps.glClampColor).invokeExact(target, clamp); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glClearBufferiv") + default void clearBufferiv(int buffer, int drawBuffer, MemorySegment value) { + throw new ContextException(); } - public static void clearBufferfi(int buffer, int drawBuffer, float depth, int stencil) { - var caps = getCapabilities(); - try { - check(caps.glClearBufferfi).invokeExact(buffer, drawBuffer, depth, stencil); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glClearBufferiv") + default void clearBufferiv(SegmentAllocator allocator, int buffer, int drawBuffer, int[] value) { + throw new ContextException(); } - public static void clearBufferfv(int buffer, int drawBuffer, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glClearBufferfv).invokeExact(buffer, drawBuffer, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glClearBufferuiv") + default void clearBufferuiv(int buffer, int drawBuffer, MemorySegment value) { + throw new ContextException(); } - public static void clearBufferfv(SegmentAllocator allocator, int buffer, int drawBuffer, float[] value) { - clearBufferfv(buffer, drawBuffer, allocator.allocateFrom(JAVA_FLOAT, value)); + @Entrypoint("glClearBufferuiv") + default void clearBufferuiv(SegmentAllocator allocator, int buffer, int drawBuffer, int[] value) { + throw new ContextException(); } - public static void clearBufferiv(int buffer, int drawBuffer, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glClearBufferiv).invokeExact(buffer, drawBuffer, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glColorMaski") + default void colorMaski(int index, boolean r, boolean g, boolean b, boolean a) { + throw new ContextException(); } - public static void clearBufferiv(SegmentAllocator allocator, int buffer, int drawBuffer, int[] value) { - clearBufferiv(buffer, drawBuffer, allocator.allocateFrom(JAVA_INT, value)); + @Entrypoint("glDeleteFramebuffers") + default void deleteFramebuffers(int n, MemorySegment framebuffers) { + throw new ContextException(); } - public static void clearBufferuiv(int buffer, int drawBuffer, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glClearBufferuiv).invokeExact(buffer, drawBuffer, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); + @Skip + default void deleteFramebuffers(int... framebuffers) { + try (MemoryStack stack = MemoryStack.stackPush()) { + deleteFramebuffers(framebuffers.length, Marshal.marshal(stack, framebuffers)); } } - public static void clearBufferuiv(SegmentAllocator allocator, int buffer, int drawBuffer, int[] value) { - clearBufferuiv(buffer, drawBuffer, allocator.allocateFrom(JAVA_INT, value)); + @Entrypoint("glDeleteRenderbuffers") + default void deleteRenderbuffers(int n, MemorySegment renderbuffers) { + throw new ContextException(); } - public static void colorMaski(int index, boolean r, boolean g, boolean b, boolean a) { - var caps = getCapabilities(); - try { - check(caps.glColorMaski).invokeExact(index, r, g, b, a); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); + @Skip + default void deleteRenderbuffers(int... renderbuffers) { + try (MemoryStack stack = MemoryStack.stackPush()) { + deleteRenderbuffers(renderbuffers.length, Marshal.marshal(stack, renderbuffers)); } } - public static void deleteFramebuffers(int n, MemorySegment framebuffers) { - var caps = getCapabilities(); - try { - check(caps.glDeleteFramebuffers).invokeExact(n, framebuffers); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glDeleteVertexArrays") + default void deleteVertexArrays(int n, MemorySegment arrays) { + throw new ContextException(); } - public static void deleteFramebuffers(SegmentAllocator allocator, int[] framebuffers) { - deleteFramebuffers(framebuffers.length, allocator.allocateFrom(JAVA_INT, framebuffers)); - } - - public static void deleteFramebuffer(int framebuffer) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - deleteFramebuffers(1, stack.ints(framebuffer)); - } finally { - stack.setPointer(stackPointer); + @Skip + default void deleteVertexArrays(int... arrays) { + try (MemoryStack stack = MemoryStack.stackPush()) { + deleteVertexArrays(arrays.length, Marshal.marshal(stack, arrays)); } } - public static void deleteRenderbuffers(int n, MemorySegment renderbuffers) { - var caps = getCapabilities(); - try { - check(caps.glDeleteRenderbuffers).invokeExact(n, renderbuffers); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glDisablei") + default void disablei(int target, int index) { + throw new ContextException(); } - public static void deleteRenderbuffers(SegmentAllocator allocator, int[] renderbuffers) { - deleteRenderbuffers(renderbuffers.length, allocator.allocateFrom(JAVA_INT, renderbuffers)); + @Entrypoint("glEnablei") + default void enablei(int target, int index) { + throw new ContextException(); } - public static void deleteRenderbuffer(int renderbuffer) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - deleteRenderbuffers(1, stack.ints(renderbuffer)); - } finally { - stack.setPointer(stackPointer); - } + @Entrypoint("glEndConditionalRender") + default void endConditionalRender() { + throw new ContextException(); } - public static void deleteVertexArrays(int n, MemorySegment arrays) { - var caps = getCapabilities(); - try { - check(caps.glDeleteVertexArrays).invokeExact(n, arrays); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glEndTransformFeedback") + default void endTransformFeedback() { + throw new ContextException(); } - public static void deleteVertexArrays(SegmentAllocator allocator, int[] arrays) { - deleteVertexArrays(arrays.length, allocator.allocateFrom(JAVA_INT, arrays)); + @Entrypoint("glFlushMappedBufferRange") + default void flushMappedBufferRange(int target, long offset, long length) { + throw new ContextException(); } - public static void deleteVertexArray(int array) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - deleteVertexArrays(1, stack.ints(array)); - } finally { - stack.setPointer(stackPointer); - } + @Entrypoint("glFramebufferRenderbuffer") + default void framebufferRenderbuffer(int target, int attachment, int renderbufferTarget, int renderbuffer) { + throw new ContextException(); } - public static void disablei(int target, int index) { - var caps = getCapabilities(); - try { - check(caps.glDisablei).invokeExact(target, index); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glFramebufferTexture1D") + default void framebufferTexture1D(int target, int attachment, int texTarget, int texture, int level) { + throw new ContextException(); } - public static void enablei(int target, int index) { - var caps = getCapabilities(); - try { - check(caps.glEnablei).invokeExact(target, index); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glFramebufferTexture2D") + default void framebufferTexture2D(int target, int attachment, int texTarget, int texture, int level) { + throw new ContextException(); } - public static void endConditionalRender() { - var caps = getCapabilities(); - try { - check(caps.glEndConditionalRender).invokeExact(); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glFramebufferTexture3D") + default void framebufferTexture3D(int target, int attachment, int texTarget, int texture, int level, int zoffset) { + throw new ContextException(); } - public static void endTransformFeedback() { - var caps = getCapabilities(); - try { - check(caps.glEndTransformFeedback).invokeExact(); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } - } - - public static void flushMappedBufferRange(int target, long offset, long length) { - var caps = getCapabilities(); - try { - check(caps.glFlushMappedBufferRange).invokeExact(target, offset, length); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } - } - - public static void framebufferRenderbuffer(int target, int attachment, int renderbufferTarget, int renderbuffer) { - var caps = getCapabilities(); - try { - check(caps.glFramebufferRenderbuffer).invokeExact(target, attachment, renderbufferTarget, renderbuffer); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } - } - - public static void framebufferTexture1D(int target, int attachment, int texTarget, int texture, int level) { - var caps = getCapabilities(); - try { - check(caps.glFramebufferTexture1D).invokeExact(target, attachment, texTarget, texture, level); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glFramebufferTextureLayer") + default void framebufferTextureLayer(int target, int attachment, int texture, int level, int layer) { + throw new ContextException(); } - public static void framebufferTexture2D(int target, int attachment, int texTarget, int texture, int level) { - var caps = getCapabilities(); - try { - check(caps.glFramebufferTexture2D).invokeExact(target, attachment, texTarget, texture, level); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } - } - - public static void framebufferTexture3D(int target, int attachment, int texTarget, int texture, int level, int zoffset) { - var caps = getCapabilities(); - try { - check(caps.glFramebufferTexture3D).invokeExact(target, attachment, texTarget, texture, level, zoffset); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } - } - - public static void framebufferTextureLayer(int target, int attachment, int texture, int level, int layer) { - var caps = getCapabilities(); - try { - check(caps.glFramebufferTextureLayer).invokeExact(target, attachment, texture, level, layer); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } - } - - public static void genFramebuffers(int n, MemorySegment framebuffers) { - var caps = getCapabilities(); - try { - check(caps.glGenFramebuffers).invokeExact(n, framebuffers); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGenFramebuffers") + default void genFramebuffers(int n, MemorySegment framebuffers) { + throw new ContextException(); } - public static void genFramebuffers(SegmentAllocator allocator, int[] framebuffers) { - var seg = allocator.allocateFrom(JAVA_INT, framebuffers); + @Skip + default void genFramebuffers(SegmentAllocator allocator, @Ref int[] framebuffers) { + var seg = Marshal.marshal(allocator, framebuffers); genFramebuffers(framebuffers.length, seg); - RuntimeHelper.toArray(seg, framebuffers); + Unmarshal.copy(seg, framebuffers); } - public static int genFramebuffer() { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocInt(); + @Skip + default int genFramebuffers() { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.ints(0); genFramebuffers(1, seg); return seg.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static void genRenderbuffers(int n, MemorySegment renderbuffers) { - var caps = getCapabilities(); - try { - check(caps.glGenRenderbuffers).invokeExact(n, renderbuffers); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGenRenderbuffers") + default void genRenderbuffers(int n, MemorySegment renderbuffers) { + throw new ContextException(); } - public static void genRenderbuffers(SegmentAllocator allocator, int[] renderbuffers) { - var seg = allocator.allocateFrom(JAVA_INT, renderbuffers); + @Skip + default void genRenderbuffers(SegmentAllocator allocator, @Ref int[] renderbuffers) { + var seg = Marshal.marshal(allocator, renderbuffers); genRenderbuffers(renderbuffers.length, seg); - RuntimeHelper.toArray(seg, renderbuffers); + Unmarshal.copy(seg, renderbuffers); } - public static int genRenderbuffer() { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocInt(); + @Skip + default int genRenderbuffers() { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.ints(0); genRenderbuffers(1, seg); return seg.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static void genVertexArrays(int n, MemorySegment arrays) { - var caps = getCapabilities(); - try { - check(caps.glGenVertexArrays).invokeExact(n, arrays); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGenVertexArrays") + default void genVertexArrays(int n, MemorySegment arrays) { + throw new ContextException(); } - public static void genVertexArrays(SegmentAllocator allocator, int[] arrays) { - var seg = allocator.allocateFrom(JAVA_INT, arrays); + @Skip + default void genVertexArrays(SegmentAllocator allocator, @Ref int[] arrays) { + var seg = Marshal.marshal(allocator, arrays); genVertexArrays(arrays.length, seg); - RuntimeHelper.toArray(seg, arrays); + Unmarshal.copy(seg, arrays); } - public static int genVertexArray() { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocInt(); + @Skip + default int genVertexArrays() { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.ints(0); genVertexArrays(1, seg); return seg.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static void generateMipmap(int target) { - var caps = getCapabilities(); - try { - check(caps.glGenerateMipmap).invokeExact(target); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGenerateMipmap") + default void generateMipmap(int target) { + throw new ContextException(); } - public static void getBooleani_v(int target, int index, MemorySegment data) { - var caps = getCapabilities(); - try { - check(caps.glGetBooleani_v).invokeExact(target, index, data); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetBooleani_v") + default void getBooleani_v(int target, int index, MemorySegment data) { + throw new ContextException(); } - public static void getBooleani_v(SegmentAllocator allocator, int target, int index, boolean[] data) { - var seg = allocator.allocate(JAVA_BOOLEAN, data.length); - getBooleani_v(target, index, seg); - RuntimeHelper.toArray(seg, data); + @Entrypoint("glGetBooleani_v") + default void getBooleani_v(SegmentAllocator allocator, int target, int index, @Ref boolean[] data) { + throw new ContextException(); } - public static boolean getBooleani(int target, int index) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.calloc(JAVA_BOOLEAN); + @Skip + default boolean getBooleani_v(int target, int index) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.allocate(JAVA_BOOLEAN); getBooleani_v(target, index, seg); return seg.get(JAVA_BOOLEAN, 0); - } finally { - stack.setPointer(stackPointer); } } - public static int getFragDataLocation(int program, MemorySegment name) { - var caps = getCapabilities(); - try { - return (int) check(caps.glGetFragDataLocation).invokeExact(program, name); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetFragDataLocation") + default int getFragDataLocation(int program, MemorySegment name) { + throw new ContextException(); } - public static int getFragDataLocation(int program, String name) { - final MemoryStack stack = MemoryStack.stackGet(); - final long stackPointer = stack.getPointer(); - try { - return getFragDataLocation(program, stack.allocateFrom(name)); - } finally { - stack.setPointer(stackPointer); - } + @Entrypoint("glGetFragDataLocation") + default int getFragDataLocation(int program, String name) { + throw new ContextException(); } - public static void getFramebufferAttachmentParameteriv(int target, int attachment, int pname, MemorySegment params) { - var caps = getCapabilities(); - try { - check(caps.glGetFramebufferAttachmentParameteriv).invokeExact(target, attachment, pname, params); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetFramebufferAttachmentParameteriv") + default void getFramebufferAttachmentParameteriv(int target, int attachment, int pname, MemorySegment params) { + throw new ContextException(); } - public static int getFramebufferAttachmentParameteri(int target, int attachment, int pname) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocInt(); + @Skip + default int getFramebufferAttachmentParameteriv(int target, int attachment, int pname) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.ints(0); getFramebufferAttachmentParameteriv(target, attachment, pname, seg); return seg.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static void getIntegeri_v(int target, int index, MemorySegment data) { - var caps = getCapabilities(); - try { - check(caps.glGetIntegeri_v).invokeExact(target, index, data); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetIntegeri_v") + default void getIntegeri_v(int target, int index, MemorySegment data) { + throw new ContextException(); } - public static void getIntegeri_v(SegmentAllocator allocator, int target, int index, int[] data) { - var seg = allocator.allocateFrom(JAVA_INT, data); - getIntegeri_v(target, index, seg); - RuntimeHelper.toArray(seg, data); + @Entrypoint("glGetIntegeri_v") + default void getIntegeri_v(SegmentAllocator allocator, int target, int index, @Ref int[] data) { + throw new ContextException(); } - public static int getIntegeri(int target, int index) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocInt(); + @Skip + default int getIntegeri_v(int target, int index) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.ints(0); getIntegeri_v(target, index, seg); return seg.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static void getRenderbufferParameteriv(int target, int pname, MemorySegment params) { - var caps = getCapabilities(); - try { - check(caps.glGetRenderbufferParameteriv).invokeExact(target, pname, params); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetRenderbufferParameteriv") + default void getRenderbufferParameteriv(int target, int pname, MemorySegment params) { + throw new ContextException(); } - public static void getRenderbufferParameteriv(int target, int pname, int[] params) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocInt(); - getRenderbufferParameteriv(target, pname, seg); - params[0] = seg.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); - } + @Entrypoint("glGetRenderbufferParameteriv") + default void getRenderbufferParameteriv(int target, int pname, @Ref int[] params) { + throw new ContextException(); } - public static int getRenderbufferParameteri(int target, int pname) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocInt(); + @Skip + default int getRenderbufferParameteriv(int target, int pname) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.ints(0); getRenderbufferParameteriv(target, pname, seg); return seg.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static MemorySegment ngetStringi(int pname, int index) { - var caps = getCapabilities(); - try { - return (MemorySegment) check(caps.glGetStringi).invokeExact(pname, index); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetStringi") + default MemorySegment ngetStringi(int pname, int index) { + throw new ContextException(); } + @Entrypoint("glGetStringi") @Nullable - public static String getStringi(int pname, int index) { - var pStr = ngetStringi(pname, index); - return RuntimeHelper.isNullptr(pStr) ? null : pStr.getString(0); + @SizedSeg(Unmarshal.STR_SIZE) + default String getStringi(int pname, int index) { + throw new ContextException(); } - public static void getTexParameterIiv(int target, int pname, MemorySegment params) { - var caps = getCapabilities(); - try { - check(caps.glGetTexParameterIiv).invokeExact(target, pname, params); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetTexParameterIiv") + default void getTexParameterIiv(int target, int pname, MemorySegment params) { + throw new ContextException(); } - public static void getTexParameterIiv(SegmentAllocator allocator, int target, int pname, int[] params) { - var seg = allocator.allocateFrom(JAVA_INT, params); - getTexParameterIiv(target, pname, seg); - RuntimeHelper.toArray(seg, params); + @Entrypoint("glGetTexParameterIiv") + default void getTexParameterIiv(SegmentAllocator allocator, int target, int pname, @Ref int[] params) { + throw new ContextException(); } - public static int getTexParameterIi(int target, int pname) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocInt(); + @Skip + default int getTexParameterIiv(int target, int pname) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.ints(0); getTexParameterIiv(target, pname, seg); return seg.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static void getTexParameterIuiv(int target, int pname, MemorySegment params) { - var caps = getCapabilities(); - try { - check(caps.glGetTexParameterIuiv).invokeExact(target, pname, params); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetTexParameterIuiv") + default void getTexParameterIuiv(int target, int pname, MemorySegment params) { + throw new ContextException(); } - public static void getTexParameterIuiv(SegmentAllocator allocator, int target, int pname, int[] params) { - var seg = allocator.allocateFrom(JAVA_INT, params); - getTexParameterIuiv(target, pname, seg); - RuntimeHelper.toArray(seg, params); + @Entrypoint("glGetTexParameterIuiv") + default void getTexParameterIuiv(SegmentAllocator allocator, int target, int pname, @Ref int[] params) { + throw new ContextException(); } - public static int getTexParameterIui(int target, int pname) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocInt(); + @Skip + default int getTexParameterIuiv(int target, int pname) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.ints(0); getTexParameterIuiv(target, pname, seg); return seg.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static void getTransformFeedbackVarying(int program, int index, int bufSize, MemorySegment length, MemorySegment size, MemorySegment type, MemorySegment name) { - var caps = getCapabilities(); - try { - check(caps.glGetTransformFeedbackVarying).invokeExact(program, index, bufSize, length, size, type, name); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetTransformFeedbackVarying") + default void getTransformFeedbackVarying(int program, int index, int bufSize, MemorySegment length, MemorySegment size, MemorySegment type, MemorySegment name) { + throw new ContextException(); } - public static void getTransformFeedbackVarying(SegmentAllocator allocator, int program, int index, int bufSize, int @Nullable [] length, int[] size, int[] type, String[] name) { - var pLen = length != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL; - var pSz = allocator.allocate(JAVA_INT); - var pType = allocator.allocate(JAVA_INT); + @Skip + default void getTransformFeedbackVarying(SegmentAllocator allocator, int program, int index, int bufSize, @Ref int @Nullable [] length, @Ref int[] size, @Ref int[] type, @Ref String[] name) { + var pLen = Marshal.marshal(allocator, length); + var pSz = Marshal.marshal(allocator, size); + var pType = Marshal.marshal(allocator, type); var pName = allocator.allocate(JAVA_BYTE, bufSize); getTransformFeedbackVarying(program, index, bufSize, pLen, pSz, pType, pName); - if (length != null && length.length > 0) { - length[0] = pLen.get(JAVA_INT, 0); - } - size[0] = pSz.get(JAVA_INT, 0); - type[0] = pType.get(JAVA_INT, 0); + Unmarshal.copy(pLen, length); + Unmarshal.copy(pSz, size); + Unmarshal.copy(pType, type); name[0] = pName.getString(0); } - public static void getUniformuiv(int program, int location, MemorySegment params) { - var caps = getCapabilities(); - try { - check(caps.glGetUniformuiv).invokeExact(program, location, params); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetUniformuiv") + default void getUniformuiv(int program, int location, MemorySegment params) { + throw new ContextException(); } - public static void getUniformuiv(SegmentAllocator allocator, int program, int location, int[] params) { - var seg = allocator.allocateFrom(JAVA_INT, params); - getUniformuiv(program, location, seg); - RuntimeHelper.toArray(seg, params); + @Entrypoint("glGetUniformuiv") + default void getUniformuiv(SegmentAllocator allocator, int program, int location, @Ref int[] params) { + throw new ContextException(); } - public static int getUniformui(int program, int location) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocInt(); + @Skip + default int getUniformuiv(int program, int location) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.ints(0); getUniformuiv(program, location, seg); return seg.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static void getVertexAttribIiv(int index, int pname, MemorySegment params) { - var caps = getCapabilities(); - try { - check(caps.glGetVertexAttribIiv).invokeExact(index, pname, params); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetVertexAttribIiv") + default void getVertexAttribIiv(int index, int pname, MemorySegment params) { + throw new ContextException(); } - public static void getVertexAttribIiv(SegmentAllocator allocator, int index, int pname, int[] params) { - var seg = allocator.allocateFrom(JAVA_INT, params); - getVertexAttribIiv(index, pname, seg); - RuntimeHelper.toArray(seg, params); + @Entrypoint("glGetVertexAttribIiv") + default void getVertexAttribIiv(SegmentAllocator allocator, int index, int pname, @Ref int[] params) { + throw new ContextException(); } - public static int getVertexAttribIi(int index, int pname) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocInt(); + @Skip + default int getVertexAttribIiv(int index, int pname) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.ints(0); getVertexAttribIiv(index, pname, seg); return seg.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static void getVertexAttribIuiv(int index, int pname, MemorySegment params) { - var caps = getCapabilities(); - try { - check(caps.glGetVertexAttribIuiv).invokeExact(index, pname, params); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetVertexAttribIuiv") + default void getVertexAttribIuiv(int index, int pname, MemorySegment params) { + throw new ContextException(); } - public static void getVertexAttribIuiv(SegmentAllocator allocator, int index, int pname, int[] params) { - var seg = allocator.allocateFrom(JAVA_INT, params); - getVertexAttribIuiv(index, pname, seg); - RuntimeHelper.toArray(seg, params); + @Entrypoint("glGetVertexAttribIuiv") + default void getVertexAttribIuiv(SegmentAllocator allocator, int index, int pname, @Ref int[] params) { + throw new ContextException(); } - public static int getVertexAttribIui(int index, int pname) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocInt(); + @Skip + default int getVertexAttribIuiv(int index, int pname) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.ints(0); getVertexAttribIuiv(index, pname, seg); return seg.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static boolean isEnabledi(int target, int index) { - var caps = getCapabilities(); - try { - return (boolean) check(caps.glIsEnabledi).invokeExact(target, index); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glIsEnabledi") + default boolean isEnabledi(int target, int index) { + throw new ContextException(); } - public static boolean isFramebuffer(int framebuffer) { - var caps = getCapabilities(); - try { - return (boolean) check(caps.glIsFramebuffer).invokeExact(framebuffer); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glIsFramebuffer") + default boolean isFramebuffer(int framebuffer) { + throw new ContextException(); } - public static boolean isRenderbuffer(int renderbuffer) { - var caps = getCapabilities(); - try { - return (boolean) check(caps.glIsRenderbuffer).invokeExact(renderbuffer); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glIsRenderbuffer") + default boolean isRenderbuffer(int renderbuffer) { + throw new ContextException(); } - public static boolean isVertexArray(int array) { - var caps = getCapabilities(); - try { - return (boolean) check(caps.glIsVertexArray).invokeExact(array); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glIsVertexArray") + default boolean isVertexArray(int array) { + throw new ContextException(); } - public static MemorySegment mapBufferRange(int target, long offset, long length, int access) { - var caps = getCapabilities(); - try { - return ((MemorySegment) check(caps.glMapBufferRange).invokeExact(target, offset, length, access)).reinterpret(length); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + default MethodHandle glMapBufferRange() { + throw new ContextException(); } - public static void renderbufferStorage(int target, int internalFormat, int width, int height) { - var caps = getCapabilities(); + @Skip + default MemorySegment mapBufferRange(int target, long offset, long length, int access) { try { - check(caps.glRenderbufferStorage).invokeExact(target, internalFormat, width, height); + return ((MemorySegment) glMapBufferRange().invokeExact(target, offset, length, access)).reinterpret(length); } catch (Throwable e) { - throw new AssertionError("should not reach here", e); + throw new RuntimeException(e); } } - public static void renderbufferStorageMultisample(int target, int samples, int internalFormat, int width, int height) { - var caps = getCapabilities(); - try { - check(caps.glRenderbufferStorageMultisample).invokeExact(target, samples, internalFormat, width, height); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glRenderbufferStorage") + default void renderbufferStorage(int target, int internalFormat, int width, int height) { + throw new ContextException(); } - public static void texParameterIiv(int target, int pname, MemorySegment params) { - var caps = getCapabilities(); - try { - check(caps.glTexParameterIiv).invokeExact(target, pname, params); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glRenderbufferStorageMultisample") + default void renderbufferStorageMultisample(int target, int samples, int internalFormat, int width, int height) { + throw new ContextException(); } - public static void texParameterIiv(SegmentAllocator allocator, int target, int pname, int[] params) { - texParameterIiv(target, pname, allocator.allocateFrom(JAVA_INT, params)); + @Entrypoint("glTexParameterIiv") + default void texParameterIiv(int target, int pname, MemorySegment params) { + throw new ContextException(); } - public static void texParameterIuiv(int target, int pname, MemorySegment params) { - var caps = getCapabilities(); - try { - check(caps.glTexParameterIuiv).invokeExact(target, pname, params); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glTexParameterIiv") + default void texParameterIiv(SegmentAllocator allocator, int target, int pname, int[] params) { + throw new ContextException(); } - public static void texParameterIuiv(SegmentAllocator allocator, int target, int pname, int[] params) { - texParameterIuiv(target, pname, allocator.allocateFrom(JAVA_INT, params)); + @Entrypoint("glTexParameterIuiv") + default void texParameterIuiv(int target, int pname, MemorySegment params) { + throw new ContextException(); } - public static void transformFeedbackVaryings(int program, int count, MemorySegment varyings, int bufferMode) { - var caps = getCapabilities(); - try { - check(caps.glTransformFeedbackVaryings).invokeExact(program, count, varyings, bufferMode); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glTexParameterIuiv") + default void texParameterIuiv(SegmentAllocator allocator, int target, int pname, int[] params) { + throw new ContextException(); } - public static void transformFeedbackVaryings(SegmentAllocator allocator, int program, String[] varyings, int bufferMode) { - var seg = allocator.allocate(ADDRESS, varyings.length); - for (int i = 0; i < varyings.length; i++) { - seg.setAtIndex(ADDRESS, i, allocator.allocateFrom(varyings[i])); - } - transformFeedbackVaryings(program, varyings.length, seg, bufferMode); + @Entrypoint("glTransformFeedbackVaryings") + default void transformFeedbackVaryings(int program, int count, MemorySegment varyings, int bufferMode) { + throw new ContextException(); } - public static void uniform1ui(int location, int v0) { - var caps = getCapabilities(); - try { - check(caps.glUniform1ui).invokeExact(location, v0); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Skip + default void transformFeedbackVaryings(SegmentAllocator allocator, int program, String[] varyings, int bufferMode) { + transformFeedbackVaryings(program, varyings.length, Marshal.marshal(allocator, varyings), bufferMode); } - public static void uniform1uiv(int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glUniform1uiv).invokeExact(location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform1ui") + default void uniform1ui(int location, int v0) { + throw new ContextException(); } - public static void uniform1uiv(SegmentAllocator allocator, int location, int[] value) { - uniform1uiv(location, value.length, allocator.allocateFrom(JAVA_INT, value)); + @Entrypoint("glUniform1uiv") + default void uniform1uiv(int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void uniform2ui(int location, int v0, int v1) { - var caps = getCapabilities(); - try { - check(caps.glUniform2ui).invokeExact(location, v0, v1); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Skip + default void uniform1uiv(SegmentAllocator allocator, int location, int[] value) { + uniform1uiv(location, value.length, Marshal.marshal(allocator, value)); } - public static void uniform2uiv(int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glUniform2uiv).invokeExact(location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform2ui") + default void uniform2ui(int location, int v0, int v1) { + throw new ContextException(); } - public static void uniform2uiv(SegmentAllocator allocator, int location, int[] value) { - uniform2uiv(location, value.length >> 1, allocator.allocateFrom(JAVA_INT, value)); + @Entrypoint("glUniform2uiv") + default void uniform2uiv(int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void uniform3ui(int location, int v0, int v1, int v2) { - var caps = getCapabilities(); - try { - check(caps.glUniform3ui).invokeExact(location, v0, v1, v2); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Skip + default void uniform2uiv(SegmentAllocator allocator, int location, int[] value) { + uniform2uiv(location, value.length >> 1, Marshal.marshal(allocator, value)); } - public static void uniform3uiv(int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glUniform3uiv).invokeExact(location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform3ui") + default void uniform3ui(int location, int v0, int v1, int v2) { + throw new ContextException(); } - public static void uniform3uiv(SegmentAllocator allocator, int location, int[] value) { - uniform3uiv(location, value.length / 3, allocator.allocateFrom(JAVA_INT, value)); + @Entrypoint("glUniform3uiv") + default void uniform3uiv(int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void uniform4ui(int location, int v0, int v1, int v2, int v3) { - var caps = getCapabilities(); - try { - check(caps.glUniform4ui).invokeExact(location, v0, v1, v2, v3); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Skip + default void uniform3uiv(SegmentAllocator allocator, int location, int[] value) { + uniform3uiv(location, value.length / 3, Marshal.marshal(allocator, value)); } - public static void uniform4uiv(int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glUniform4uiv).invokeExact(location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUniform4ui") + default void uniform4ui(int location, int v0, int v1, int v2, int v3) { + throw new ContextException(); } - public static void uniform4uiv(SegmentAllocator allocator, int location, int[] value) { - uniform4uiv(location, value.length >> 2, allocator.allocateFrom(JAVA_INT, value)); + @Entrypoint("glUniform4uiv") + default void uniform4uiv(int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void vertexAttribI1i(int index, int x) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI1i).invokeExact(index, x); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Skip + default void uniform4uiv(SegmentAllocator allocator, int location, int[] value) { + uniform4uiv(location, value.length >> 2, Marshal.marshal(allocator, value)); } - public static void vertexAttribI1iv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI1iv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI1i") + default void vertexAttribI1i(int index, int x) { + throw new ContextException(); } - public static void vertexAttribI1iv(SegmentAllocator allocator, int index, int[] v) { - vertexAttribI1iv(index, allocator.allocateFrom(JAVA_INT, v)); + @Entrypoint("glVertexAttribI1iv") + default void vertexAttribI1iv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttribI1ui(int index, int x) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI1ui).invokeExact(index, x); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI1iv") + default void vertexAttribI1iv(SegmentAllocator allocator, int index, int[] v) { + throw new ContextException(); } - public static void vertexAttribI1uiv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI1uiv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI1ui") + default void vertexAttribI1ui(int index, int x) { + throw new ContextException(); } - public static void vertexAttribI1uiv(SegmentAllocator allocator, int index, int[] v) { - vertexAttribI1uiv(index, allocator.allocateFrom(JAVA_INT, v)); + @Entrypoint("glVertexAttribI1uiv") + default void vertexAttribI1uiv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttribI2i(int index, int x, int y) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI2i).invokeExact(index, x, y); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI1uiv") + default void vertexAttribI1uiv(SegmentAllocator allocator, int index, int[] v) { + throw new ContextException(); } - public static void vertexAttribI2iv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI2iv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI2i") + default void vertexAttribI2i(int index, int x, int y) { + throw new ContextException(); } - public static void vertexAttribI2iv(SegmentAllocator allocator, int index, int[] v) { - vertexAttribI2iv(index, allocator.allocateFrom(JAVA_INT, v)); + @Entrypoint("glVertexAttribI2iv") + default void vertexAttribI2iv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttribI2ui(int index, int x, int y) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI2ui).invokeExact(index, x, y); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI2iv") + default void vertexAttribI2iv(SegmentAllocator allocator, int index, int[] v) { + throw new ContextException(); } - public static void vertexAttribI2uiv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI2uiv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI2ui") + default void vertexAttribI2ui(int index, int x, int y) { + throw new ContextException(); } - public static void vertexAttribI2uiv(SegmentAllocator allocator, int index, int[] v) { - vertexAttribI2uiv(index, allocator.allocateFrom(JAVA_INT, v)); + @Entrypoint("glVertexAttribI2uiv") + default void vertexAttribI2uiv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttribI3i(int index, int x, int y, int z) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI3i).invokeExact(index, x, y, z); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI2uiv") + default void vertexAttribI2uiv(SegmentAllocator allocator, int index, int[] v) { + throw new ContextException(); } - public static void vertexAttribI3iv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI3iv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI3i") + default void vertexAttribI3i(int index, int x, int y, int z) { + throw new ContextException(); } - public static void vertexAttribI3iv(SegmentAllocator allocator, int index, int[] v) { - vertexAttribI3iv(index, allocator.allocateFrom(JAVA_INT, v)); + @Entrypoint("glVertexAttribI3iv") + default void vertexAttribI3iv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttribI3ui(int index, int x, int y, int z) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI3ui).invokeExact(index, x, y, z); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI3iv") + default void vertexAttribI3iv(SegmentAllocator allocator, int index, int[] v) { + throw new ContextException(); } - public static void vertexAttribI3uiv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI3uiv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI3ui") + default void vertexAttribI3ui(int index, int x, int y, int z) { + throw new ContextException(); } - public static void vertexAttribI3uiv(SegmentAllocator allocator, int index, int[] v) { - vertexAttribI3uiv(index, allocator.allocateFrom(JAVA_INT, v)); + @Entrypoint("glVertexAttribI3uiv") + default void vertexAttribI3uiv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttribI4bv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI4bv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI3uiv") + default void vertexAttribI3uiv(SegmentAllocator allocator, int index, int[] v) { + throw new ContextException(); } - public static void vertexAttribI4bv(SegmentAllocator allocator, int index, byte[] v) { - vertexAttribI4bv(index, allocator.allocateFrom(JAVA_BYTE, v)); + @Entrypoint("glVertexAttribI4bv") + default void vertexAttribI4bv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttribI4i(int index, int x, int y, int z, int w) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI4i).invokeExact(index, x, y, z, w); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI4bv") + default void vertexAttribI4bv(SegmentAllocator allocator, int index, byte[] v) { + throw new ContextException(); } - public static void vertexAttribI4iv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI4iv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI4i") + default void vertexAttribI4i(int index, int x, int y, int z, int w) { + throw new ContextException(); } - public static void vertexAttribI4iv(SegmentAllocator allocator, int index, int[] v) { - vertexAttribI4iv(index, allocator.allocateFrom(JAVA_INT, v)); + @Entrypoint("glVertexAttribI4iv") + default void vertexAttribI4iv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttribI4sv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI4sv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI4iv") + default void vertexAttribI4iv(SegmentAllocator allocator, int index, int[] v) { + throw new ContextException(); } - public static void vertexAttribI4sv(SegmentAllocator allocator, int index, short[] v) { - vertexAttribI4sv(index, allocator.allocateFrom(JAVA_SHORT, v)); + @Entrypoint("glVertexAttribI4sv") + default void vertexAttribI4sv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttribI4ubv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI4ubv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI4sv") + default void vertexAttribI4sv(SegmentAllocator allocator, int index, short[] v) { + throw new ContextException(); } - public static void vertexAttribI4ubv(SegmentAllocator allocator, int index, byte[] v) { - vertexAttribI4ubv(index, allocator.allocateFrom(JAVA_BYTE, v)); + @Entrypoint("glVertexAttribI4ubv") + default void vertexAttribI4ubv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttribI4ui(int index, int x, int y, int z, int w) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI4ui).invokeExact(index, x, y, z, w); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI4ubv") + default void vertexAttribI4ubv(SegmentAllocator allocator, int index, byte[] v) { + throw new ContextException(); } - public static void vertexAttribI4uiv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI4uiv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI4ui") + default void vertexAttribI4ui(int index, int x, int y, int z, int w) { + throw new ContextException(); } - public static void vertexAttribI4uiv(SegmentAllocator allocator, int index, int[] v) { - vertexAttribI4uiv(index, allocator.allocateFrom(JAVA_INT, v)); + @Entrypoint("glVertexAttribI4uiv") + default void vertexAttribI4uiv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttribI4usv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribI4usv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI4uiv") + default void vertexAttribI4uiv(SegmentAllocator allocator, int index, int[] v) { + throw new ContextException(); } - public static void vertexAttribI4usv(SegmentAllocator allocator, int index, short[] v) { - vertexAttribI4usv(index, allocator.allocateFrom(JAVA_SHORT, v)); + @Entrypoint("glVertexAttribI4usv") + default void vertexAttribI4usv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttribIPointer(int index, int size, int type, int stride, MemorySegment pointer) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribIPointer).invokeExact(index, size, type, stride, pointer); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribI4usv") + default void vertexAttribI4usv(SegmentAllocator allocator, int index, short[] v) { + throw new ContextException(); + } + + @Entrypoint("glVertexAttribIPointer") + default void vertexAttribIPointer(int index, int size, int type, int stride, MemorySegment pointer) { + throw new ContextException(); } - public static void vertexAttribIPointer(SegmentAllocator allocator, int index, int size, int type, int stride, byte[] pointer) { - vertexAttribIPointer(index, size, type, stride, allocator.allocateFrom(JAVA_BYTE, pointer)); + @Entrypoint("glVertexAttribIPointer") + default void vertexAttribIPointer(SegmentAllocator allocator, int index, int size, int type, int stride, byte[] pointer) { + throw new ContextException(); } - public static void vertexAttribIPointer(SegmentAllocator allocator, int index, int size, int type, int stride, short[] pointer) { - vertexAttribIPointer(index, size, type, stride, allocator.allocateFrom(JAVA_SHORT, pointer)); + @Entrypoint("glVertexAttribIPointer") + default void vertexAttribIPointer(SegmentAllocator allocator, int index, int size, int type, int stride, short[] pointer) { + throw new ContextException(); } - public static void vertexAttribIPointer(SegmentAllocator allocator, int index, int size, int type, int stride, int[] pointer) { - vertexAttribIPointer(index, size, type, stride, allocator.allocateFrom(JAVA_INT, pointer)); + @Entrypoint("glVertexAttribIPointer") + default void vertexAttribIPointer(SegmentAllocator allocator, int index, int size, int type, int stride, int[] pointer) { + throw new ContextException(); } } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL41C.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL41C.java index 587bc168..8a1b8e06 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL41C.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GL41C.java @@ -17,16 +17,18 @@ package overrungl.opengl; import org.jetbrains.annotations.Nullable; +import overrun.marshal.Marshal; import overrun.marshal.MemoryStack; -import overrungl.internal.RuntimeHelper; +import overrun.marshal.Unmarshal; +import overrun.marshal.gen.Entrypoint; +import overrun.marshal.gen.Ref; +import overrun.marshal.gen.Skip; import overrungl.opengl.ext.arb.GLARBViewportArray; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; import static java.lang.foreign.ValueLayout.*; -import static overrungl.FunctionDescriptors.*; -import static overrungl.opengl.GLLoader.*; /** * The OpenGL 4.1 core profile functions. @@ -44,1349 +46,913 @@ * @since 0.1.0 */ public sealed interface GL41C extends GL40C permits GL42C { - public static final int FIXED = 0x140C; - public static final int IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A; - public static final int IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; - public static final int LOW_FLOAT = 0x8DF0; - public static final int MEDIUM_FLOAT = 0x8DF1; - public static final int HIGH_FLOAT = 0x8DF2; - public static final int LOW_INT = 0x8DF3; - public static final int MEDIUM_INT = 0x8DF4; - public static final int HIGH_INT = 0x8DF5; - public static final int SHADER_COMPILER = 0x8DFA; - public static final int SHADER_BINARY_FORMATS = 0x8DF8; - public static final int NUM_SHADER_BINARY_FORMATS = 0x8DF9; - public static final int MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB; - public static final int MAX_VARYING_VECTORS = 0x8DFC; - public static final int MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD; - public static final int RGB565 = 0x8D62; - public static final int PROGRAM_BINARY_RETRIEVABLE_HINT = 0x8257; - public static final int PROGRAM_BINARY_LENGTH = 0x8741; - public static final int NUM_PROGRAM_BINARY_FORMATS = 0x87FE; - public static final int PROGRAM_BINARY_FORMATS = 0x87FF; - public static final int VERTEX_SHADER_BIT = 0x00000001; - public static final int FRAGMENT_SHADER_BIT = 0x00000002; - public static final int GEOMETRY_SHADER_BIT = 0x00000004; - public static final int TESS_CONTROL_SHADER_BIT = 0x00000008; - public static final int TESS_EVALUATION_SHADER_BIT = 0x00000010; - public static final int ALL_SHADER_BITS = 0xFFFFFFFF; - public static final int PROGRAM_SEPARABLE = 0x8258; - public static final int ACTIVE_PROGRAM = 0x8259; - public static final int PROGRAM_PIPELINE_BINDING = 0x825A; - public static final int MAX_VIEWPORTS = 0x825B; - public static final int VIEWPORT_SUBPIXEL_BITS = 0x825C; - public static final int VIEWPORT_BOUNDS_RANGE = 0x825D; - public static final int LAYER_PROVOKING_VERTEX = 0x825E; - public static final int VIEWPORT_INDEX_PROVOKING_VERTEX = 0x825F; - public static final int UNDEFINED_VERTEX = 0x8260; - - static boolean isSupported(GLCapabilities caps) { - return checkAll(caps.glActiveShaderProgram, caps.glBindProgramPipeline, caps.glClearDepthf, caps.glCreateShaderProgramv, caps.glDeleteProgramPipelines, caps.glDepthRangeArrayv, - caps.glDepthRangeIndexed, caps.glDepthRangef, caps.glGenProgramPipelines, caps.glGetDoublei_v, caps.glGetFloati_v, caps.glGetProgramBinary, - caps.glGetProgramPipelineInfoLog, caps.glGetProgramPipelineiv, caps.glGetShaderPrecisionFormat, caps.glGetVertexAttribLdv, caps.glIsProgramPipeline, caps.glProgramBinary, - caps.glProgramParameteri, caps.glProgramUniform1d, caps.glProgramUniform1dv, caps.glProgramUniform1f, caps.glProgramUniform1fv, caps.glProgramUniform1i, - caps.glProgramUniform1iv, caps.glProgramUniform1ui, caps.glProgramUniform1uiv, caps.glProgramUniform2d, caps.glProgramUniform2dv, caps.glProgramUniform2f, - caps.glProgramUniform2fv, caps.glProgramUniform2i, caps.glProgramUniform2iv, caps.glProgramUniform2ui, caps.glProgramUniform2uiv, caps.glProgramUniform3d, - caps.glProgramUniform3dv, caps.glProgramUniform3f, caps.glProgramUniform3fv, caps.glProgramUniform3i, caps.glProgramUniform3iv, caps.glProgramUniform3ui, - caps.glProgramUniform3uiv, caps.glProgramUniform4d, caps.glProgramUniform4dv, caps.glProgramUniform4f, caps.glProgramUniform4fv, caps.glProgramUniform4i, - caps.glProgramUniform4iv, caps.glProgramUniform4ui, caps.glProgramUniform4uiv, caps.glProgramUniformMatrix2dv, caps.glProgramUniformMatrix2fv, caps.glProgramUniformMatrix2x3dv, - caps.glProgramUniformMatrix2x3fv, caps.glProgramUniformMatrix2x4dv, caps.glProgramUniformMatrix2x4fv, caps.glProgramUniformMatrix3dv, caps.glProgramUniformMatrix3fv, caps.glProgramUniformMatrix3x2dv, - caps.glProgramUniformMatrix3x2fv, caps.glProgramUniformMatrix3x4dv, caps.glProgramUniformMatrix3x4fv, caps.glProgramUniformMatrix4dv, caps.glProgramUniformMatrix4fv, caps.glProgramUniformMatrix4x2dv, - caps.glProgramUniformMatrix4x2fv, caps.glProgramUniformMatrix4x3dv, caps.glProgramUniformMatrix4x3fv, caps.glReleaseShaderCompiler, caps.glScissorArrayv, caps.glScissorIndexed, - caps.glScissorIndexedv, caps.glShaderBinary, caps.glUseProgramStages, caps.glValidateProgramPipeline, caps.glVertexAttribL1d, caps.glVertexAttribL1dv, - caps.glVertexAttribL2d, caps.glVertexAttribL2dv, caps.glVertexAttribL3d, caps.glVertexAttribL3dv, caps.glVertexAttribL4d, caps.glVertexAttribL4dv, - caps.glVertexAttribLPointer, caps.glViewportArrayv, caps.glViewportIndexedf, caps.glViewportIndexedfv); - } - - static void load(GLCapabilities caps, GLLoadFunc load) { - caps.glActiveShaderProgram = load.invoke("glActiveShaderProgram", IIV); - caps.glBindProgramPipeline = load.invoke("glBindProgramPipeline", IV); - caps.glClearDepthf = load.invoke("glClearDepthf", FV); - caps.glCreateShaderProgramv = load.invoke("glCreateShaderProgramv", IIPI); - caps.glDeleteProgramPipelines = load.invoke("glDeleteProgramPipelines", IPV); - caps.glDepthRangeArrayv = load.invoke("glDepthRangeArrayv", IIPV); - caps.glDepthRangeIndexed = load.invoke("glDepthRangeIndexed", IDDV); - caps.glDepthRangef = load.invoke("glDepthRangef", FFV); - caps.glGenProgramPipelines = load.invoke("glGenProgramPipelines", IPV); - caps.glGetDoublei_v = load.invoke("glGetDoublei_v", IIPV); - caps.glGetFloati_v = load.invoke("glGetFloati_v", IIPV); - caps.glGetProgramBinary = load.invoke("glGetProgramBinary", IIPPPV); - caps.glGetProgramPipelineInfoLog = load.invoke("glGetProgramPipelineInfoLog", IIPPV); - caps.glGetProgramPipelineiv = load.invoke("glGetProgramPipelineiv", IIPV); - caps.glGetShaderPrecisionFormat = load.invoke("glGetShaderPrecisionFormat", IIPPV); - caps.glGetVertexAttribLdv = load.invoke("glGetVertexAttribLdv", IIPV); - caps.glIsProgramPipeline = load.invoke("glIsProgramPipeline", IZ); - caps.glProgramBinary = load.invoke("glProgramBinary", IIPIV); - caps.glProgramParameteri = load.invoke("glProgramParameteri", IIIV); - caps.glProgramUniform1d = load.invoke("glProgramUniform1d", IIDV); - caps.glProgramUniform1dv = load.invoke("glProgramUniform1dv", IIIPV); - caps.glProgramUniform1f = load.invoke("glProgramUniform1f", IIFV); - caps.glProgramUniform1fv = load.invoke("glProgramUniform1fv", IIIPV); - caps.glProgramUniform1i = load.invoke("glProgramUniform1i", IIIV); - caps.glProgramUniform1iv = load.invoke("glProgramUniform1iv", IIIPV); - caps.glProgramUniform1ui = load.invoke("glProgramUniform1ui", IIIV); - caps.glProgramUniform1uiv = load.invoke("glProgramUniform1uiv", IIIPV); - caps.glProgramUniform2d = load.invoke("glProgramUniform2d", IIDDV); - caps.glProgramUniform2dv = load.invoke("glProgramUniform2dv", IIIPV); - caps.glProgramUniform2f = load.invoke("glProgramUniform2f", IIFFV); - caps.glProgramUniform2fv = load.invoke("glProgramUniform2fv", IIIPV); - caps.glProgramUniform2i = load.invoke("glProgramUniform2i", IIIIV); - caps.glProgramUniform2iv = load.invoke("glProgramUniform2iv", IIIPV); - caps.glProgramUniform2ui = load.invoke("glProgramUniform2ui", IIIIV); - caps.glProgramUniform2uiv = load.invoke("glProgramUniform2uiv", IIIPV); - caps.glProgramUniform3d = load.invoke("glProgramUniform3d", IIDDDV); - caps.glProgramUniform3dv = load.invoke("glProgramUniform3dv", IIIPV); - caps.glProgramUniform3f = load.invoke("glProgramUniform3f", IIFFFV); - caps.glProgramUniform3fv = load.invoke("glProgramUniform3fv", IIIPV); - caps.glProgramUniform3i = load.invoke("glProgramUniform3i", IIIIIV); - caps.glProgramUniform3iv = load.invoke("glProgramUniform3iv", IIIPV); - caps.glProgramUniform3ui = load.invoke("glProgramUniform3ui", IIIIIV); - caps.glProgramUniform3uiv = load.invoke("glProgramUniform3uiv", IIIPV); - caps.glProgramUniform4d = load.invoke("glProgramUniform4d", IIDDDDV); - caps.glProgramUniform4dv = load.invoke("glProgramUniform4dv", IIIPV); - caps.glProgramUniform4f = load.invoke("glProgramUniform4f", IIFFFFV); - caps.glProgramUniform4fv = load.invoke("glProgramUniform4fv", IIIPV); - caps.glProgramUniform4i = load.invoke("glProgramUniform4i", IIIIIIV); - caps.glProgramUniform4iv = load.invoke("glProgramUniform4iv", IIIPV); - caps.glProgramUniform4ui = load.invoke("glProgramUniform4ui", IIIIIIV); - caps.glProgramUniform4uiv = load.invoke("glProgramUniform4uiv", IIIPV); - caps.glProgramUniformMatrix2dv = load.invoke("glProgramUniformMatrix2dv", IIIZPV); - caps.glProgramUniformMatrix2fv = load.invoke("glProgramUniformMatrix2fv", IIIZPV); - caps.glProgramUniformMatrix2x3dv = load.invoke("glProgramUniformMatrix2x3dv", IIIZPV); - caps.glProgramUniformMatrix2x3fv = load.invoke("glProgramUniformMatrix2x3fv", IIIZPV); - caps.glProgramUniformMatrix2x4dv = load.invoke("glProgramUniformMatrix2x4dv", IIIZPV); - caps.glProgramUniformMatrix2x4fv = load.invoke("glProgramUniformMatrix2x4fv", IIIZPV); - caps.glProgramUniformMatrix3dv = load.invoke("glProgramUniformMatrix3dv", IIIZPV); - caps.glProgramUniformMatrix3fv = load.invoke("glProgramUniformMatrix3fv", IIIZPV); - caps.glProgramUniformMatrix3x2dv = load.invoke("glProgramUniformMatrix3x2dv", IIIZPV); - caps.glProgramUniformMatrix3x2fv = load.invoke("glProgramUniformMatrix3x2fv", IIIZPV); - caps.glProgramUniformMatrix3x4dv = load.invoke("glProgramUniformMatrix3x4dv", IIIZPV); - caps.glProgramUniformMatrix3x4fv = load.invoke("glProgramUniformMatrix3x4fv", IIIZPV); - caps.glProgramUniformMatrix4dv = load.invoke("glProgramUniformMatrix4dv", IIIZPV); - caps.glProgramUniformMatrix4fv = load.invoke("glProgramUniformMatrix4fv", IIIZPV); - caps.glProgramUniformMatrix4x2dv = load.invoke("glProgramUniformMatrix4x2dv", IIIZPV); - caps.glProgramUniformMatrix4x2fv = load.invoke("glProgramUniformMatrix4x2fv", IIIZPV); - caps.glProgramUniformMatrix4x3dv = load.invoke("glProgramUniformMatrix4x3dv", IIIZPV); - caps.glProgramUniformMatrix4x3fv = load.invoke("glProgramUniformMatrix4x3fv", IIIZPV); - caps.glReleaseShaderCompiler = load.invoke("glReleaseShaderCompiler", V); - caps.glScissorArrayv = load.invoke("glScissorArrayv", IIPV); - caps.glScissorIndexed = load.invoke("glScissorIndexed", IIIIIV); - caps.glScissorIndexedv = load.invoke("glScissorIndexedv", IPV); - caps.glShaderBinary = load.invoke("glShaderBinary", IPIPIV); - caps.glUseProgramStages = load.invoke("glUseProgramStages", IIIV); - caps.glValidateProgramPipeline = load.invoke("glValidateProgramPipeline", IV); - caps.glVertexAttribL1d = load.invoke("glVertexAttribL1d", IDV); - caps.glVertexAttribL1dv = load.invoke("glVertexAttribL1dv", IPV); - caps.glVertexAttribL2d = load.invoke("glVertexAttribL2d", IDDV); - caps.glVertexAttribL2dv = load.invoke("glVertexAttribL2dv", IPV); - caps.glVertexAttribL3d = load.invoke("glVertexAttribL3d", IDDDV); - caps.glVertexAttribL3dv = load.invoke("glVertexAttribL3dv", IPV); - caps.glVertexAttribL4d = load.invoke("glVertexAttribL4d", IDDDDV); - caps.glVertexAttribL4dv = load.invoke("glVertexAttribL4dv", IPV); - caps.glVertexAttribLPointer = load.invoke("glVertexAttribLPointer", IIIIPV); - caps.glViewportArrayv = load.invoke("glViewportArrayv", IIPV); - caps.glViewportIndexedf = load.invoke("glViewportIndexedf", IFFFFV); - caps.glViewportIndexedfv = load.invoke("glViewportIndexedfv", IPV); - } - - public static void activeShaderProgram(int pipeline, int program) { - var caps = getCapabilities(); - try { - check(caps.glActiveShaderProgram).invokeExact(pipeline, program); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } - } + int FIXED = 0x140C; + int IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A; + int IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; + int LOW_FLOAT = 0x8DF0; + int MEDIUM_FLOAT = 0x8DF1; + int HIGH_FLOAT = 0x8DF2; + int LOW_INT = 0x8DF3; + int MEDIUM_INT = 0x8DF4; + int HIGH_INT = 0x8DF5; + int SHADER_COMPILER = 0x8DFA; + int SHADER_BINARY_FORMATS = 0x8DF8; + int NUM_SHADER_BINARY_FORMATS = 0x8DF9; + int MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB; + int MAX_VARYING_VECTORS = 0x8DFC; + int MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD; + int RGB565 = 0x8D62; + int PROGRAM_BINARY_RETRIEVABLE_HINT = 0x8257; + int PROGRAM_BINARY_LENGTH = 0x8741; + int NUM_PROGRAM_BINARY_FORMATS = 0x87FE; + int PROGRAM_BINARY_FORMATS = 0x87FF; + int VERTEX_SHADER_BIT = 0x00000001; + int FRAGMENT_SHADER_BIT = 0x00000002; + int GEOMETRY_SHADER_BIT = 0x00000004; + int TESS_CONTROL_SHADER_BIT = 0x00000008; + int TESS_EVALUATION_SHADER_BIT = 0x00000010; + int ALL_SHADER_BITS = 0xFFFFFFFF; + int PROGRAM_SEPARABLE = 0x8258; + int ACTIVE_PROGRAM = 0x8259; + int PROGRAM_PIPELINE_BINDING = 0x825A; + int MAX_VIEWPORTS = 0x825B; + int VIEWPORT_SUBPIXEL_BITS = 0x825C; + int VIEWPORT_BOUNDS_RANGE = 0x825D; + int LAYER_PROVOKING_VERTEX = 0x825E; + int VIEWPORT_INDEX_PROVOKING_VERTEX = 0x825F; + int UNDEFINED_VERTEX = 0x8260; - public static void bindProgramPipeline(int pipeline) { - var caps = getCapabilities(); - try { - check(caps.glBindProgramPipeline).invokeExact(pipeline); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glActiveShaderProgram") + default void activeShaderProgram(int pipeline, int program) { + throw new ContextException(); } - public static void clearDepthf(float d) { - var caps = getCapabilities(); - try { - check(caps.glClearDepthf).invokeExact(d); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glBindProgramPipeline") + default void bindProgramPipeline(int pipeline) { + throw new ContextException(); } - public static int createShaderProgramv(int type, int count, MemorySegment strings) { - var caps = getCapabilities(); - try { - return (int) check(caps.glCreateShaderProgramv).invokeExact(type, count, strings); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glClearDepthf") + default void clearDepthf(float d) { + throw new ContextException(); } - public static int createShaderProgramv(SegmentAllocator allocator, int type, String[] strings) { - var seg = allocator.allocate(ADDRESS, strings.length); - for (int i = 0; i < strings.length; i++) { - seg.setAtIndex(ADDRESS, i, allocator.allocateFrom(strings[i])); - } - return createShaderProgramv(type, strings.length, seg); + @Entrypoint("glCreateShaderProgramv") + default int createShaderProgramv(int type, int count, MemorySegment strings) { + throw new ContextException(); } - public static int createShaderProgram(int type, String string) { - final MemoryStack stack = MemoryStack.stackGet(); - final long stackPointer = stack.getPointer(); - try { - return createShaderProgramv(type, 1, stack.allocateFrom(ADDRESS, stack.allocateFrom(string))); - } finally { - stack.setPointer(stackPointer); - } + @Skip + default int createShaderProgramv(SegmentAllocator allocator, int type, String[] strings) { + return createShaderProgramv(type, strings.length, Marshal.marshal(allocator, strings)); } - public static void deleteProgramPipelines(int n, MemorySegment pipelines) { - var caps = getCapabilities(); - try { - check(caps.glDeleteProgramPipelines).invokeExact(n, pipelines); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); + @Skip + default int createShaderProgramv(int type, String string) { + try (MemoryStack stack = MemoryStack.stackPush()) { + return createShaderProgramv(type, 1, stack.allocateFrom(ADDRESS, Marshal.marshal(stack, string))); } } - public static void deleteProgramPipelines(SegmentAllocator allocator, int[] pipelines) { - deleteProgramPipelines(pipelines.length, allocator.allocateFrom(JAVA_INT, pipelines)); + @Entrypoint("glDeleteProgramPipelines") + default void deleteProgramPipelines(int n, MemorySegment pipelines) { + throw new ContextException(); } - public static void deleteProgramPipeline(int pipeline) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - deleteProgramPipelines(1, stack.ints(pipeline)); - } finally { - stack.setPointer(stackPointer); + @Skip + default void deleteProgramPipelines(int... pipelines) { + try (MemoryStack stack = MemoryStack.stackPush()) { + deleteProgramPipelines(pipelines.length, Marshal.marshal(stack, pipelines)); } } - public static void depthRangeArrayv(int first, int count, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glDepthRangeArrayv).invokeExact(first, count, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glDepthRangeArrayv") + default void depthRangeArrayv(int first, int count, MemorySegment v) { + throw new ContextException(); } - public static void depthRangeArrayv(SegmentAllocator allocator, int first, double[] v) { - depthRangeArrayv(first, v.length, allocator.allocateFrom(JAVA_DOUBLE, v)); + @Skip + default void depthRangeArrayv(SegmentAllocator allocator, int first, double[] v) { + depthRangeArrayv(first, v.length, Marshal.marshal(allocator, v)); } - public static void depthRangeIndexed(int index, double n, double f) { - var caps = getCapabilities(); - try { - check(caps.glDepthRangeIndexed).invokeExact(index, n, f); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glDepthRangeIndexed") + default void depthRangeIndexed(int index, double n, double f) { + throw new ContextException(); } - public static void depthRangef(float n, float f) { - var caps = getCapabilities(); - try { - check(caps.glDepthRangef).invokeExact(n, f); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glDepthRangef") + default void depthRangef(float n, float f) { + throw new ContextException(); } - public static void genProgramPipelines(int n, MemorySegment pipelines) { - var caps = getCapabilities(); - try { - check(caps.glGenProgramPipelines).invokeExact(n, pipelines); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGenProgramPipelines") + default void genProgramPipelines(int n, MemorySegment pipelines) { + throw new ContextException(); } - public static void genProgramPipelines(SegmentAllocator allocator, int[] pipelines) { - var seg = allocator.allocate(JAVA_INT, pipelines.length); + @Skip + default void genProgramPipelines(SegmentAllocator allocator, @Ref int[] pipelines) { + var seg = Marshal.marshal(allocator, pipelines); genProgramPipelines(pipelines.length, seg); - RuntimeHelper.toArray(seg, pipelines); + Unmarshal.copy(seg, pipelines); } - public static int genProgramPipeline() { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocInt(); + @Skip + default int genProgramPipelines() { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.ints(0); genProgramPipelines(1, seg); return seg.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static void getDoublei_v(int target, int index, MemorySegment data) { - var caps = getCapabilities(); - try { - check(caps.glGetDoublei_v).invokeExact(target, index, data); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetDoublei_v") + default void getDoublei_v(int target, int index, MemorySegment data) { + throw new ContextException(); } - public static void getDoublei_v(SegmentAllocator allocator, int target, int index, double[] data) { - var seg = allocator.allocate(JAVA_DOUBLE, data.length); - getDoublei_v(target, index, seg); - RuntimeHelper.toArray(seg, data); + @Entrypoint("glGetDoublei_v") + default void getDoublei_v(SegmentAllocator allocator, int target, int index, @Ref double[] data) { + throw new ContextException(); } - public static double getDoublei(int target, int index) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocDouble(); + @Skip + default double getDoublei_v(int target, int index) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.doubles(0D); getDoublei_v(target, index, seg); return seg.get(JAVA_DOUBLE, 0); - } finally { - stack.setPointer(stackPointer); } } - public static void getFloati_v(int target, int index, MemorySegment data) { - var caps = getCapabilities(); - try { - check(caps.glGetFloati_v).invokeExact(target, index, data); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetFloati_v") + default void getFloati_v(int target, int index, MemorySegment data) { + throw new ContextException(); } - public static void getFloati_v(SegmentAllocator allocator, int target, int index, float[] data) { - var seg = allocator.allocate(JAVA_FLOAT, data.length); - getFloati_v(target, index, seg); - RuntimeHelper.toArray(seg, data); + @Entrypoint("glGetFloati_v") + default void getFloati_v(SegmentAllocator allocator, int target, int index, @Ref float[] data) { + throw new ContextException(); } - public static float getFloati(int target, int index) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocFloat(); + @Skip + default float getFloati_v(int target, int index) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.floats(0F); getFloati_v(target, index, seg); return seg.get(JAVA_FLOAT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static void getProgramBinary(int program, int bufSize, MemorySegment length, MemorySegment binaryFormat, MemorySegment binary) { - var caps = getCapabilities(); - try { - check(caps.glGetProgramBinary).invokeExact(program, bufSize, length, binaryFormat, binary); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetProgramBinary") + default void getProgramBinary(int program, int bufSize, MemorySegment length, MemorySegment binaryFormat, MemorySegment binary) { + throw new ContextException(); } - public static void getProgramBinary(int program, int bufSize, int @Nullable [] length, int[] binaryFormat, MemorySegment binary) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var pl = length != null ? stack.callocInt() : MemorySegment.NULL; - var pf = stack.callocInt(); - getProgramBinary(program, bufSize, pl, pf, binary); - if (length != null && length.length > 0) { - length[0] = pl.get(JAVA_INT, 0); - } - binaryFormat[0] = pf.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); - } + @Entrypoint("glGetProgramBinary") + default void getProgramBinary(int program, int bufSize, @Ref int @Nullable [] length, @Ref int[] binaryFormat, MemorySegment binary) { + throw new ContextException(); } - public static void getProgramBinary(int program, int @Nullable [] length, int[] binaryFormat, MemorySegment binary) { - getProgramBinary(program, (int) binary.byteSize(), length, binaryFormat, binary); + @Skip + default void getProgramBinary(int program, @Ref int @Nullable [] length, @Ref int[] binaryFormat, MemorySegment binary) { + getProgramBinary(program, Math.toIntExact(binary.byteSize()), length, binaryFormat, binary); } - public static void getProgramPipelineInfoLog(int pipeline, int bufSize, MemorySegment length, MemorySegment infoLog) { - var caps = getCapabilities(); - try { - check(caps.glGetProgramPipelineInfoLog).invokeExact(pipeline, bufSize, length, infoLog); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetProgramPipelineInfoLog") + default void getProgramPipelineInfoLog(int pipeline, int bufSize, MemorySegment length, MemorySegment infoLog) { + throw new ContextException(); } - public static void getProgramPipelineInfoLog(SegmentAllocator allocator, int pipeline, int bufSize, int @Nullable [] length, String[] infoLog) { - var pl = length != null ? allocator.allocate(JAVA_INT) : MemorySegment.NULL; + @Skip + default void getProgramPipelineInfoLog(SegmentAllocator allocator, int pipeline, int bufSize, @Ref int @Nullable [] length, @Ref String[] infoLog) { + var pl = Marshal.marshal(allocator, length); var pi = allocator.allocate(JAVA_BYTE, bufSize); getProgramPipelineInfoLog(pipeline, bufSize, pl, pi); - if (length != null && length.length > 0) { - length[0] = pl.get(JAVA_INT, 0); - } + Unmarshal.copy(pl, length); infoLog[0] = pi.getString(0); } - public static String getProgramPipelineInfoLog(SegmentAllocator allocator, int pipeline) { - final int sz = getProgramPipelinei(pipeline, INFO_LOG_LENGTH); + @Skip + default String getProgramPipelineInfoLog(SegmentAllocator allocator, int pipeline) { + final int sz = getProgramPipelineiv(pipeline, INFO_LOG_LENGTH); var pi = allocator.allocate(JAVA_BYTE, sz); getProgramPipelineInfoLog(pipeline, sz, MemorySegment.NULL, pi); return pi.getString(0); } - public static void getProgramPipelineiv(int pipeline, int pname, MemorySegment params) { - var caps = getCapabilities(); - try { - check(caps.glGetProgramPipelineiv).invokeExact(pipeline, pname, params); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetProgramPipelineiv") + default void getProgramPipelineiv(int pipeline, int pname, MemorySegment params) { + throw new ContextException(); } - public static int getProgramPipelinei(int pipeline, int pname) { - var stack = MemoryStack.stackGet(); - long stackPointer = stack.getPointer(); - try { - var seg = stack.callocInt(); + @Skip + default int getProgramPipelineiv(int pipeline, int pname) { + try (MemoryStack stack = MemoryStack.stackPush()) { + var seg = stack.ints(0); getProgramPipelineiv(pipeline, pname, seg); return seg.get(JAVA_INT, 0); - } finally { - stack.setPointer(stackPointer); } } - public static void getShaderPrecisionFormat(int shaderType, int precisionType, MemorySegment range, MemorySegment precision) { - var caps = getCapabilities(); - try { - check(caps.glGetShaderPrecisionFormat).invokeExact(shaderType, precisionType, range, precision); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetShaderPrecisionFormat") + default void getShaderPrecisionFormat(int shaderType, int precisionType, MemorySegment range, MemorySegment precision) { + throw new ContextException(); } - public static void getShaderPrecisionFormat(SegmentAllocator allocator, int shaderType, int precisionType, int[] range, int[] precision) { - var pr = allocator.allocate(JAVA_INT, range.length); - var pp = allocator.allocate(JAVA_INT); - getShaderPrecisionFormat(shaderType, precisionType, pr, pp); - RuntimeHelper.toArray(pr, range); - precision[0] = pp.get(JAVA_INT, 0); + @Entrypoint("glGetShaderPrecisionFormat") + default void getShaderPrecisionFormat(SegmentAllocator allocator, int shaderType, int precisionType, @Ref int[] range, @Ref int[] precision) { + throw new ContextException(); } - public static void getVertexAttribLdv(int index, int pname, MemorySegment params) { - var caps = getCapabilities(); - try { - check(caps.glGetVertexAttribLdv).invokeExact(index, pname, params); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glGetVertexAttribLdv") + default void getVertexAttribLdv(int index, int pname, MemorySegment params) { + throw new ContextException(); } - public static void getVertexAttribLdv(SegmentAllocator allocator, int index, int pname, double[] params) { - var seg = allocator.allocate(JAVA_DOUBLE, params.length); - getVertexAttribLdv(index, pname, seg); - RuntimeHelper.toArray(seg, params); + @Entrypoint("glGetVertexAttribLdv") + default void getVertexAttribLdv(SegmentAllocator allocator, int index, int pname, @Ref double[] params) { + throw new ContextException(); } - public static boolean isProgramPipeline(int pipeline) { - var caps = getCapabilities(); - try { - return (boolean) check(caps.glIsProgramPipeline).invokeExact(pipeline); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glIsProgramPipeline") + default boolean isProgramPipeline(int pipeline) { + throw new ContextException(); } - public static void programBinary(int program, int binaryFormat, MemorySegment binary, int length) { - var caps = getCapabilities(); - try { - check(caps.glProgramBinary).invokeExact(program, binaryFormat, binary, length); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramBinary") + default void programBinary(int program, int binaryFormat, MemorySegment binary, int length) { + throw new ContextException(); } - public static void programBinary(int program, int binaryFormat, MemorySegment binary) { - programBinary(program, binaryFormat, binary, (int) binary.byteSize()); + @Skip + default void programBinary(int program, int binaryFormat, MemorySegment binary) { + programBinary(program, binaryFormat, binary, Math.toIntExact(binary.byteSize())); } - public static void programParameteri(int program, int pname, int value) { - var caps = getCapabilities(); - try { - check(caps.glProgramParameteri).invokeExact(program, pname, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramParameteri") + default void programParameteri(int program, int pname, int value) { + throw new ContextException(); } - public static void programUniform1d(int program, int location, double v0) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform1d).invokeExact(program, location, v0); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform1d") + default void programUniform1d(int program, int location, double v0) { + throw new ContextException(); } - public static void programUniform1dv(int program, int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform1dv).invokeExact(program, location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform1dv") + default void programUniform1dv(int program, int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void programUniform1dv(SegmentAllocator allocator, int program, int location, double[] value) { - programUniform1dv(program, location, value.length, allocator.allocateFrom(JAVA_DOUBLE, value)); + @Skip + default void programUniform1dv(SegmentAllocator allocator, int program, int location, double[] value) { + programUniform1dv(program, location, value.length, Marshal.marshal(allocator, value)); } - public static void programUniform1f(int program, int location, float v0) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform1f).invokeExact(program, location, v0); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform1f") + default void programUniform1f(int program, int location, float v0) { + throw new ContextException(); } - public static void programUniform1fv(int program, int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform1fv).invokeExact(program, location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform1fv") + default void programUniform1fv(int program, int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void programUniform1fv(SegmentAllocator allocator, int program, int location, float[] value) { - programUniform1fv(program, location, value.length, allocator.allocateFrom(JAVA_FLOAT, value)); + @Skip + default void programUniform1fv(SegmentAllocator allocator, int program, int location, float[] value) { + programUniform1fv(program, location, value.length, Marshal.marshal(allocator, value)); } - public static void programUniform1i(int program, int location, int v0) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform1i).invokeExact(program, location, v0); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform1i") + default void programUniform1i(int program, int location, int v0) { + throw new ContextException(); } - public static void programUniform1iv(int program, int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform1iv).invokeExact(program, location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform1iv") + default void programUniform1iv(int program, int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void programUniform1iv(SegmentAllocator allocator, int program, int location, int[] value) { - programUniform1iv(program, location, value.length, allocator.allocateFrom(JAVA_INT, value)); + @Skip + default void programUniform1iv(SegmentAllocator allocator, int program, int location, int[] value) { + programUniform1iv(program, location, value.length, Marshal.marshal(allocator, value)); } - public static void programUniform1ui(int program, int location, int v0) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform1ui).invokeExact(program, location, v0); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform1ui") + default void programUniform1ui(int program, int location, int v0) { + throw new ContextException(); } - public static void programUniform1uiv(int program, int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform1uiv).invokeExact(program, location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform1uiv") + default void programUniform1uiv(int program, int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void programUniform1uiv(SegmentAllocator allocator, int program, int location, int[] value) { - programUniform1uiv(program, location, value.length, allocator.allocateFrom(JAVA_INT, value)); + @Skip + default void programUniform1uiv(SegmentAllocator allocator, int program, int location, int[] value) { + programUniform1uiv(program, location, value.length, Marshal.marshal(allocator, value)); } - public static void programUniform2d(int program, int location, double v0, double v1) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform2d).invokeExact(program, location, v0, v1); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform2d") + default void programUniform2d(int program, int location, double v0, double v1) { + throw new ContextException(); } - public static void programUniform2dv(int program, int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform2dv).invokeExact(program, location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform2dv") + default void programUniform2dv(int program, int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void programUniform2dv(SegmentAllocator allocator, int program, int location, double[] value) { - programUniform2dv(program, location, value.length >> 2, allocator.allocateFrom(JAVA_DOUBLE, value)); + @Skip + default void programUniform2dv(SegmentAllocator allocator, int program, int location, double[] value) { + programUniform2dv(program, location, value.length >> 2, Marshal.marshal(allocator, value)); } - public static void programUniform2f(int program, int location, float v0, float v1) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform2f).invokeExact(program, location, v0, v1); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform2f") + default void programUniform2f(int program, int location, float v0, float v1) { + throw new ContextException(); } - public static void programUniform2fv(int program, int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform2fv).invokeExact(program, location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform2fv") + default void programUniform2fv(int program, int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void programUniform2fv(SegmentAllocator allocator, int program, int location, float[] value) { - programUniform2fv(program, location, value.length >> 2, allocator.allocateFrom(JAVA_FLOAT, value)); + @Skip + default void programUniform2fv(SegmentAllocator allocator, int program, int location, float[] value) { + programUniform2fv(program, location, value.length >> 2, Marshal.marshal(allocator, value)); } - public static void programUniform2i(int program, int location, int v0, int v1) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform2i).invokeExact(program, location, v0, v1); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform2i") + default void programUniform2i(int program, int location, int v0, int v1) { + throw new ContextException(); } - public static void programUniform2iv(int program, int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform2iv).invokeExact(program, location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform2iv") + default void programUniform2iv(int program, int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void programUniform2iv(SegmentAllocator allocator, int program, int location, int[] value) { - programUniform2iv(program, location, value.length >> 2, allocator.allocateFrom(JAVA_INT, value)); + @Skip + default void programUniform2iv(SegmentAllocator allocator, int program, int location, int[] value) { + programUniform2iv(program, location, value.length >> 2, Marshal.marshal(allocator, value)); } - public static void programUniform2ui(int program, int location, int v0, int v1) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform2ui).invokeExact(program, location, v0, v1); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform2ui") + default void programUniform2ui(int program, int location, int v0, int v1) { + throw new ContextException(); } - public static void programUniform2uiv(int program, int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform2uiv).invokeExact(program, location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform2uiv") + default void programUniform2uiv(int program, int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void programUniform2uiv(SegmentAllocator allocator, int program, int location, int[] value) { - programUniform2uiv(program, location, value.length >> 2, allocator.allocateFrom(JAVA_INT, value)); + @Skip + default void programUniform2uiv(SegmentAllocator allocator, int program, int location, int[] value) { + programUniform2uiv(program, location, value.length >> 2, Marshal.marshal(allocator, value)); } - public static void programUniform3d(int program, int location, double v0, double v1, double v2) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform3d).invokeExact(program, location, v0, v1, v2); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform3d") + default void programUniform3d(int program, int location, double v0, double v1, double v2) { + throw new ContextException(); } - public static void programUniform3dv(int program, int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform3dv).invokeExact(program, location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform3dv") + default void programUniform3dv(int program, int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void programUniform3dv(SegmentAllocator allocator, int program, int location, double[] value) { - programUniform3dv(program, location, value.length / 3, allocator.allocateFrom(JAVA_DOUBLE, value)); + @Skip + default void programUniform3dv(SegmentAllocator allocator, int program, int location, double[] value) { + programUniform3dv(program, location, value.length / 3, Marshal.marshal(allocator, value)); } - public static void programUniform3f(int program, int location, float v0, float v1, float v2) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform3f).invokeExact(program, location, v0, v1, v2); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform3f") + default void programUniform3f(int program, int location, float v0, float v1, float v2) { + throw new ContextException(); } - public static void programUniform3fv(int program, int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform3fv).invokeExact(program, location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform3fv") + default void programUniform3fv(int program, int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void programUniform3fv(SegmentAllocator allocator, int program, int location, float[] value) { - programUniform3fv(program, location, value.length / 3, allocator.allocateFrom(JAVA_FLOAT, value)); + @Skip + default void programUniform3fv(SegmentAllocator allocator, int program, int location, float[] value) { + programUniform3fv(program, location, value.length / 3, Marshal.marshal(allocator, value)); } - public static void programUniform3i(int program, int location, int v0, int v1, int v2) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform3i).invokeExact(program, location, v0, v1, v2); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform3i") + default void programUniform3i(int program, int location, int v0, int v1, int v2) { + throw new ContextException(); } - public static void programUniform3iv(int program, int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform3iv).invokeExact(program, location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform3iv") + default void programUniform3iv(int program, int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void programUniform3iv(SegmentAllocator allocator, int program, int location, int[] value) { - programUniform3iv(program, location, value.length / 3, allocator.allocateFrom(JAVA_INT, value)); + @Skip + default void programUniform3iv(SegmentAllocator allocator, int program, int location, int[] value) { + programUniform3iv(program, location, value.length / 3, Marshal.marshal(allocator, value)); } - public static void programUniform3ui(int program, int location, int v0, int v1, int v2) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform3ui).invokeExact(program, location, v0, v1, v2); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform3ui") + default void programUniform3ui(int program, int location, int v0, int v1, int v2) { + throw new ContextException(); } - public static void programUniform3uiv(int program, int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform3uiv).invokeExact(program, location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform3uiv") + default void programUniform3uiv(int program, int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void programUniform3uiv(SegmentAllocator allocator, int program, int location, int[] value) { - programUniform3uiv(program, location, value.length / 3, allocator.allocateFrom(JAVA_INT, value)); + @Skip + default void programUniform3uiv(SegmentAllocator allocator, int program, int location, int[] value) { + programUniform3uiv(program, location, value.length / 3, Marshal.marshal(allocator, value)); } - public static void programUniform4d(int program, int location, double v0, double v1, double v2, double v3) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform4d).invokeExact(program, location, v0, v1, v2, v3); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform4d") + default void programUniform4d(int program, int location, double v0, double v1, double v2, double v3) { + throw new ContextException(); } - public static void programUniform4dv(int program, int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform4dv).invokeExact(program, location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform4dv") + default void programUniform4dv(int program, int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void programUniform4dv(SegmentAllocator allocator, int program, int location, double[] value) { - programUniform4dv(program, location, value.length >> 2, allocator.allocateFrom(JAVA_DOUBLE, value)); + @Skip + default void programUniform4dv(SegmentAllocator allocator, int program, int location, double[] value) { + programUniform4dv(program, location, value.length >> 2, Marshal.marshal(allocator, value)); } - public static void programUniform4f(int program, int location, float v0, float v1, float v2, float v3) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform4f).invokeExact(program, location, v0, v1, v2, v3); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform4f") + default void programUniform4f(int program, int location, float v0, float v1, float v2, float v3) { + throw new ContextException(); } - public static void programUniform4fv(int program, int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform4fv).invokeExact(program, location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform4fv") + default void programUniform4fv(int program, int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void programUniform4fv(SegmentAllocator allocator, int program, int location, float[] value) { - programUniform4fv(program, location, value.length >> 2, allocator.allocateFrom(JAVA_FLOAT, value)); + @Skip + default void programUniform4fv(SegmentAllocator allocator, int program, int location, float[] value) { + programUniform4fv(program, location, value.length >> 2, Marshal.marshal(allocator, value)); } - public static void programUniform4i(int program, int location, int v0, int v1, int v2, int v3) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform4i).invokeExact(program, location, v0, v1, v2, v3); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform4i") + default void programUniform4i(int program, int location, int v0, int v1, int v2, int v3) { + throw new ContextException(); } - public static void programUniform4iv(int program, int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform4iv).invokeExact(program, location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform4iv") + default void programUniform4iv(int program, int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void programUniform4iv(SegmentAllocator allocator, int program, int location, int[] value) { - programUniform4iv(program, location, value.length >> 2, allocator.allocateFrom(JAVA_INT, value)); + @Skip + default void programUniform4iv(SegmentAllocator allocator, int program, int location, int[] value) { + programUniform4iv(program, location, value.length >> 2, Marshal.marshal(allocator, value)); } - public static void programUniform4ui(int program, int location, int v0, int v1, int v2, int v3) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform4ui).invokeExact(program, location, v0, v1, v2, v3); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform4ui") + default void programUniform4ui(int program, int location, int v0, int v1, int v2, int v3) { + throw new ContextException(); } - public static void programUniform4uiv(int program, int location, int count, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniform4uiv).invokeExact(program, location, count, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniform4uiv") + default void programUniform4uiv(int program, int location, int count, MemorySegment value) { + throw new ContextException(); } - public static void programUniform4uiv(SegmentAllocator allocator, int program, int location, int[] value) { - programUniform4uiv(program, location, value.length >> 2, allocator.allocateFrom(JAVA_INT, value)); + @Skip + default void programUniform4uiv(SegmentAllocator allocator, int program, int location, int[] value) { + programUniform4uiv(program, location, value.length >> 2, Marshal.marshal(allocator, value)); } - public static void programUniformMatrix2dv(int program, int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniformMatrix2dv).invokeExact(program, location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniformMatrix2dv") + default void programUniformMatrix2dv(int program, int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void programUniformMatrix2dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) { - programUniformMatrix2dv(program, location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value)); + @Entrypoint("glProgramUniformMatrix2dv") + default void programUniformMatrix2dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) { + throw new ContextException(); } - public static void programUniformMatrix2dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) { + @Skip + default void programUniformMatrix2dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) { programUniformMatrix2dv(allocator, program, location, value.length >> 2, transpose, value); } - public static void programUniformMatrix2fv(int program, int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniformMatrix2fv).invokeExact(program, location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniformMatrix2fv") + default void programUniformMatrix2fv(int program, int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void programUniformMatrix2fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) { - programUniformMatrix2fv(program, location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); + @Entrypoint("glProgramUniformMatrix2fv") + default void programUniformMatrix2fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) { + throw new ContextException(); } - public static void programUniformMatrix2fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) { + @Skip + default void programUniformMatrix2fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) { programUniformMatrix2fv(allocator, program, location, value.length >> 2, transpose, value); } - public static void programUniformMatrix2x3dv(int program, int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniformMatrix2x3dv).invokeExact(program, location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniformMatrix2x3dv") + default void programUniformMatrix2x3dv(int program, int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void programUniformMatrix2x3dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) { - programUniformMatrix2x3dv(program, location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value)); + @Entrypoint("glProgramUniformMatrix2x3dv") + default void programUniformMatrix2x3dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) { + throw new ContextException(); } - public static void programUniformMatrix2x3dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) { + @Skip + default void programUniformMatrix2x3dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) { programUniformMatrix2x3dv(allocator, program, location, value.length / 6, transpose, value); } - public static void programUniformMatrix2x3fv(int program, int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniformMatrix2x3fv).invokeExact(program, location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniformMatrix2x3fv") + default void programUniformMatrix2x3fv(int program, int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void programUniformMatrix2x3fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) { - programUniformMatrix2x3fv(program, location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); + @Entrypoint("glProgramUniformMatrix2x3fv") + default void programUniformMatrix2x3fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) { + throw new ContextException(); } - public static void programUniformMatrix2x3fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) { + @Skip + default void programUniformMatrix2x3fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) { programUniformMatrix2x3fv(allocator, program, location, value.length / 6, transpose, value); } - public static void programUniformMatrix2x4dv(int program, int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniformMatrix2x4dv).invokeExact(program, location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniformMatrix2x4dv") + default void programUniformMatrix2x4dv(int program, int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void programUniformMatrix2x4dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) { - programUniformMatrix2x4dv(program, location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value)); + @Entrypoint("glProgramUniformMatrix2x4dv") + default void programUniformMatrix2x4dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) { + throw new ContextException(); } - public static void programUniformMatrix2x4dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) { + @Skip + default void programUniformMatrix2x4dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) { programUniformMatrix2x4dv(allocator, program, location, value.length >> 3, transpose, value); } - public static void programUniformMatrix2x4fv(int program, int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniformMatrix2x4fv).invokeExact(program, location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniformMatrix2x4fv") + default void programUniformMatrix2x4fv(int program, int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void programUniformMatrix2x4fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) { - programUniformMatrix2x4fv(program, location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); + @Entrypoint("glProgramUniformMatrix2x4fv") + default void programUniformMatrix2x4fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) { + throw new ContextException(); } - public static void programUniformMatrix2x4fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) { + @Skip + default void programUniformMatrix2x4fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) { programUniformMatrix2x4fv(allocator, program, location, value.length >> 3, transpose, value); } - public static void programUniformMatrix3dv(int program, int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniformMatrix3dv).invokeExact(program, location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniformMatrix3dv") + default void programUniformMatrix3dv(int program, int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void programUniformMatrix3dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) { - programUniformMatrix3dv(program, location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value)); + @Entrypoint("glProgramUniformMatrix3dv") + default void programUniformMatrix3dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) { + throw new ContextException(); } - public static void programUniformMatrix3dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) { + @Skip + default void programUniformMatrix3dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) { programUniformMatrix3dv(allocator, program, location, value.length / 9, transpose, value); } - public static void programUniformMatrix3fv(int program, int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniformMatrix3fv).invokeExact(program, location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniformMatrix3fv") + default void programUniformMatrix3fv(int program, int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void programUniformMatrix3fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) { - programUniformMatrix3fv(program, location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); + @Entrypoint("glProgramUniformMatrix3fv") + default void programUniformMatrix3fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) { + throw new ContextException(); } - public static void programUniformMatrix3fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) { + @Skip + default void programUniformMatrix3fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) { programUniformMatrix3fv(allocator, program, location, value.length / 9, transpose, value); } - public static void programUniformMatrix3x2dv(int program, int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniformMatrix3x2dv).invokeExact(program, location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniformMatrix3x2dv") + default void programUniformMatrix3x2dv(int program, int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void programUniformMatrix3x2dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) { - programUniformMatrix3x2dv(program, location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value)); + @Entrypoint("glProgramUniformMatrix3x2dv") + default void programUniformMatrix3x2dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) { + throw new ContextException(); } - public static void programUniformMatrix3x2dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) { + @Skip + default void programUniformMatrix3x2dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) { programUniformMatrix3x2dv(allocator, program, location, value.length / 6, transpose, value); } - public static void programUniformMatrix3x2fv(int program, int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniformMatrix3x2fv).invokeExact(program, location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniformMatrix3x2fv") + default void programUniformMatrix3x2fv(int program, int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void programUniformMatrix3x2fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) { - programUniformMatrix3x2fv(program, location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); + @Entrypoint("glProgramUniformMatrix3x2fv") + default void programUniformMatrix3x2fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) { + throw new ContextException(); } - public static void programUniformMatrix3x2fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) { + @Skip + default void programUniformMatrix3x2fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) { programUniformMatrix3x2fv(allocator, program, location, value.length / 6, transpose, value); } - public static void programUniformMatrix3x4dv(int program, int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniformMatrix3x4dv).invokeExact(program, location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniformMatrix3x4dv") + default void programUniformMatrix3x4dv(int program, int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void programUniformMatrix3x4dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) { - programUniformMatrix3x4dv(program, location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value)); + @Entrypoint("glProgramUniformMatrix3x4dv") + default void programUniformMatrix3x4dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) { + throw new ContextException(); } - public static void programUniformMatrix3x4dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) { + @Skip + default void programUniformMatrix3x4dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) { programUniformMatrix3x4dv(allocator, program, location, value.length / 12, transpose, value); } - public static void programUniformMatrix3x4fv(int program, int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniformMatrix3x4fv).invokeExact(program, location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniformMatrix3x4fv") + default void programUniformMatrix3x4fv(int program, int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void programUniformMatrix3x4fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) { - programUniformMatrix3x4fv(program, location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); + @Entrypoint("glProgramUniformMatrix3x4fv") + default void programUniformMatrix3x4fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) { + throw new ContextException(); } - public static void programUniformMatrix3x4fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) { + @Skip + default void programUniformMatrix3x4fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) { programUniformMatrix3x4fv(allocator, program, location, value.length / 12, transpose, value); } - public static void programUniformMatrix4dv(int program, int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniformMatrix4dv).invokeExact(program, location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniformMatrix4dv") + default void programUniformMatrix4dv(int program, int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void programUniformMatrix4dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) { - programUniformMatrix4dv(program, location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value)); + @Entrypoint("glProgramUniformMatrix4dv") + default void programUniformMatrix4dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) { + throw new ContextException(); } - public static void programUniformMatrix4dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) { + @Skip + default void programUniformMatrix4dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) { programUniformMatrix4dv(allocator, program, location, value.length >> 4, transpose, value); } - public static void programUniformMatrix4fv(int program, int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniformMatrix4fv).invokeExact(program, location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniformMatrix4fv") + default void programUniformMatrix4fv(int program, int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void programUniformMatrix4fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) { - programUniformMatrix4fv(program, location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); + @Entrypoint("glProgramUniformMatrix4fv") + default void programUniformMatrix4fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) { + throw new ContextException(); } - public static void programUniformMatrix4fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) { + @Skip + default void programUniformMatrix4fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) { programUniformMatrix4fv(allocator, program, location, value.length >> 4, transpose, value); } - public static void programUniformMatrix4x2dv(int program, int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniformMatrix4x2dv).invokeExact(program, location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniformMatrix4x2dv") + default void programUniformMatrix4x2dv(int program, int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void programUniformMatrix4x2dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) { - programUniformMatrix4x2dv(program, location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value)); + @Entrypoint("glProgramUniformMatrix4x2dv") + default void programUniformMatrix4x2dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) { + throw new ContextException(); } - public static void programUniformMatrix4x2dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) { + @Skip + default void programUniformMatrix4x2dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) { programUniformMatrix4x2dv(allocator, program, location, value.length >> 3, transpose, value); } - public static void programUniformMatrix4x2fv(int program, int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniformMatrix4x2fv).invokeExact(program, location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniformMatrix4x2fv") + default void programUniformMatrix4x2fv(int program, int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void programUniformMatrix4x2fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) { - programUniformMatrix4x2fv(program, location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); + @Entrypoint("glProgramUniformMatrix4x2fv") + default void programUniformMatrix4x2fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) { + throw new ContextException(); } - public static void programUniformMatrix4x2fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) { + @Skip + default void programUniformMatrix4x2fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) { programUniformMatrix4x2fv(allocator, program, location, value.length >> 3, transpose, value); } - public static void programUniformMatrix4x3dv(int program, int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniformMatrix4x3dv).invokeExact(program, location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniformMatrix4x3dv") + default void programUniformMatrix4x3dv(int program, int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void programUniformMatrix4x3dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) { - programUniformMatrix4x3dv(program, location, count, transpose, allocator.allocateFrom(JAVA_DOUBLE, value)); + @Entrypoint("glProgramUniformMatrix4x3dv") + default void programUniformMatrix4x3dv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, double[] value) { + throw new ContextException(); } - public static void programUniformMatrix4x3dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) { + @Skip + default void programUniformMatrix4x3dv(SegmentAllocator allocator, int program, int location, boolean transpose, double[] value) { programUniformMatrix4x3dv(allocator, program, location, value.length / 12, transpose, value); } - public static void programUniformMatrix4x3fv(int program, int location, int count, boolean transpose, MemorySegment value) { - var caps = getCapabilities(); - try { - check(caps.glProgramUniformMatrix4x3fv).invokeExact(program, location, count, transpose, value); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glProgramUniformMatrix4x3fv") + default void programUniformMatrix4x3fv(int program, int location, int count, boolean transpose, MemorySegment value) { + throw new ContextException(); } - public static void programUniformMatrix4x3fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) { - programUniformMatrix4x3fv(program, location, count, transpose, allocator.allocateFrom(JAVA_FLOAT, value)); + @Entrypoint("glProgramUniformMatrix4x3fv") + default void programUniformMatrix4x3fv(SegmentAllocator allocator, int program, int location, int count, boolean transpose, float[] value) { + throw new ContextException(); } - public static void programUniformMatrix4x3fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) { + @Skip + default void programUniformMatrix4x3fv(SegmentAllocator allocator, int program, int location, boolean transpose, float[] value) { programUniformMatrix4x3fv(allocator, program, location, value.length / 12, transpose, value); } - public static void releaseShaderCompiler() { - var caps = getCapabilities(); - try { - check(caps.glReleaseShaderCompiler).invokeExact(); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glReleaseShaderCompiler") + default void releaseShaderCompiler() { + throw new ContextException(); } - public static void scissorArrayv(int first, int count, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glScissorArrayv).invokeExact(first, count, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glScissorArrayv") + default void scissorArrayv(int first, int count, MemorySegment v) { + throw new ContextException(); } - public static void scissorArrayv(SegmentAllocator allocator, int first, int count, int[] v) { - scissorArrayv(first, count, allocator.allocateFrom(JAVA_INT, v)); + @Entrypoint("glScissorArrayv") + default void scissorArrayv(SegmentAllocator allocator, int first, int count, int[] v) { + throw new ContextException(); } - public static void scissorIndexed(int index, int left, int bottom, int width, int height) { - var caps = getCapabilities(); - try { - check(caps.glScissorIndexed).invokeExact(index, left, bottom, width, height); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glScissorIndexed") + default void scissorIndexed(int index, int left, int bottom, int width, int height) { + throw new ContextException(); } - public static void scissorIndexedv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glScissorIndexedv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glScissorIndexedv") + default void scissorIndexedv(int index, MemorySegment v) { + throw new ContextException(); } - public static void scissorIndexedv(SegmentAllocator allocator, int index, int[] v) { - scissorIndexedv(index, allocator.allocateFrom(JAVA_INT, v)); + @Entrypoint("glScissorIndexedv") + default void scissorIndexedv(SegmentAllocator allocator, int index, int[] v) { + throw new ContextException(); } - public static void shaderBinary(int count, MemorySegment shaders, int binaryFormat, MemorySegment binary, int length) { - var caps = getCapabilities(); - try { - check(caps.glShaderBinary).invokeExact(count, shaders, binaryFormat, binary, length); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glShaderBinary") + default void shaderBinary(int count, MemorySegment shaders, int binaryFormat, MemorySegment binary, int length) { + throw new ContextException(); } - public static void shaderBinary(SegmentAllocator allocator, int[] shaders, int binaryFormat, MemorySegment binary, int length) { - shaderBinary(shaders.length, allocator.allocateFrom(JAVA_INT, shaders), binaryFormat, binary, length); + @Skip + default void shaderBinary(SegmentAllocator allocator, int[] shaders, int binaryFormat, MemorySegment binary, int length) { + shaderBinary(shaders.length, Marshal.marshal(allocator, shaders), binaryFormat, binary, length); } - public static void shaderBinary(SegmentAllocator allocator, int[] shaders, int binaryFormat, MemorySegment binary) { - shaderBinary(allocator, shaders, binaryFormat, binary, (int) binary.byteSize()); + @Skip + default void shaderBinary(SegmentAllocator allocator, int[] shaders, int binaryFormat, MemorySegment binary) { + shaderBinary(allocator, shaders, binaryFormat, binary, Math.toIntExact(binary.byteSize())); } - public static void useProgramStages(int pipeline, int stages, int program) { - var caps = getCapabilities(); - try { - check(caps.glUseProgramStages).invokeExact(pipeline, stages, program); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glUseProgramStages") + default void useProgramStages(int pipeline, int stages, int program) { + throw new ContextException(); } - public static void validateProgramPipeline(int pipeline) { - var caps = getCapabilities(); - try { - check(caps.glValidateProgramPipeline).invokeExact(pipeline); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glValidateProgramPipeline") + default void validateProgramPipeline(int pipeline) { + throw new ContextException(); } - public static void vertexAttribL1d(int index, double x) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribL1d).invokeExact(index, x); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribL1d") + default void vertexAttribL1d(int index, double x) { + throw new ContextException(); } - public static void vertexAttribL1dv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribL1dv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribL1dv") + default void vertexAttribL1dv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttribL1dv(SegmentAllocator allocator, int index, double[] v) { - vertexAttribL1dv(index, allocator.allocateFrom(JAVA_DOUBLE, v)); + @Entrypoint("glVertexAttribL1dv") + default void vertexAttribL1dv(SegmentAllocator allocator, int index, double[] v) { + throw new ContextException(); } - public static void vertexAttribL2d(int index, double x, double y) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribL2d).invokeExact(index, x, y); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribL2d") + default void vertexAttribL2d(int index, double x, double y) { + throw new ContextException(); } - public static void vertexAttribL2dv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribL2dv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribL2dv") + default void vertexAttribL2dv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttribL2dv(SegmentAllocator allocator, int index, double[] v) { - vertexAttribL2dv(index, allocator.allocateFrom(JAVA_DOUBLE, v)); + @Entrypoint("glVertexAttribL2dv") + default void vertexAttribL2dv(SegmentAllocator allocator, int index, double[] v) { + throw new ContextException(); } - public static void vertexAttribL3d(int index, double x, double y, double z) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribL3d).invokeExact(index, x, y, z); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribL3d") + default void vertexAttribL3d(int index, double x, double y, double z) { + throw new ContextException(); } - public static void vertexAttribL3dv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribL3dv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribL3dv") + default void vertexAttribL3dv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttribL3dv(SegmentAllocator allocator, int index, double[] v) { - vertexAttribL3dv(index, allocator.allocateFrom(JAVA_DOUBLE, v)); + @Entrypoint("glVertexAttribL3dv") + default void vertexAttribL3dv(SegmentAllocator allocator, int index, double[] v) { + throw new ContextException(); } - public static void vertexAttribL4d(int index, double x, double y, double z, double w) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribL4d).invokeExact(index, x, y, z, w); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribL4d") + default void vertexAttribL4d(int index, double x, double y, double z, double w) { + throw new ContextException(); } - public static void vertexAttribL4dv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribL4dv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribL4dv") + default void vertexAttribL4dv(int index, MemorySegment v) { + throw new ContextException(); } - public static void vertexAttribL4dv(SegmentAllocator allocator, int index, double[] v) { - vertexAttribL4dv(index, allocator.allocateFrom(JAVA_DOUBLE, v)); + @Entrypoint("glVertexAttribL4dv") + default void vertexAttribL4dv(SegmentAllocator allocator, int index, double[] v) { + throw new ContextException(); } - public static void vertexAttribLPointer(int index, int size, int type, int stride, MemorySegment pointer) { - var caps = getCapabilities(); - try { - check(caps.glVertexAttribLPointer).invokeExact(index, size, type, stride, pointer); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glVertexAttribLPointer") + default void vertexAttribLPointer(int index, int size, int type, int stride, MemorySegment pointer) { + throw new ContextException(); } - public static void vertexAttribLPointer(SegmentAllocator allocator, int index, int size, int type, int stride, double[] pointer) { - vertexAttribLPointer(index, size, type, stride, allocator.allocateFrom(JAVA_DOUBLE, pointer)); + @Entrypoint("glVertexAttribLPointer") + default void vertexAttribLPointer(SegmentAllocator allocator, int index, int size, int type, int stride, double[] pointer) { + throw new ContextException(); } - public static void viewportArrayv(int first, int count, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glViewportArrayv).invokeExact(first, count, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glViewportArrayv") + default void viewportArrayv(int first, int count, MemorySegment v) { + throw new ContextException(); } - public static void viewportArrayv(SegmentAllocator allocator, int first, int count, float[] v) { - viewportArrayv(first, count, allocator.allocateFrom(JAVA_FLOAT, v)); + @Entrypoint("glViewportArrayv") + default void viewportArrayv(SegmentAllocator allocator, int first, int count, float[] v) { + throw new ContextException(); } - public static void viewportIndexedf(int index, float x, float y, float w, float h) { - var caps = getCapabilities(); - try { - check(caps.glViewportIndexedf).invokeExact(index, x, y, w, h); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glViewportIndexedf") + default void viewportIndexedf(int index, float x, float y, float w, float h) { + throw new ContextException(); } - public static void viewportIndexedfv(int index, MemorySegment v) { - var caps = getCapabilities(); - try { - check(caps.glViewportIndexedfv).invokeExact(index, v); - } catch (Throwable e) { - throw new AssertionError("should not reach here", e); - } + @Entrypoint("glViewportIndexedfv") + default void viewportIndexedfv(int index, MemorySegment v) { + throw new ContextException(); } - public static void viewportIndexedfv(SegmentAllocator allocator, int index, float[] v) { - viewportIndexedfv(index, allocator.allocateFrom(JAVA_FLOAT, v)); + @Entrypoint("glViewportIndexedfv") + default void viewportIndexedfv(SegmentAllocator allocator, int index, float[] v) { + throw new ContextException(); } } diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLCapabilities.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLCapabilities.java index f2c8c72c..99594848 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLCapabilities.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLCapabilities.java @@ -33,24 +33,6 @@ */ public final class GLCapabilities { private static final Pattern VERSION_PATTERN = Pattern.compile("^(\\d+)\\.(\\d+).*$"); - /** - * OpenGL 2.0 method handles - */ - public MethodHandle glAttachShader, glBindAttribLocation, glBlendEquationSeparate, glCompileShader, glCreateProgram, glCreateShader, - glDeleteProgram, glDeleteShader, glDetachShader, glDisableVertexAttribArray, glDrawBuffers, glEnableVertexAttribArray, - glGetActiveAttrib, glGetActiveUniform, glGetAttachedShaders, glGetAttribLocation, glGetProgramInfoLog, glGetProgramiv, - glGetShaderInfoLog, glGetShaderSource, glGetShaderiv, glGetUniformLocation, glGetUniformfv, glGetUniformiv, - glGetVertexAttribPointerv, glGetVertexAttribdv, glGetVertexAttribfv, glGetVertexAttribiv, glIsProgram, glIsShader, - glLinkProgram, glShaderSource, glStencilFuncSeparate, glStencilMaskSeparate, glStencilOpSeparate, glUniform1f, - glUniform1fv, glUniform1i, glUniform1iv, glUniform2f, glUniform2fv, glUniform2i, glUniform2iv, glUniform3f, - glUniform3fv, glUniform3i, glUniform3iv, glUniform4f, glUniform4fv, glUniform4i, glUniform4iv, glUniformMatrix2fv, - glUniformMatrix3fv, glUniformMatrix4fv, glUseProgram, glValidateProgram, glVertexAttrib1d, glVertexAttrib1dv, - glVertexAttrib1f, glVertexAttrib1fv, glVertexAttrib1s, glVertexAttrib1sv, glVertexAttrib2d, glVertexAttrib2dv, - glVertexAttrib2f, glVertexAttrib2fv, glVertexAttrib2s, glVertexAttrib2sv, glVertexAttrib3d, glVertexAttrib3dv, - glVertexAttrib3f, glVertexAttrib3fv, glVertexAttrib3s, glVertexAttrib3sv, glVertexAttrib4Nbv, glVertexAttrib4Niv, - glVertexAttrib4Nsv, glVertexAttrib4Nub, glVertexAttrib4Nubv, glVertexAttrib4Nuiv, glVertexAttrib4Nusv, glVertexAttrib4bv, - glVertexAttrib4d, glVertexAttrib4dv, glVertexAttrib4f, glVertexAttrib4fv, glVertexAttrib4iv, glVertexAttrib4s, - glVertexAttrib4sv, glVertexAttrib4ubv, glVertexAttrib4uiv, glVertexAttrib4usv, glVertexAttribPointer; /** * OpenGL 3.0 method handles */ @@ -149,9 +131,6 @@ public int load(GLLoadFunc load) { final MethodHandle glGetString = load.invoke("glGetString", FunctionDescriptor.of(Unmarshal.STR_LAYOUT, ValueLayout.JAVA_INT)); if (glGetString == null) return 0; - GL20C.load(this, load); - GL30C.load(this, load); - GL41C.load(this, load); GL45C.load(this, load); int version = findCoreGL(glGetString); diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLLoadFunc.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLLoadFunc.java index 659da47f..0702b585 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLLoadFunc.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLLoadFunc.java @@ -31,7 +31,7 @@ * {@snippet lang = java: * // loads OpenGL forward-compatible profile * import java.util.Objects; - * Objects.requireNonNull(GLLoader.load(GLFW::getProcAddress, true), "Failed to load OpenGL"); + * Objects.requireNonNull(GLLoader.load(glfw::getProcAddress), "Failed to load OpenGL"); * } * * @author squid233 diff --git a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLLoader.java b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLLoader.java index 18d62129..f1d78627 100644 --- a/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLLoader.java +++ b/modules/overrungl.opengl/src/main/java/overrungl/opengl/GLLoader.java @@ -48,7 +48,8 @@ * @since 0.1.0 */ public final class GLLoader { - private static final boolean DEFAULT_COMPATIBLE = false; + private static final boolean DEFAULT_COMPATIBLE = true; + @Deprecated(since = "0.1.0") private static final ThreadLocal capabilitiesTLS = new ThreadLocal<>(); /** @@ -57,6 +58,7 @@ public final class GLLoader { *

This {@code GLCapabilities} instance will be used by any OpenGL call in the current thread, until {@code setCapabilities} is called again with a * different value.

*/ + @Deprecated(since = "0.1.0") public static void setCapabilities(@Nullable GLCapabilities caps) { capabilitiesTLS.set(caps); } @@ -68,6 +70,7 @@ public static void setCapabilities(@Nullable GLCapabilities caps) { * * @see #getCapabilities() */ + @Deprecated(since = "0.1.0") public static GLCapabilities getCapabilitiesSafe() { return capabilitiesTLS.get(); } @@ -78,6 +81,7 @@ public static GLCapabilities getCapabilitiesSafe() { * @throws IllegalStateException if {@link #setCapabilities} has never been called in the current thread or was last called with a {@code null} value * @see #getCapabilitiesSafe() */ + @Deprecated(since = "0.1.0") public static GLCapabilities getCapabilities() { return checkCapabilities(capabilitiesTLS.get()); } @@ -92,10 +96,12 @@ public static GLCapabilities getCapabilities() { * * @throws IllegalStateException if {@link #setCapabilities} has never been called in the current thread or was last called with a {@code null} value */ + @Deprecated(since = "0.1.0") public static GLExtCaps getExtCapabilities() { return getCapabilities().ext(); } + @Deprecated(since = "0.1.0") private static GLCapabilities checkCapabilities(@Nullable GLCapabilities caps) { if (RuntimeHelper.CHECKS) CheckUtil.check(caps != null, """ diff --git a/modules/samples/src/test/java/overrungl/demo/glfw/GLFWWindowIconTest.java b/modules/samples/src/test/java/overrungl/demo/glfw/GLFWWindowIconTest.java index 1443f4c0..e100b196 100644 --- a/modules/samples/src/test/java/overrungl/demo/glfw/GLFWWindowIconTest.java +++ b/modules/samples/src/test/java/overrungl/demo/glfw/GLFWWindowIconTest.java @@ -109,7 +109,7 @@ private void init(Arena arena) { } private void load() { - Objects.requireNonNull(GLLoader.load(glfw::getProcAddress, true), "Failed to load OpenGL"); + Objects.requireNonNull(GLLoader.load(glfw::getProcAddress), "Failed to load OpenGL"); GL.clearColor(0.4f, 0.6f, 0.9f, 1.0f); } diff --git a/modules/samples/src/test/java/overrungl/demo/opengl/GL10Test.java b/modules/samples/src/test/java/overrungl/demo/opengl/GL10Test.java index 5cc93b34..3fbdf3cb 100644 --- a/modules/samples/src/test/java/overrungl/demo/opengl/GL10Test.java +++ b/modules/samples/src/test/java/overrungl/demo/opengl/GL10Test.java @@ -81,7 +81,7 @@ private void init() { } private void load() { - Objects.requireNonNull(GLLoader.load(glfw::getProcAddress), "Failed to load OpenGL"); + Objects.requireNonNull(GLLoader.load(glfw::getProcAddress, false), "Failed to load OpenGL"); GL.clearColor(0.4f, 0.6f, 0.9f, 1.0f); } diff --git a/modules/samples/src/test/java/overrungl/demo/opengl/GL15Test.java b/modules/samples/src/test/java/overrungl/demo/opengl/GL15Test.java index 076543de..15b6a6dc 100644 --- a/modules/samples/src/test/java/overrungl/demo/opengl/GL15Test.java +++ b/modules/samples/src/test/java/overrungl/demo/opengl/GL15Test.java @@ -93,7 +93,7 @@ private void init() { } private void load(Arena arena) { - Objects.requireNonNull(GLLoader.load(glfw::getProcAddress), "Failed to load OpenGL"); + Objects.requireNonNull(GLLoader.load(glfw::getProcAddress, false), "Failed to load OpenGL"); GL.clearColor(0.4f, 0.6f, 0.9f, 1.0f); GL.enable(GL.TEXTURE_2D); diff --git a/modules/samples/src/test/java/overrungl/demo/opengl/GL30Test.java b/modules/samples/src/test/java/overrungl/demo/opengl/GL30Test.java index 95200ff4..9e08d070 100644 --- a/modules/samples/src/test/java/overrungl/demo/opengl/GL30Test.java +++ b/modules/samples/src/test/java/overrungl/demo/opengl/GL30Test.java @@ -99,7 +99,7 @@ private void init() { } private void load(Arena arena) { - Objects.requireNonNull(GLLoader.load(glfw::getProcAddress, true), "Failed to load OpenGL"); + Objects.requireNonNull(GLLoader.load(glfw::getProcAddress), "Failed to load OpenGL"); GL.clearColor(0.4f, 0.6f, 0.9f, 1.0f); diff --git a/modules/samples/src/test/java/overrungl/demo/opengl/GL33Test.java b/modules/samples/src/test/java/overrungl/demo/opengl/GL33Test.java index 7eef2b79..aab27efd 100644 --- a/modules/samples/src/test/java/overrungl/demo/opengl/GL33Test.java +++ b/modules/samples/src/test/java/overrungl/demo/opengl/GL33Test.java @@ -111,7 +111,7 @@ private void init() { } private void load(Arena arena) { - Objects.requireNonNull(GLLoader.load(glfw::getProcAddress, true), "Failed to load OpenGL"); + Objects.requireNonNull(GLLoader.load(glfw::getProcAddress), "Failed to load OpenGL"); debugProc = GLUtil.setupDebugMessageCallback(); GL.clearColor(0.4f, 0.6f, 0.9f, 1.0f);