Skip to content
Permalink
Browse files

Added support for OpenGL 4.5 and new extensions.

  • Loading branch information...
Spasi committed Aug 14, 2014
1 parent 7abac50 commit 57c2db0855379b6fe76a64fce9752586e4b62d05
@@ -221,10 +221,10 @@ public static ContextCapabilities createCapabilities(boolean forwardCompatible)
throw new IllegalStateException("OpenGL 1.1 is required.");

int[][] GL_VERSIONS = {
{ 1, 2, 3, 4, 5 }, // OpenGL 1
{ 0, 1 }, // OpenGL 2
{ 0, 1, 2, 3 }, // OpenGL 3
{ 0, 1, 2, 3 }, // OpenGL 4
{ 1, 2, 3, 4, 5 }, // OpenGL 1
{ 0, 1 }, // OpenGL 2
{ 0, 1, 2, 3 }, // OpenGL 3
{ 0, 1, 2, 3, 4, 5 }, // OpenGL 4
};

Set<String> supportedExtensions = new HashSet<>(128);
@@ -159,4 +159,7 @@ private fun String.nativeClassWGL(templateName: String, postfix: String = "", in
nativeClassGL(templateName, "wgl", "WGL", postfix = postfix, init = init)

private fun String.nativeClassGLX(templateName: String, postfix: String = "", init: (NativeClass.() -> Unit)? = null) =
nativeClassGL(templateName, "glx", "GLX", "glX", postfix, init)
nativeClassGL(templateName, "glx", "GLX", "glX", postfix, init)

private val NativeClassFunction.dsaLink: String
get() = "${this.nativeClass.className}${this.javaDocLink}"
@@ -0,0 +1,24 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: http://lwjgl.org/license.php
*/
package org.lwjgl.opengl.templates

import org.lwjgl.generator.*
import org.lwjgl.opengl.*

fun ARB_ES3_1_compatibility() = "ARBES31Compatibility".nativeClassGL("ARB_ES3_1_compatibility") {
nativeImport (
"OpenGL.h"
)

documentation =
"""
Native bindings to the ${url("http://www.opengl.org/registry/specs/ARB/ES3_1_compatibility.txt", templateName)} extension.
This extension adds support for features of OpenGL ES 3.1 that are missing from OpenGL 4.4. Enabling these features will ease the process of porting
applications from OpenGL ES 3.1 to OpenGL.
"""

GL45 reuse "MemoryBarrierByRegion"
}
@@ -0,0 +1,45 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: http://lwjgl.org/license.php
*/
package org.lwjgl.opengl.templates

import org.lwjgl.generator.*
import org.lwjgl.opengl.*

fun ARB_clip_control() = "ARBClipControl".nativeClassGL("ARB_clip_control") {
nativeImport (
"OpenGL.h"
)

documentation =
"""
Native bindings to the ${url("http://www.opengl.org/registry/specs/ARB/clip_control.txt", templateName)} extension.
This extension provides additional clip control modes to configure how clip space is mapped to window space. This extension's goal is to 1) allow
OpenGL to effectively match Direct3D's coordinate system conventions, and 2) potentially improve the numerical precision of the Z coordinate mapping.
"""

IntConstant.block(
"Accepted by the {@code origin} parameter of #ClipControl().",

"LOWER_LEFT" _ 0x8CA1,
"UPPER_LEFT" _ 0x8CA2
)

IntConstant.block(
"Accepted by the {@code depth} parameter of #ClipControl().",

"NEGATIVE_ONE_TO_ONE" _ 0x935E,
"ZERO_TO_ONE" _ 0x935F
)

IntConstant.block(
"Accepted by the {@code pname} parameter of GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev.",

"CLIP_ORIGIN" _ 0x935C,
"CLIP_DEPTH_MODE" _ 0x935D
)

GL45 reuse "ClipControl"
}
@@ -0,0 +1,30 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: http://lwjgl.org/license.php
*/
package org.lwjgl.opengl.templates

import org.lwjgl.generator.*
import org.lwjgl.opengl.*

fun ARB_conditional_render_inverted() = "ARBConditionalRenderInverted".nativeClassGL("ARB_conditional_render_inverted") {
nativeImport (
"OpenGL.h"
)

documentation =
"""
Native bindings to the ${url("http://www.opengl.org/registry/specs/ARB/conditional_render_inverted.txt", templateName)} extension.
This extension adds new modes to GL30#BeginConditionalRender() which invert the condition used to determine whether to draw or not.
"""

IntConstant.block(
"Accepted by the {@code mode} parameter of GL30#BeginConditionalRender().",

"QUERY_WAIT_INVERTED" _ 0x8E17,
"QUERY_NO_WAIT_INVERTED" _ 0x8E18,
"QUERY_BY_REGION_WAIT_INVERTED" _ 0x8E19,
"QUERY_BY_REGION_NO_WAIT_INVERTED" _ 0x8E1A
)
}
@@ -0,0 +1,30 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: http://lwjgl.org/license.php
*/
package org.lwjgl.opengl.templates

import org.lwjgl.generator.*
import org.lwjgl.opengl.*

fun ARB_cull_distance() = "ARBCullDistance".nativeClassGL("ARB_cull_distance") {
nativeImport (
"OpenGL.h"
)

documentation =
"""
Native bindings to the ${url("http://www.opengl.org/registry/specs/ARB/cull_distance.txt", templateName)} extension.
This extension adds a new GLSL {@code gl_CullDistance} shader output, similar to {@code gl_ClipDistance}, but used for whole primitive culling.
This new stage in the pipeline is added as part of the primitive clipping stage.
"""

IntConstant.block(
"Accepted by the {@code pname} parameter of GetBooleanv, GetDoublev, GetFloatv, GetIntegerv, and GetInteger64v.",

"MAX_CULL_DISTANCES" _ 0x82F9,
"MAX_COMBINED_CLIP_AND_CULL_DISTANCES" _ 0x82FA
)
}
@@ -0,0 +1,141 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: http://lwjgl.org/license.php
*/
package org.lwjgl.opengl.templates

import org.lwjgl.generator.*
import org.lwjgl.opengl.*

fun ARB_direct_state_access() = "ARBDirectStateAccess".nativeClassGL("ARB_direct_state_access") {
nativeImport (
"OpenGL.h"
)

documentation =
"""
Native bindings to the ${url("http://www.opengl.org/registry/specs/ARB/direct_state_access.txt", templateName)} extension.
In unextended OpenGL, most mutation of state contained in objects is through an indirection known as a binding. Objects are attached to a context
(either directly or indirectly via a container) and then commands to modify or query their state are issued on that context, indirecting through its
attachments and into the underlying object. This is known as `bind-to-edit'.
This extension derives from the GL_EXT_direct_state_access extension, which added accessors for most state on most objects, allowing it to be queried
and modified without the object needing to be bound to a context. In cases where a single property of an object is to be modified, directly accessing
its state can be more efficient than binding the object to the context and then indirecting through it. Further, directly accessing the state of objects
through their names rather than by bind-to-edit does not disturb the bindings of the current context, which is useful for tools, middleware and other
applications that are unaware of the outer state but it can also avoid cases of redundant state changes.
"""

IntConstant.block(
"Accepted by the {@code pname} parameter of GetTextureParameter{if}v and GetTextureParameterI{i ui}v.",

"TEXTURE_TARGET" _ 0x1006
)

IntConstant.block(
"Accepted by the {@code pname} parameter of GetQueryObjectiv.",

"QUERY_TARGET" _ 0x82EA
)

IntConstant.block(
"Accepted by the {@code pname} parameter of GetIntegeri_v.",

"TEXTURE_BINDING" _ 0x82EB
)

GL45 reuse "CreateTransformFeedbacks"
GL45 reuse "TransformFeedbackBufferBase"
GL45 reuse "TransformFeedbackBufferRange"
GL45 reuse "GetTransformFeedbackiv"
GL45 reuse "GetTransformFeedbacki_v"
GL45 reuse "GetTransformFeedbacki64_v"
GL45 reuse "CreateBuffers"
GL45 reuse "NamedBufferStorage"
GL45 reuse "NamedBufferData"
GL45 reuse "NamedBufferSubData"
GL45 reuse "CopyNamedBufferSubData"
GL45 reuse "ClearNamedBufferData"
GL45 reuse "ClearNamedBufferSubData"
GL45 reuse "MapNamedBuffer"
GL45 reuse "MapNamedBufferRange"
GL45 reuse "UnmapNamedBuffer"
GL45 reuse "FlushMappedNamedBufferRange"
GL45 reuse "GetNamedBufferParameteriv"
GL45 reuse "GetNamedBufferParameteri64v"
GL45 reuse "GetNamedBufferPointerv"
GL45 reuse "GetNamedBufferSubData"
GL45 reuse "CreateFramebuffers"
GL45 reuse "NamedFramebufferRenderbuffer"
GL45 reuse "NamedFramebufferParameteri"
GL45 reuse "NamedFramebufferTexture"
GL45 reuse "NamedFramebufferTextureLayer"
GL45 reuse "NamedFramebufferDrawBuffer"
GL45 reuse "NamedFramebufferDrawBuffers"
GL45 reuse "NamedFramebufferReadBuffer"
GL45 reuse "InvalidateNamedFramebufferData"
GL45 reuse "InvalidateNamedFramebufferSubData"
GL45 reuse "ClearNamedFramebufferiv"
GL45 reuse "ClearNamedFramebufferuiv"
GL45 reuse "ClearNamedFramebufferfv"
GL45 reuse "ClearNamedFramebufferfi"
GL45 reuse "BlitNamedFramebuffer"
GL45 reuse "CheckNamedFramebufferStatus"
GL45 reuse "GetNamedFramebufferParameteriv"
GL45 reuse "GetNamedFramebufferAttachmentParameteriv"
GL45 reuse "CreateRenderbuffers"
GL45 reuse "NamedRenderbufferStorage"
GL45 reuse "NamedRenderbufferStorageMultisample"
GL45 reuse "GetNamedRenderbufferParameteriv"
GL45 reuse "CreateTextures"
GL45 reuse "TextureBuffer"
GL45 reuse "TextureBufferRange"
GL45 reuse "TextureStorage1D"
GL45 reuse "TextureStorage2D"
GL45 reuse "TextureStorage3D"
GL45 reuse "TextureStorage2DMultisample"
GL45 reuse "TextureStorage3DMultisample"
GL45 reuse "TextureSubImage1D"
GL45 reuse "TextureSubImage2D"
GL45 reuse "TextureSubImage3D"
GL45 reuse "CompressedTextureSubImage1D"
GL45 reuse "CompressedTextureSubImage2D"
GL45 reuse "CompressedTextureSubImage3D"
GL45 reuse "CopyTextureSubImage1D"
GL45 reuse "CopyTextureSubImage2D"
GL45 reuse "CopyTextureSubImage3D"
GL45 reuse "TextureParameterf"
GL45 reuse "TextureParameterfv"
GL45 reuse "TextureParameteri"
GL45 reuse "TextureParameterIiv"
GL45 reuse "TextureParameterIuiv"
GL45 reuse "TextureParameteriv"
GL45 reuse "GenerateTextureMipmap"
GL45 reuse "BindTextureUnit"
GL45 reuse "GetTextureImage"
GL45 reuse "GetCompressedTextureImage"
GL45 reuse "GetTextureLevelParameterfv"
GL45 reuse "GetTextureLevelParameteriv"
GL45 reuse "GetTextureParameterfv"
GL45 reuse "GetTextureParameterIiv"
GL45 reuse "GetTextureParameterIuiv"
GL45 reuse "GetTextureParameteriv"
GL45 reuse "CreateVertexArrays"
GL45 reuse "DisableVertexArrayAttrib"
GL45 reuse "EnableVertexArrayAttrib"
GL45 reuse "VertexArrayElementBuffer"
GL45 reuse "VertexArrayVertexBuffer"
GL45 reuse "VertexArrayVertexBuffers"
GL45 reuse "VertexArrayAttribFormat"
GL45 reuse "VertexArrayAttribIFormat"
GL45 reuse "VertexArrayAttribLFormat"
GL45 reuse "VertexArrayAttribBinding"
GL45 reuse "VertexArrayBindingDivisor"
GL45 reuse "GetVertexArrayiv"
GL45 reuse "GetVertexArrayIndexediv"
GL45 reuse "GetVertexArrayIndexed64iv"
GL45 reuse "CreateSamplers"
GL45 reuse "CreateProgramPipelines"
GL45 reuse "CreateQueries"
}
@@ -0,0 +1,24 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: http://lwjgl.org/license.php
*/
package org.lwjgl.opengl.templates

import org.lwjgl.generator.*
import org.lwjgl.opengl.*

fun ARB_get_texture_sub_image() = "ARBGetTextureSubImage".nativeClassGL("ARB_get_texture_sub_image") {
nativeImport (
"OpenGL.h"
)

documentation =
"""
Native bindings to the ${url("http://www.opengl.org/registry/specs/ARB/get_texture_sub_image.txt", templateName)} extension.
This extension adds a new function to get sub-regions of texture images.
"""

GL45 reuse "GetTextureSubImage"
GL45 reuse "GetCompressedTextureSubImage"
}
@@ -0,0 +1,41 @@
/*
* Copyright LWJGL. All rights reserved.
* License terms: http://lwjgl.org/license.php
*/
package org.lwjgl.opengl.templates

import org.lwjgl.generator.*
import org.lwjgl.opengl.*

fun ARB_pipeline_statistics_query() = "ARBPipelineStatisticsQuery".nativeClassGL("ARB_pipeline_statistics_query") {
nativeImport (
"OpenGL.h"
)

documentation =
"""
Native bindings to the ${url("http://www.opengl.org/registry/specs/ARB/pipeline_statistics_query.txt", templateName)} extension.
This extension introduces new query types that allow applications to get statistics information about different parts of the pipeline.
"""


IntConstant.block(
"""
Accepted by the {@code target} parameter of GL15#BeginQuery(), GL15#EndQuery(), GL15#GetQueryiv(),
GL40#BeginQueryIndexed(), GL40#EndQueryIndexed() and GL40#GetQueryIndexediv().
""",

"VERTICES_SUBMITTED_ARB" _ 0x82EE,
"PRIMITIVES_SUBMITTED_ARB" _ 0x82EF,
"VERTEX_SHADER_INVOCATIONS_ARB" _ 0x82F0,
"TESS_CONTROL_SHADER_PATCHES_ARB" _ 0x82F1,
"TESS_EVALUATION_SHADER_INVOCATIONS_ARB" _ 0x82F2,
"GEOMETRY_SHADER_INVOCATIONS" _ 0x887F,
"GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB" _ 0x82F3,
"FRAGMENT_SHADER_INVOCATIONS_ARB" _ 0x82F4,
"COMPUTE_SHADER_INVOCATIONS_ARB" _ 0x82F5,
"CLIPPING_INPUT_PRIMITIVES_ARB" _ 0x82F6,
"CLIPPING_OUTPUT_PRIMITIVES_ARB" _ 0x82F7
)
}

0 comments on commit 57c2db0

Please sign in to comment.
You can’t perform that action at this time.